Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/smoke-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,12 @@ node "$repo_root/dist/index.js" init python-api py-api > py.json
test -f py-api/src/py_api/main.py
node "$repo_root/dist/index.js" init next-app web-app > next.json
test -f web-app/src/app/page.tsx
test -f web-app/eslint.config.mjs
(
cd web-app
npm install
npm run lint
bash scripts/validate.sh
)

echo "smoke-init ok"
16 changes: 15 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const templateScaffolds: Record<TemplateKey, TemplateScaffold> = {
{ source: 'templates/repo-docs/README.md', destination: 'docs/README.md' },
{ source: 'templates/repo-validate/validate.sh', destination: 'scripts/validate.sh' },
{ destination: 'package.json', content: nextPackageJsonTemplate() },
{ destination: 'eslint.config.mjs', content: nextEslintConfigTemplate() },
{ destination: 'src/app/page.tsx', content: "export default function Home() {\n return <main>{{PROJECT_NAME}}</main>;\n}\n" },
{ destination: 'src/app/layout.tsx', content: "export default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n );\n}\n" }
]
Expand Down Expand Up @@ -518,7 +519,7 @@ function nextPackageJsonTemplate(): string {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "eslint ."
},
"dependencies": {
"next": "latest",
Expand All @@ -528,12 +529,25 @@ function nextPackageJsonTemplate(): string {
"devDependencies": {
"@types/node": "latest",
"@types/react": "latest",
"eslint": "latest",
"eslint-config-next": "latest",
"typescript": "latest"
}
}
`;
}

function nextEslintConfigTemplate(): string {
return `import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";

export default defineConfig([
...nextVitals,
globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"])
]);
`;
}

function pythonProjectTemplate(): string {
return `[project]
name = "{{PROJECT_NAME}}"
Expand Down
Loading