@teispace/next-maker 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +418 -281
  3. package/dist/index.js +372 -136
  4. package/dist/index.js.map +4 -4
  5. package/dist/src/commands/doctor.d.ts +3 -0
  6. package/dist/src/commands/doctor.d.ts.map +1 -0
  7. package/dist/src/commands/env.d.ts +3 -0
  8. package/dist/src/commands/env.d.ts.map +1 -0
  9. package/dist/src/commands/index.d.ts.map +1 -1
  10. package/dist/src/commands/layout.d.ts +3 -0
  11. package/dist/src/commands/layout.d.ts.map +1 -0
  12. package/dist/src/commands/provider.d.ts +3 -0
  13. package/dist/src/commands/provider.d.ts.map +1 -0
  14. package/dist/src/commands/remove.d.ts +3 -0
  15. package/dist/src/commands/remove.d.ts.map +1 -0
  16. package/dist/src/commands/setup.d.ts.map +1 -1
  17. package/dist/src/generators/index.d.ts +4 -0
  18. package/dist/src/generators/index.d.ts.map +1 -1
  19. package/dist/src/generators/layout.generator.d.ts +22 -0
  20. package/dist/src/generators/layout.generator.d.ts.map +1 -0
  21. package/dist/src/generators/provider.generator.d.ts +14 -0
  22. package/dist/src/generators/provider.generator.d.ts.map +1 -0
  23. package/dist/src/generators/templates/layout.template.d.ts +13 -0
  24. package/dist/src/generators/templates/layout.template.d.ts.map +1 -0
  25. package/dist/src/generators/templates/provider.template.d.ts +12 -0
  26. package/dist/src/generators/templates/provider.template.d.ts.map +1 -0
  27. package/dist/src/manifests/bundle-analyzer.manifest.d.ts +3 -0
  28. package/dist/src/manifests/bundle-analyzer.manifest.d.ts.map +1 -0
  29. package/dist/src/manifests/commitizen.manifest.d.ts +3 -0
  30. package/dist/src/manifests/commitizen.manifest.d.ts.map +1 -0
  31. package/dist/src/manifests/dark-theme.manifest.d.ts +3 -0
  32. package/dist/src/manifests/dark-theme.manifest.d.ts.map +1 -0
  33. package/dist/src/manifests/http-client.manifest.d.ts +3 -0
  34. package/dist/src/manifests/http-client.manifest.d.ts.map +1 -0
  35. package/dist/src/manifests/i18n.manifest.d.ts +3 -0
  36. package/dist/src/manifests/i18n.manifest.d.ts.map +1 -0
  37. package/dist/src/manifests/index.d.ts +23 -0
  38. package/dist/src/manifests/index.d.ts.map +1 -0
  39. package/dist/src/manifests/react-compiler.manifest.d.ts +3 -0
  40. package/dist/src/manifests/react-compiler.manifest.d.ts.map +1 -0
  41. package/dist/src/manifests/redux.manifest.d.ts +9 -0
  42. package/dist/src/manifests/redux.manifest.d.ts.map +1 -0
  43. package/dist/src/manifests/runner.d.ts +37 -0
  44. package/dist/src/manifests/runner.d.ts.map +1 -0
  45. package/dist/src/manifests/security-headers.manifest.d.ts +3 -0
  46. package/dist/src/manifests/security-headers.manifest.d.ts.map +1 -0
  47. package/dist/src/manifests/tests.manifest.d.ts +3 -0
  48. package/dist/src/manifests/tests.manifest.d.ts.map +1 -0
  49. package/dist/src/manifests/types.d.ts +105 -0
  50. package/dist/src/manifests/types.d.ts.map +1 -0
  51. package/dist/src/manifests/validate-scripts.manifest.d.ts +3 -0
  52. package/dist/src/manifests/validate-scripts.manifest.d.ts.map +1 -0
  53. package/dist/src/modifiers/env-var.modifier.d.ts +60 -0
  54. package/dist/src/modifiers/env-var.modifier.d.ts.map +1 -0
  55. package/dist/src/modifiers/index.d.ts +2 -0
  56. package/dist/src/modifiers/index.d.ts.map +1 -1
  57. package/dist/src/modifiers/root-provider.modifier.d.ts +26 -0
  58. package/dist/src/modifiers/root-provider.modifier.d.ts.map +1 -0
  59. package/dist/src/services/setup/commitizen/index.d.ts +3 -0
  60. package/dist/src/services/setup/commitizen/index.d.ts.map +1 -0
  61. package/dist/src/services/setup/commitizen/package-modifier.d.ts +17 -0
  62. package/dist/src/services/setup/commitizen/package-modifier.d.ts.map +1 -0
  63. package/dist/src/services/setup/security-headers/headers.d.ts +29 -0
  64. package/dist/src/services/setup/security-headers/headers.d.ts.map +1 -0
  65. package/dist/src/services/setup/security-headers/index.d.ts +3 -0
  66. package/dist/src/services/setup/security-headers/index.d.ts.map +1 -0
  67. package/dist/src/services/setup/validate-scripts/index.d.ts +4 -0
  68. package/dist/src/services/setup/validate-scripts/index.d.ts.map +1 -0
  69. package/dist/src/services/setup/validate-scripts/package-modifier.d.ts +19 -0
  70. package/dist/src/services/setup/validate-scripts/package-modifier.d.ts.map +1 -0
  71. package/dist/src/services/setup/validate-scripts/scripts.d.ts +12 -0
  72. package/dist/src/services/setup/validate-scripts/scripts.d.ts.map +1 -0
  73. package/package.json +3 -3
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Pure transformation logic for the `setupSecurityHeaders` retrofit.
3
+ *
4
+ * Kept separate from `index.ts` so it can be unit-tested with string inputs
5
+ * without touching the filesystem.
6
+ */
7
+ /**
8
+ * The header set the starter ships in `next.config.ts`. Single source of truth
9
+ * — `setupSecurityHeaders` and the manifest (D1) both consume this list.
10
+ */
11
+ export declare const SECURITY_HEADERS: ReadonlyArray<{
12
+ key: string;
13
+ value: string;
14
+ }>;
15
+ export declare const hasSecurityHeaders: (content: string) => boolean;
16
+ /**
17
+ * Inject the standard security-headers block into a `next.config.ts` source.
18
+ *
19
+ * - Idempotent: returns the input unchanged if a `headers:` key already exists
20
+ * anywhere in the file (we never overwrite a user-defined header set).
21
+ * - Throws if the canonical `const nextConfig: NextConfig = {` shape is missing
22
+ * — same contract as the React-Compiler retrofit, so behaviour stays
23
+ * predictable across `setup` services.
24
+ */
25
+ export declare const injectSecurityHeaders: (content: string, headers?: ReadonlyArray<{
26
+ key: string;
27
+ value: string;
28
+ }>) => string;
29
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../../../src/services/setup/security-headers/headers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAU1E,CAAC;AAyBF,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,OAAuC,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,EACf,UAAS,aAAa,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAoB,KACxE,MAQF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { hasSecurityHeaders, injectSecurityHeaders, SECURITY_HEADERS } from './headers';
2
+ export declare const setupSecurityHeaders: (projectPath: string) => Promise<void>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/setup/security-headers/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExF,eAAO,MAAM,oBAAoB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,IAAI,CAsB5E,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { addValidationScripts, type PackageJsonShape, } from './package-modifier';
2
+ export { CHECK_DEPRECATED_SCRIPT, SYNC_ENV_SCRIPT } from './scripts';
3
+ export declare const setupValidationScripts: (projectPath: string) => Promise<void>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/setup/validate-scripts/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAOrE,eAAO,MAAM,sBAAsB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,IAAI,CA0C9E,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { PackageManager } from '../../../core/package-manager';
2
+ /**
3
+ * Pure modifiers for the package.json `scripts` block — separated from the
4
+ * service so they can be unit-tested without touching the filesystem.
5
+ */
6
+ export interface PackageJsonShape {
7
+ scripts?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ [key: string]: unknown;
10
+ }
11
+ /**
12
+ * Add the validation scripts (env:sync, check:deprecated, validate) and the
13
+ * matching tsx/typescript dev-deps, never overwriting a user-defined entry.
14
+ *
15
+ * Returns a *new* package.json object — callers pass it through `updateJson`
16
+ * which already understands "function returns the new value".
17
+ */
18
+ export declare const addValidationScripts: (pkg: PackageJsonShape, manager: PackageManager) => PackageJsonShape;
19
+ //# sourceMappingURL=package-modifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-modifier.d.ts","sourceRoot":"","sources":["../../../../../src/services/setup/validate-scripts/package-modifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAgBD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,KAAK,gBAAgB,EACrB,SAAS,cAAc,KACtB,gBAsBF,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Source for the two validation scripts the starter ships under `scripts/`.
3
+ *
4
+ * Inlined here (not fetched from the starter via degit) because (a) these
5
+ * scripts are stable and don't drift, (b) we get instant offline retrofits,
6
+ * and (c) the diff between starter and next-maker is small enough to spot
7
+ * during release reviews. If they ever start to differ, switch this module
8
+ * to a degit fetch — the rest of the service won't need to change.
9
+ */
10
+ export declare const SYNC_ENV_SCRIPT = "import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nconst envPath = path.join(process.cwd(), '.env');\nconst examplePath = path.join(process.cwd(), '.env.example');\n\nif (!fs.existsSync(envPath)) {\n console.log('\u26A0\uFE0F No .env file found. Skipping sync.');\n process.exit(0);\n}\n\nconst envContent = fs.readFileSync(envPath, 'utf-8');\nconst lines = envContent.split('\\n');\n\nlet isPublicBlock = false;\n\nconst exampleLines = lines.map((line) => {\n const trimmed = line.trim();\n\n // Preserve empty lines and reset public block state\n if (!trimmed) {\n isPublicBlock = false;\n return line;\n }\n\n // Preserve comments\n if (trimmed.startsWith('#')) {\n if (line.toLowerCase().includes('-public')) {\n isPublicBlock = true;\n }\n return line;\n }\n\n // Parse KEY=VALUE\n const match = line.match(/^([^=]+)=(.*)$/);\n\n if (match) {\n const key = match[1];\n\n // Public marker: explicit \"# -public\" comment, or \"KEY=VAL # -public\"\n if (isPublicBlock || line.toLowerCase().includes('-public')) {\n isPublicBlock = false;\n return line;\n }\n\n isPublicBlock = false;\n return `${key}=`;\n }\n\n isPublicBlock = false;\n return line;\n});\n\nconst newExampleContent = exampleLines.join('\\n');\n\nlet currentExampleContent = '';\nif (fs.existsSync(examplePath)) {\n currentExampleContent = fs.readFileSync(examplePath, 'utf-8');\n}\n\nif (currentExampleContent !== newExampleContent) {\n fs.writeFileSync(examplePath, newExampleContent);\n console.log('\u2705 Synchronized .env.example with .env');\n} else {\n console.log('\u2728 .env.example is already up to date');\n}\n";
11
+ export declare const CHECK_DEPRECATED_SCRIPT = "/**\n * Walks every identifier in the project and flags any whose resolved TypeScript\n * symbol carries a `@deprecated` JSDoc tag. Catches deprecated API usage that\n * `tsc --noEmit` does not surface (deprecations are \"suggestion\"-level, not\n * errors) and that Biome does not yet detect.\n *\n * Exits 1 if any deprecated usage is found (so it can gate CI).\n */\nimport path from 'node:path';\nimport ts from 'typescript';\n\nconst cwd = process.cwd();\nconst configPath = ts.findConfigFile(cwd, ts.sys.fileExists, 'tsconfig.json');\n\nif (!configPath) {\n console.error('tsconfig.json not found');\n process.exit(1);\n}\n\nconst raw = ts.readConfigFile(configPath, ts.sys.readFile).config;\nconst parsed = ts.parseJsonConfigFileContent(raw, ts.sys, path.dirname(configPath));\n\nconst program = ts.createProgram({\n rootNames: parsed.fileNames,\n options: parsed.options,\n});\n\nconst checker = program.getTypeChecker();\n\nfunction isDeprecated(sym: ts.Symbol | undefined): boolean {\n if (!sym) return false;\n return sym.getJsDocTags(checker).some((tag) => tag.name === 'deprecated');\n}\n\nlet hits = 0;\n\nfor (const sourceFile of program.getSourceFiles()) {\n if (sourceFile.fileName.includes('node_modules')) continue;\n if (!sourceFile.fileName.startsWith(cwd)) continue;\n\n const visit = (node: ts.Node): void => {\n if (ts.isIdentifier(node)) {\n const sym = checker.getSymbolAtLocation(node);\n if (isDeprecated(sym)) {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n console.log(\n `${path.relative(cwd, sourceFile.fileName)}:${line + 1}:${character + 1} ${node.text} (@deprecated)`,\n );\n hits++;\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n}\n\nif (hits === 0) {\n console.log('\u2713 No deprecated API usage found.');\n process.exit(0);\n}\n\nconsole.log(`\\n${hits} deprecated symbol use(s) found.`);\nprocess.exit(1);\n";
12
+ //# sourceMappingURL=scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../../../../src/services/setup/validate-scripts/scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,eAAe,opDAkE3B,CAAC;AAEF,eAAO,MAAM,uBAAuB,48DAgEnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teispace/next-maker",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Create a new Teispace Next.js application with interactive setup.",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -43,7 +43,7 @@
43
43
  "commander": "^14.0.3",
44
44
  "degit": "^2.8.4",
45
45
  "enquirer": "^2.4.1",
46
- "ora": "^9.3.0",
46
+ "ora": "^9.4.0",
47
47
  "picocolors": "^1.1.1"
48
48
  },
49
49
  "devDependencies": {
@@ -51,7 +51,7 @@
51
51
  "@types/node": "^25.6.0",
52
52
  "esbuild": "^0.28.0",
53
53
  "tsx": "^4.21.0",
54
- "vitest": "^4.1.4"
54
+ "vitest": "^4.1.5"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=20.0.0"