Skip to content

Commit bc1ea04

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/templates/frontend/next-14.2.32
2 parents 20842af + dfe6e94 commit bc1ea04

File tree

21 files changed

+2107
-8
lines changed

21 files changed

+2107
-8
lines changed

.copilot/tasks.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"version": "1.0.0",
3+
"name": "Create Polyglot Framework Tasks",
4+
"description": "Task plan for developing the create-polyglot CLI framework for polyglot microservices.",
5+
"tasks": [
6+
{
7+
"id": "init-cli",
8+
"title": "Initialize CLI Project Structure",
9+
"description": "Set up the Node.js CLI using oclif or Commander. Add basic command parsing and help menus.",
10+
"steps": [
11+
"Run `npm init -y` and install dependencies (`commander`, `execa`, `chalk`, `inquirer`).",
12+
"Set up `bin/create-polyglot.js` entry point.",
13+
"Implement the CLI banner and basic help text.",
14+
"Add version and --help flags."
15+
]
16+
},
17+
{
18+
"id": "add-init-command",
19+
"title": "Implement `init` Command",
20+
"description": "Scaffold a new polyglot monorepo structure.",
21+
"steps": [
22+
"Add `polyglot init` command to create folder structure `/services`, `/gateway`, `/infra`.",
23+
"Generate a base README.md and polyglot.json config file.",
24+
"Prompt user for project name and default languages."
25+
]
26+
},
27+
{
28+
"id": "add-service-command",
29+
"title": "Implement `add service` Command",
30+
"description": "Generate new microservice boilerplate based on selected language and framework.",
31+
"steps": [
32+
"Add `polyglot add service <name> --lang <language> --framework <framework>` command.",
33+
"Copy templates from `/templates/{language}-{framework}`.",
34+
"Inject service metadata into `polyglot.json`.",
35+
"Generate Dockerfile and add service entry in `docker-compose.yml`."
36+
]
37+
},
38+
{
39+
"id": "add-dev-command",
40+
"title": "Implement `polyglot dev` Command",
41+
"description": "Run all microservices concurrently using Docker Compose or concurrently package.",
42+
"steps": [
43+
"Add `polyglot dev` command to spin up all services.",
44+
"Show colored logs for each service (use chalk or pino-pretty).",
45+
"Detect health endpoints automatically."
46+
]
47+
},
48+
{
49+
"id": "add-plugin-system",
50+
"title": "Add Plugin System",
51+
"description": "Implement plugin-based architecture for extensibility.",
52+
"steps": [
53+
"Design plugin interface (install scripts, templates, hooks).",
54+
"Add `polyglot add plugin <name>` command.",
55+
"Create official plugins for Postgres, Kafka, and Auth."
56+
]
57+
},
58+
{
59+
"id": "template-examples",
60+
"title": "Add Template Examples",
61+
"description": "Provide ready-to-run templates for common frameworks.",
62+
"steps": [
63+
"Add Node/Express, Python/FastAPI, Java/Spring Boot templates under /templates.",
64+
"Each should include minimal code + Dockerfile + README.",
65+
"Test generation for all combinations."
66+
]
67+
},
68+
{
69+
"id": "setup-ci",
70+
"title": "Setup GitHub CI for Testing & Build",
71+
"description": "Add GitHub Actions to test and build the CLI automatically.",
72+
"steps": [
73+
"Add `.github/workflows/test.yml` for lint + test + build.",
74+
"Run `npm test` on PRs.",
75+
"Publish new versions automatically to npm when tagged."
76+
]
77+
},
78+
{
79+
"id": "docs-and-readme",
80+
"title": "Add Documentation & README",
81+
"description": "Create compelling documentation for create-polyglot.",
82+
"steps": [
83+
"Write detailed README with examples and diagrams.",
84+
"Add CONTRIBUTING.md and templates for issues/PRs.",
85+
"Prepare docs site using Docusaurus or VitePress."
86+
]
87+
},
88+
{
89+
"id": "release-v1",
90+
"title": "Prepare v1.0 Release",
91+
"description": "Finalize and publish the first stable version.",
92+
"steps": [
93+
"Test all commands end-to-end.",
94+
"Bump version to 1.0.0.",
95+
"Publish to npm (`npm publish`).",
96+
"Announce release on GitHub, Reddit, and ProductHunt."
97+
]
98+
}
99+
]
100+
}

.github/pull_request_template.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## Summary
2+
Explain the change in 1–3 sentences. Reference any related issues (e.g. Closes #123).
3+
4+
## Type of Change
5+
- [ ] Feature
6+
- [ ] Bug fix
7+
- [ ] Chore / Refactor
8+
- [ ] Docs
9+
- [ ] Tests
10+
- [ ] CI / Build
11+
- [ ] Other
12+
13+
## Motivation / Context
14+
Why is this change needed? What problem does it solve or what capability does it add?
15+
16+
## Approach
17+
Briefly describe how you implemented the change. Note any notable design decisions, trade-offs, or alternatives considered.
18+
19+
## CLI Impact
20+
If this alters user-facing CLI behavior:
21+
- Added / changed flags? Describe.
22+
- Backward compatible? If breaking, explain migration path.
23+
- Sample invocation before vs after:
24+
```
25+
# before
26+
# after
27+
```
28+
29+
## Generated Output Impact
30+
List any new / modified scaffold files or structural differences (e.g. new template folder, changed Dockerfile pattern, compose changes, new preset behaviors).
31+
32+
## Tests
33+
Describe test coverage:
34+
- [ ] Added new test(s)
35+
- [ ] Updated existing test(s)
36+
- [ ] Manually smoke-tested locally
37+
- [ ] No tests needed (explain why)
38+
39+
If you ran the smoke scaffold locally, paste the command & confirm success:
40+
```
41+
node bin/index.js demo --services node --no-install --yes
42+
```
43+
Result: ✅ / ❌
44+
45+
## Screenshots / Logs (Optional)
46+
Add any helpful output (chalk-styled CLI messages, error reproduction, etc.).
47+
48+
## Docs
49+
- [ ] Updated `README.md` if needed
50+
- [ ] Updated `.github/copilot-instructions.md` if internal conventions changed
51+
- [ ] Not applicable
52+
53+
## Checklist
54+
- [ ] Code follows existing style (chalk usage, emoji prefixes, exit codes)
55+
- [ ] No accidental large asset additions outside `templates/`
56+
- [ ] Default ports preserved / conflicts handled
57+
- [ ] New service templates added to: choices array, defaultPorts, Dockerfile switch, compose mapping
58+
- [ ] Git history clean (no stray debug commits)
59+
- [ ] Dependency additions are minimal & justified
60+
61+
## Open Questions / Follow-ups
62+
List any TODOs or future enhancements not in this PR.
63+
64+
---
65+
Thanks for contributing! 🎉

.github/workflows/pr-ci.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: PR CI (Templates)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches: [ main ]
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
concurrency:
13+
group: pr-ci-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
changes:
18+
name: Detect Template Changes
19+
runs-on: ubuntu-latest
20+
outputs:
21+
node: ${{ steps.filter.outputs.node }}
22+
python: ${{ steps.filter.outputs.python }}
23+
go: ${{ steps.filter.outputs.go }}
24+
java: ${{ steps.filter.outputs.java }}
25+
frontend: ${{ steps.filter.outputs.frontend }}
26+
any: ${{ steps.filter.outputs.any }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Filter
30+
id: filter
31+
uses: dorny/paths-filter@v3
32+
with:
33+
filters: |
34+
node:
35+
- 'templates/node/**'
36+
python:
37+
- 'templates/python/**'
38+
go:
39+
- 'templates/go/**'
40+
java:
41+
- 'templates/spring-boot/**'
42+
frontend:
43+
- 'templates/frontend/**'
44+
any:
45+
- 'templates/**'
46+
47+
node:
48+
name: Node Template
49+
needs: changes
50+
if: needs.changes.outputs.node == 'true' || needs.changes.outputs.any == 'true'
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: actions/setup-node@v4
55+
with:
56+
node-version: '20'
57+
cache: npm
58+
cache-dependency-path: templates/node/package.json
59+
- name: Install deps
60+
working-directory: templates/node
61+
run: npm install --no-audit --no-fund
62+
- name: Lint (placeholder)
63+
run: echo 'No lint config yet';
64+
- name: Smoke run
65+
working-directory: templates/node
66+
run: node src/index.js & sleep 2 && curl -f http://localhost:3001/ || echo 'Sample run complete'
67+
68+
frontend:
69+
name: Next.js Template
70+
needs: changes
71+
if: needs.changes.outputs.frontend == 'true' || needs.changes.outputs.any == 'true'
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-node@v4
76+
with:
77+
node-version: '20'
78+
cache: npm
79+
cache-dependency-path: templates/frontend/package.json
80+
- name: Install deps
81+
working-directory: templates/frontend
82+
run: npm install --no-audit --no-fund
83+
- name: Build
84+
working-directory: templates/frontend
85+
run: npm run build
86+
87+
python:
88+
name: Python FastAPI Template
89+
needs: changes
90+
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.any == 'true'
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
- uses: actions/setup-python@v5
95+
with:
96+
python-version: '3.12'
97+
cache: 'pip'
98+
cache-dependency-path: templates/python/requirements.txt
99+
- name: Install deps
100+
working-directory: templates/python
101+
run: pip install -r requirements.txt
102+
- name: Import check
103+
working-directory: templates/python
104+
run: python -c "import fastapi, uvicorn"
105+
- name: FastAPI startup (smoke)
106+
working-directory: templates/python
107+
run: |
108+
uvicorn app.main:app --port 3004 &
109+
PID=$!
110+
sleep 2
111+
curl -f http://127.0.0.1:3004/health || (echo 'health check failed'; kill $PID; exit 1)
112+
kill $PID || true
113+
114+
go:
115+
name: Go Template
116+
needs: changes
117+
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.any == 'true'
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v4
121+
- name: Build
122+
working-directory: templates/go
123+
run: go build -v ./...
124+
- name: Vet
125+
working-directory: templates/go
126+
run: go vet ./...
127+
- name: Run & health
128+
working-directory: templates/go
129+
run: |
130+
go run . &
131+
PID=$!
132+
sleep 2
133+
curl -f http://127.0.0.1:3002/health || (echo 'no health'; kill $PID; exit 1)
134+
kill $PID || true
135+
136+
java:
137+
name: Spring Boot Template
138+
needs: changes
139+
if: needs.changes.outputs.java == 'true' || needs.changes.outputs.any == 'true'
140+
runs-on: ubuntu-latest
141+
steps:
142+
- uses: actions/checkout@v4
143+
- name: Set up Temurin JDK
144+
uses: actions/setup-java@v4
145+
with:
146+
distribution: 'temurin'
147+
java-version: '21'
148+
cache: 'maven'
149+
- name: Build (skip tests)
150+
working-directory: templates/spring-boot
151+
run: mvn -B -ntp package -DskipTests
152+
153+
summary:
154+
name: Summary
155+
needs: [node, frontend, python, go, java]
156+
if: always()
157+
runs-on: ubuntu-latest
158+
steps:
159+
- name: Report matrix
160+
run: |
161+
echo "Node: ${{ needs.node.result }}"
162+
echo "Frontend: ${{ needs.frontend.result }}"
163+
echo "Python: ${{ needs.python.result }}"
164+
echo "Go: ${{ needs.go.result }}"
165+
echo "Java: ${{ needs.java.result }}"
166+
if [[ '${{ needs.node.result }}' == 'failure' || '${{ needs.frontend.result }}' == 'failure' || '${{ needs.python.result }}' == 'failure' || '${{ needs.go.result }}' == 'failure' || '${{ needs.java.result }}' == 'failure' ]]; then
167+
echo 'One or more template jobs failed.'
168+
exit 1
169+
fi
170+
echo 'All selected template jobs passed.'

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,19 @@ Generates ESLint + Prettier base configs at the root. Extend rules per service i
116116

117117
## License
118118
MIT
119+
120+
## Documentation Site (VitePress)
121+
122+
Local docs development:
123+
```bash
124+
npm run docs:dev
125+
```
126+
Build static site:
127+
```bash
128+
npm run docs:build
129+
```
130+
Preview production build:
131+
```bash
132+
npm run docs:preview
133+
```
134+
Docs source lives in `docs/` with sidebar-driven structure defined in `docs/.vitepress/config.mjs`.

0 commit comments

Comments
 (0)