@zukhruf/nx 0.8.30 → 0.8.31

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 (102) hide show
  1. package/README.md +378 -19
  2. package/dist/generators/add-keys.d.ts +7 -0
  3. package/dist/generators/add-keys.d.ts.map +1 -0
  4. package/dist/generators/add-keys.js +14 -0
  5. package/dist/generators/add-keys.js.map +1 -0
  6. package/dist/generators/add-lines.d.ts +8 -0
  7. package/dist/generators/add-lines.d.ts.map +1 -0
  8. package/dist/generators/add-lines.js +21 -0
  9. package/dist/generators/add-lines.js.map +1 -0
  10. package/dist/generators/app-directory.d.ts +17 -0
  11. package/dist/generators/app-directory.d.ts.map +1 -0
  12. package/dist/generators/app-directory.js +34 -0
  13. package/dist/generators/app-directory.js.map +1 -0
  14. package/dist/generators/dokploy/files.d.ts +21 -0
  15. package/dist/generators/dokploy/files.d.ts.map +1 -0
  16. package/dist/generators/dokploy/files.js +755 -0
  17. package/dist/generators/dokploy/files.js.map +1 -0
  18. package/dist/generators/dokploy/generator.d.ts +75 -0
  19. package/dist/generators/dokploy/generator.d.ts.map +1 -0
  20. package/dist/generators/dokploy/generator.js +139 -0
  21. package/dist/generators/dokploy/generator.js.map +1 -0
  22. package/dist/generators/dokploy/providers.d.ts +15 -0
  23. package/dist/generators/dokploy/providers.d.ts.map +1 -0
  24. package/dist/generators/dokploy/providers.js +114 -0
  25. package/dist/generators/dokploy/providers.js.map +1 -0
  26. package/dist/generators/init/files.js +3 -3
  27. package/dist/generators/init/files.js.map +1 -1
  28. package/dist/generators/init/generator.d.ts.map +1 -1
  29. package/dist/generators/init/generator.js +1 -16
  30. package/dist/generators/init/generator.js.map +1 -1
  31. package/dist/generators/init/nx-json.d.ts +16 -3
  32. package/dist/generators/init/nx-json.d.ts.map +1 -1
  33. package/dist/generators/init/nx-json.js +20 -5
  34. package/dist/generators/init/nx-json.js.map +1 -1
  35. package/dist/generators/init/root-package-json.d.ts +6 -0
  36. package/dist/generators/init/root-package-json.d.ts.map +1 -1
  37. package/dist/generators/init/root-package-json.js +15 -12
  38. package/dist/generators/init/root-package-json.js.map +1 -1
  39. package/dist/generators/node-app/files.d.ts +43 -0
  40. package/dist/generators/node-app/files.d.ts.map +1 -0
  41. package/dist/generators/node-app/files.js +522 -0
  42. package/dist/generators/node-app/files.js.map +1 -0
  43. package/dist/generators/node-app/generator.d.ts +17 -0
  44. package/dist/generators/node-app/generator.d.ts.map +1 -0
  45. package/dist/generators/node-app/generator.js +319 -0
  46. package/dist/generators/node-app/generator.js.map +1 -0
  47. package/dist/generators/nx-plugin.d.ts +16 -0
  48. package/dist/generators/nx-plugin.d.ts.map +1 -0
  49. package/dist/generators/nx-plugin.js +27 -0
  50. package/dist/generators/nx-plugin.js.map +1 -0
  51. package/dist/generators/pair/files.d.ts +4 -0
  52. package/dist/generators/pair/files.d.ts.map +1 -0
  53. package/dist/generators/pair/files.js +73 -0
  54. package/dist/generators/pair/files.js.map +1 -0
  55. package/dist/generators/pair/generator.d.ts +19 -0
  56. package/dist/generators/pair/generator.d.ts.map +1 -0
  57. package/dist/generators/pair/generator.js +70 -0
  58. package/dist/generators/pair/generator.js.map +1 -0
  59. package/dist/generators/prisma/files.d.ts +20 -0
  60. package/dist/generators/prisma/files.d.ts.map +1 -0
  61. package/dist/generators/prisma/files.js +183 -0
  62. package/dist/generators/prisma/files.js.map +1 -0
  63. package/dist/generators/prisma/generator.d.ts +17 -0
  64. package/dist/generators/prisma/generator.d.ts.map +1 -0
  65. package/dist/generators/prisma/generator.js +258 -0
  66. package/dist/generators/prisma/generator.js.map +1 -0
  67. package/dist/generators/react-app/files.d.ts +7 -0
  68. package/dist/generators/react-app/files.d.ts.map +1 -0
  69. package/dist/generators/react-app/files.js +188 -0
  70. package/dist/generators/react-app/files.js.map +1 -0
  71. package/dist/generators/react-app/generator.d.ts +12 -0
  72. package/dist/generators/react-app/generator.d.ts.map +1 -0
  73. package/dist/generators/react-app/generator.js +242 -0
  74. package/dist/generators/react-app/generator.js.map +1 -0
  75. package/dist/generators/react.d.ts +29 -0
  76. package/dist/generators/react.d.ts.map +1 -0
  77. package/dist/generators/react.js +64 -0
  78. package/dist/generators/react.js.map +1 -0
  79. package/dist/generators/root-dependencies.d.ts +21 -0
  80. package/dist/generators/root-dependencies.d.ts.map +1 -0
  81. package/dist/generators/root-dependencies.js +56 -0
  82. package/dist/generators/root-dependencies.js.map +1 -0
  83. package/dist/generators/ui-package/files.d.ts +37 -0
  84. package/dist/generators/ui-package/files.d.ts.map +1 -0
  85. package/dist/generators/ui-package/files.js +118 -0
  86. package/dist/generators/ui-package/files.js.map +1 -0
  87. package/dist/generators/ui-package/generator.d.ts +14 -0
  88. package/dist/generators/ui-package/generator.d.ts.map +1 -0
  89. package/dist/generators/ui-package/generator.js +111 -0
  90. package/dist/generators/ui-package/generator.js.map +1 -0
  91. package/dist/generators/versions.d.ts +49 -1
  92. package/dist/generators/versions.d.ts.map +1 -1
  93. package/dist/generators/versions.js +61 -1
  94. package/dist/generators/versions.js.map +1 -1
  95. package/generators.json +30 -0
  96. package/package.json +24 -5
  97. package/src/generators/dokploy/schema.json +48 -0
  98. package/src/generators/node-app/schema.json +22 -0
  99. package/src/generators/pair/schema.json +18 -0
  100. package/src/generators/prisma/schema.json +21 -0
  101. package/src/generators/react-app/schema.json +17 -0
  102. package/src/generators/ui-package/schema.json +22 -0
@@ -1,11 +1,20 @@
1
1
  import { updateJson } from '@nx/devkit';
2
+ import { addMissingKeys } from "../add-keys.js";
2
3
  import { nxFamily, nxVersion, rootToolVersions, zukhrufPackages, zukhrufVersion, } from "../versions.js";
3
4
  // strict-allow-scripts=true in .npmrc fails an install when a package has an
4
5
  // install script that is not named here. nx checks the platform and updates
5
6
  // the Nx Cloud client, and no repo uses Nx Cloud. unrs-resolver (through
6
7
  // eslint-plugin-import-x) ships its binaries prebuilt.
7
8
  const allowScripts = { nx: false, 'unrs-resolver': false };
8
- const sortKeys = (record) => Object.fromEntries(Object.entries(record).toSorted(([a], [b]) => a.localeCompare(b)));
9
+ /** Sets `nx` and each `@nx/*` of the record to `nxVersion`, also over a newer version (#4532). */
10
+ export function pinNxFamily(record = {}) {
11
+ for (const name of Object.keys(record)) {
12
+ if (name === 'nx' || name.startsWith('@nx/')) {
13
+ record[name] = nxVersion;
14
+ }
15
+ }
16
+ }
17
+ export const sortKeys = (record) => Object.fromEntries(Object.entries(record).toSorted(([a], [b]) => a.localeCompare(b)));
9
18
  /**
10
19
  * Merges the keys that the standard owns into the root package.json: one
11
20
  * exact version for the Nx family, also over another version, and each other
@@ -16,10 +25,9 @@ export function mergeRootPackageJson(tree) {
16
25
  packageJson.private = true;
17
26
  packageJson.type = 'module';
18
27
  packageJson.workspaces ??= ['apps/*', 'packages/*', 'tools/*'];
19
- packageJson.scripts = {
28
+ packageJson.scripts = addMissingKeys(packageJson.scripts, {
20
29
  prepare: 'git config core.hooksPath .husky || exit 0',
21
- ...packageJson.scripts,
22
- };
30
+ });
23
31
  const dependencies = packageJson.dependencies ?? {};
24
32
  const devDependencies = { ...packageJson.devDependencies };
25
33
  for (const [name, version] of Object.entries({
@@ -31,15 +39,10 @@ export function mergeRootPackageJson(tree) {
31
39
  devDependencies[name] = version;
32
40
  }
33
41
  }
34
- for (const record of [dependencies, devDependencies]) {
35
- for (const name of Object.keys(record)) {
36
- if (name === 'nx' || name.startsWith('@nx/')) {
37
- record[name] = nxVersion;
38
- }
39
- }
40
- }
42
+ pinNxFamily(dependencies);
43
+ pinNxFamily(devDependencies);
41
44
  packageJson.devDependencies = sortKeys(devDependencies);
42
- packageJson.allowScripts = { ...allowScripts, ...packageJson.allowScripts };
45
+ packageJson.allowScripts = addMissingKeys(packageJson.allowScripts, allowScripts);
43
46
  return packageJson;
44
47
  });
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"root-package-json.js","sourceRoot":"","sources":["../../../src/generators/init/root-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,YA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,CAAC;YAChE,GAAG,MAAM,CAAC,WAAW,CACnB,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CACtD;YACD,GAAG,gBAAgB;SACpB,CAAC,EAAE,CAAC;YACH,IAAI,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,EAAE,CAAC;gBAC1D,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAClC,CAAC;QACH,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,EAAE,CAAC;YACrD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;gBAC3B,CAAC;YACH,CAAC;QACH,CAAC;QACD,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;QACxD,WAAW,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;QAC5E,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"root-package-json.js","sourceRoot":"","sources":["../../../src/generators/init/root-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,gBAAgB,CAAC;AAexB,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,uDAAuD;AACvD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AI,MAAM,CAAC,OAAO,CAAC;YAC3C,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;YAChE,GAAG,MAAM,CAAC,WAAW,CACnB,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CACtD;YACD,GAAG,gBAAgB;SACpB,CAAC,EAAE,CAAC;YACH,IAAI,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,EAAE,CAAC;gBAC1D,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAClC,CAAC;QACH,CAAC;QACD,WAAW,CAAC,YAAY,CAAC,CAAC;QAC1B,WAAW,CAAC,eAAe,CAAC,CAAC;QAC7B,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;QACxD,WAAW,CAAC,YAAY,GAAG,cAAc,CACvC,WAAW,CAAC,YAAY,EACxB,YAAY,CACb,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,43 @@
1
+ export declare function eslintConfig(projectRoot: string, rootOffset: string): string;
2
+ export declare const appTs = "import { evlog } from 'evlog/hono';\nimport { Hono } from 'hono';\nimport { compress } from 'hono/compress';\nimport { contextStorage } from 'hono/context-storage';\nimport { cors } from 'hono/cors';\nimport { HTTPException } from 'hono/http-exception';\nimport { timing } from 'hono/timing';\n\nimport { evlogMiddlewareOptions, evlogRequestContext } from './logging.ts';\n\nconst app = new Hono();\n\napp.use(\n evlog(evlogMiddlewareOptions),\n evlogRequestContext(),\n timing(),\n cors({\n origin: (origin) => {\n if (process.env.NODE_ENV === 'development') return origin;\n if (!origin) return '';\n const allowed = process.env.ALLOWED_ORIGINS.split(',').map((o) => o.trim());\n return allowed.includes(origin) ? origin : '';\n },\n credentials: true,\n }),\n // Required by @sdk-it/hono/runtime's `output` helpers.\n contextStorage(),\n);\n\napp.use('/api/*', compress());\n\n// Route modules register on the /api base path. Add new modules to this list;\n// sdk-it only discovers routes that use `validate` and a JSDoc @openapi tag.\nfor await (const route of [import('./routes/healthz.route.ts')]) {\n route.default(app.basePath('/api'));\n}\n\napp.notFound((c) =>\n c.json(\n {\n error: 'Not Found',\n cause: {\n code: 'api/not-found',\n detail: 'The requested resource was not found',\n instance: c.req.path,\n },\n },\n 404,\n ),\n);\n\napp.onError((error, c) => {\n if (error instanceof HTTPException) {\n if (error.status >= 500) {\n c.get('log')?.error(error);\n } else {\n // A bare `status: 400` in telemetry is undiagnosable; keep the cause.\n c.get('log')?.warn(error.message, { cause: error.cause });\n }\n return c.json({ error: error.message, cause: error.cause }, error.status);\n }\n c.get('log')?.error(error);\n return c.json(\n {\n error: 'Internal Server Error',\n cause: {\n code: 'api/internal',\n detail:\n process.env.NODE_ENV === 'development'\n ? String(error)\n : 'Unexpected error',\n },\n },\n 500,\n );\n});\n\nexport default app;\n";
3
+ export declare const appTestTs = "import assert from 'node:assert/strict';\nimport { test } from 'node:test';\n\nimport app from './app.ts';\n\ntest('answers the health check on the API base path, with no build sha outside an image', async () => {\n const response = await app.request('/api/healthz');\n\n assert.equal(response.status, 200);\n assert.deepEqual(await response.json(), { status: 'ok', sha: null });\n});\n\ntest('rejects unknown API routes with a JSON cause', async () => {\n const response = await app.request('/api/nope');\n\n assert.equal(response.status, 404);\n const body: unknown = await response.json();\n assert.ok(typeof body === 'object' && body !== null && 'cause' in body);\n});\n";
4
+ export declare function envTs(port: number): string;
5
+ export declare function loggingTs(name: string): string;
6
+ export declare const healthzRouteTs = "import { validate } from '@sdk-it/hono/runtime';\nimport type { Hono } from 'hono';\n\n// sdk-it discovers a route only when: the path is a string literal, an\n// argument is a call literally named `validate` whose selector is an arrow\n// function, the last argument is an arrow function, and the JSDoc block sits\n// directly above the statement.\nexport default function (router: Hono): void {\n /**\n * @openapi getHealthz\n * @tags health\n * @description Report whether the API is up, and the commit it was built from.\n */\n router.get(\n '/healthz',\n validate(() => ({})),\n async (c) => {\n return c.json({ status: 'ok', sha: process.env.BUILD_SHA ?? null });\n },\n );\n}\n";
7
+ export declare const serverTs = "#!/usr/bin/env tsx\n// @nx-target-name: serve\nimport './startup.ts';\n\nimport { createTerminus } from '@godaddy/terminus';\nimport { serve } from '@hono/node-server';\nimport { log } from 'evlog';\n\nimport app from './app.ts';\nimport { flushLogs, logError } from './logging.ts';\n\nconst port = Number.parseInt(process.env.PORT ?? '3000', 10);\n// In development claim 127.0.0.1 explicitly: the dual-stack wildcard leaves\n// the IPv4 address free for a stray local server to capture proxy traffic.\nconst hostname =\n process.env.HOST ??\n (process.env.NODE_ENV === 'development' ? '127.0.0.1' : undefined);\n\nconst server = serve({ fetch: app.fetch, port, hostname }, (info) => {\n log.info({\n event: 'server.started',\n port: info.port,\n address: info.address,\n });\n});\n\n// terminus answers /healthz before Hono sees the request and turns SIGTERM\n// into a drained shutdown.\ncreateTerminus(server, {\n healthChecks: { '/healthz': async () => ({ status: 'ok' }) },\n async onSignal() {\n log.info({ event: 'server.shutdown.started' });\n await flushLogs();\n },\n useExit0: true,\n});\n\nprocess.on('uncaughtException', (error) => {\n logError({ event: 'server.uncaught-exception' }, error);\n process.kill(process.pid, 'SIGTERM');\n});\n\nprocess.on('unhandledRejection', (reason) => {\n logError({ event: 'server.unhandled-rejection' }, reason);\n process.kill(process.pid, 'SIGTERM');\n});\n";
8
+ export declare const startupTs = "import './env.ts';\n\n// Boot module: connect stores, run migrations, and start queues or workers here\n// before the app serves. Empty until the product needs it.\nexport {};\n";
9
+ export declare function envExample(port: number): string;
10
+ export interface DockerfileOptions {
11
+ projectRoot: string;
12
+ projectName: string;
13
+ port: number;
14
+ /** The paired web app, whose build the image serves. */
15
+ spa?: {
16
+ projectName: string;
17
+ projectRoot: string;
18
+ };
19
+ }
20
+ export declare function dockerfile(options: DockerfileOptions): string;
21
+ export declare const dockerignore = ".git\n.nx\nnode_modules\n**/node_modules\n**/dist\n**/out-tsc\n**/coverage\n**/.env\n**/.env.*\n**/.sdk-it/src\n**/.sdk-it/dist\n**/.sdk-it/.project-hash\n";
22
+ export declare function sdkItConfig(projectName: string, packageName: string): string;
23
+ /**
24
+ * The committed stub of the generated client. \`sdk-it generate\` (0.46.11,
25
+ * project mode) keeps an existing package.json and assigns only its own
26
+ * fields into it, so a stub with each of those keys, and the \`nx\` block that
27
+ * sdk-it never touches, is written back unchanged. With the stub committed,
28
+ * \`npm ci\` links the client on a fresh clone before the first \`sdk\` run, and
29
+ * the client is an Nx library whose \`sdk\` target is its build: consumers reach
30
+ * it through the \`^sdk\` target default. It has no implicit dependency on the
31
+ * api, which would leak the api's runtime deps into every consumer manifest;
32
+ * the cross-project \`production\` input keeps the cache right.
33
+ */
34
+ export declare function clientManifest(name: string, apiProjectName: string): string;
35
+ /**
36
+ * A placeholder for the TypeScript sync of Nx and \`tsc --build\`: a consumer
37
+ * gets a project reference to the client, but its types resolve through the
38
+ * package.json exports (dist/index.d.ts). sdk-it keeps an existing
39
+ * tsconfig.json (its own sets noEmit, which \`tsc --build\` refuses) and
40
+ * compiles the client with its own program.
41
+ */
42
+ export declare function clientTsconfig(rootOffset: string): string;
43
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/generators/node-app/files.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA2B5E;AAED,eAAO,MAAM,KAAK,6mEA8EjB,CAAC;AAEF,eAAO,MAAM,SAAS,8qBAmBrB,CAAC;AAEF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2C1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmH9C;AAED,eAAO,MAAM,cAAc,6sBAqB1B,CAAC;AAEF,eAAO,MAAM,QAAQ,i6CA8CpB,CAAC;AAEF,eAAO,MAAM,SAAS,sLAKrB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY/C;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,GAAG,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA2C7D;AAED,eAAO,MAAM,YAAY,gKAYxB,CAAC;AAEF,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAa5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CA0C3E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAWzD"}
@@ -0,0 +1,522 @@
1
+ // The content of each file that node-app writes into the project. Each is a
2
+ // string in a .ts module, so tsc puts it in dist with no copy step (ADR 0009).
3
+ export function eslintConfig(projectRoot, rootOffset) {
4
+ return `import zukhruf from '@zukhruf/eslint';
5
+
6
+ import baseConfig, { modernNodeRecommended } from '${rootOffset}eslint.config.mjs';
7
+
8
+ export default [
9
+ ...baseConfig,
10
+ ...zukhruf.configs['hono'],
11
+ ...modernNodeRecommended,
12
+ { settings: { env: { startupFile: 'src/env.ts' } } },
13
+ // No tsconfig of the project includes sdk-it.config.ts, so typed lint gives
14
+ // it the default project. The path is relative to the workspace root, the
15
+ // tsconfigRootDir of @zukhruf/eslint. The block takes each .ts file, as the
16
+ // root block does: one project service serves the process, with the options
17
+ // of the first file it parses.
18
+ {
19
+ files: ['**/*.ts'],
20
+ languageOptions: {
21
+ parserOptions: {
22
+ projectService: {
23
+ allowDefaultProject: ['${projectRoot}/sdk-it.config.ts'],
24
+ },
25
+ },
26
+ },
27
+ },
28
+ ];
29
+ `;
30
+ }
31
+ export const appTs = `import { evlog } from 'evlog/hono';
32
+ import { Hono } from 'hono';
33
+ import { compress } from 'hono/compress';
34
+ import { contextStorage } from 'hono/context-storage';
35
+ import { cors } from 'hono/cors';
36
+ import { HTTPException } from 'hono/http-exception';
37
+ import { timing } from 'hono/timing';
38
+
39
+ import { evlogMiddlewareOptions, evlogRequestContext } from './logging.ts';
40
+
41
+ const app = new Hono();
42
+
43
+ app.use(
44
+ evlog(evlogMiddlewareOptions),
45
+ evlogRequestContext(),
46
+ timing(),
47
+ cors({
48
+ origin: (origin) => {
49
+ if (process.env.NODE_ENV === 'development') return origin;
50
+ if (!origin) return '';
51
+ const allowed = process.env.ALLOWED_ORIGINS.split(',').map((o) => o.trim());
52
+ return allowed.includes(origin) ? origin : '';
53
+ },
54
+ credentials: true,
55
+ }),
56
+ // Required by @sdk-it/hono/runtime's \`output\` helpers.
57
+ contextStorage(),
58
+ );
59
+
60
+ app.use('/api/*', compress());
61
+
62
+ // Route modules register on the /api base path. Add new modules to this list;
63
+ // sdk-it only discovers routes that use \`validate\` and a JSDoc @openapi tag.
64
+ for await (const route of [import('./routes/healthz.route.ts')]) {
65
+ route.default(app.basePath('/api'));
66
+ }
67
+
68
+ app.notFound((c) =>
69
+ c.json(
70
+ {
71
+ error: 'Not Found',
72
+ cause: {
73
+ code: 'api/not-found',
74
+ detail: 'The requested resource was not found',
75
+ instance: c.req.path,
76
+ },
77
+ },
78
+ 404,
79
+ ),
80
+ );
81
+
82
+ app.onError((error, c) => {
83
+ if (error instanceof HTTPException) {
84
+ if (error.status >= 500) {
85
+ c.get('log')?.error(error);
86
+ } else {
87
+ // A bare \`status: 400\` in telemetry is undiagnosable; keep the cause.
88
+ c.get('log')?.warn(error.message, { cause: error.cause });
89
+ }
90
+ return c.json({ error: error.message, cause: error.cause }, error.status);
91
+ }
92
+ c.get('log')?.error(error);
93
+ return c.json(
94
+ {
95
+ error: 'Internal Server Error',
96
+ cause: {
97
+ code: 'api/internal',
98
+ detail:
99
+ process.env.NODE_ENV === 'development'
100
+ ? String(error)
101
+ : 'Unexpected error',
102
+ },
103
+ },
104
+ 500,
105
+ );
106
+ });
107
+
108
+ export default app;
109
+ `;
110
+ export const appTestTs = `import assert from 'node:assert/strict';
111
+ import { test } from 'node:test';
112
+
113
+ import app from './app.ts';
114
+
115
+ test('answers the health check on the API base path, with no build sha outside an image', async () => {
116
+ const response = await app.request('/api/healthz');
117
+
118
+ assert.equal(response.status, 200);
119
+ assert.deepEqual(await response.json(), { status: 'ok', sha: null });
120
+ });
121
+
122
+ test('rejects unknown API routes with a JSON cause', async () => {
123
+ const response = await app.request('/api/nope');
124
+
125
+ assert.equal(response.status, 404);
126
+ const body: unknown = await response.json();
127
+ assert.ok(typeof body === 'object' && body !== null && 'cause' in body);
128
+ });
129
+ `;
130
+ export function envTs(port) {
131
+ return `import z from 'zod';
132
+
133
+ import { logError } from './logging.ts';
134
+
135
+ const env = z.object({
136
+ NODE_ENV: z
137
+ .enum(['development', 'test', 'production'])
138
+ .default('development'),
139
+ PORT: z.string().optional().default('${port}'),
140
+ HOST: z.string().optional(),
141
+ // Kept a string: process.env stays string-valued so the ProcessEnv
142
+ // augmentation below remains compatible with every Node API typed against
143
+ // it (child_process env, etc.). Parse lists at the use site.
144
+ ALLOWED_ORIGINS: z.string().default(''),
145
+ // The commit the image was built from (the BUILD_SHA build arg of the
146
+ // Dockerfile). /api/healthz reports it, so a deploy can tell the new
147
+ // container from the old one. A process that is not an image has none.
148
+ BUILD_SHA: z.string().min(1).optional(),
149
+ });
150
+
151
+ const parsed = env.safeParse(process.env);
152
+ if (!parsed.success) {
153
+ logError(
154
+ {
155
+ event: 'environment.validation.failed',
156
+ message:
157
+ 'Please check that all required environment variables are correctly set.',
158
+ },
159
+ parsed.error,
160
+ );
161
+ process.exit(1);
162
+ }
163
+ // Reassigning process.env to a plain object keeps the parsed (non-string)
164
+ // values intact; Node would stringify anything assigned to the real one.
165
+ process.env = Object.assign({}, process.env, parsed.data);
166
+
167
+ declare global {
168
+ namespace NodeJS {
169
+ interface ProcessEnv extends z.infer<typeof env> {}
170
+ }
171
+ }
172
+ `;
173
+ }
174
+ export function loggingTs(name) {
175
+ return `import { randomUUID } from 'node:crypto';
176
+
177
+ import {
178
+ type DrainContext,
179
+ type EnrichContext,
180
+ createLogger,
181
+ defineEvlog,
182
+ initLogger,
183
+ toLoggerConfig,
184
+ toMiddlewareOptions,
185
+ } from 'evlog';
186
+ import { createFsDrain } from 'evlog/fs';
187
+ import type { EvlogHonoOptions, EvlogVariables } from 'evlog/hono';
188
+ import { createDrainPipeline } from 'evlog/pipeline';
189
+ import type { MiddlewareHandler } from 'hono';
190
+ import { routePath } from 'hono/route';
191
+
192
+ declare module 'hono' {
193
+ interface ContextVariableMap {
194
+ // Optional: an \`exclude\`d route has no request logger at all.
195
+ log?: EvlogVariables['Variables']['log'];
196
+ requestId?: string;
197
+ }
198
+ }
199
+
200
+ // This module is imported by env.ts (to report validation failures), so it
201
+ // runs before the environment is validated and reads the raw variable.
202
+ const environment = process.env.NODE_ENV ?? 'development';
203
+ const fileDrain =
204
+ process.env.NODE_ENV === 'development'
205
+ ? createDrainPipeline<DrainContext>({ batch: { size: 1 } })(
206
+ createFsDrain({
207
+ dir: '.evlog/logs/${name}',
208
+ maxFiles: 7,
209
+ maxSizePerFile: 10 * 1024 * 1024,
210
+ }),
211
+ )
212
+ : undefined;
213
+
214
+ // evlog derives no level from the response status, so a handler that
215
+ // *returns* a 5xx (rather than throwing) would log at info. Enrichment runs
216
+ // after emit and before drain with a mutable event.
217
+ function promoteServerErrors(context: EnrichContext): void {
218
+ if ((context.response?.status ?? 0) >= 500) {
219
+ context.event.level = 'error';
220
+ }
221
+ }
222
+
223
+ const config = defineEvlog({
224
+ service: '${name}',
225
+ environment,
226
+ redact: {
227
+ paths: [
228
+ 'authorization',
229
+ 'cookie',
230
+ 'set-cookie',
231
+ 'password',
232
+ 'token',
233
+ 'apiKey',
234
+ 'connectionString',
235
+ 'databaseUrl',
236
+ ],
237
+ },
238
+ drain: fileDrain,
239
+ // evlog globs: \`*\` stops at \`/\`, \`**\` crosses it.
240
+ exclude: ['/api/healthz', '/assets/**'],
241
+ enrich: promoteServerErrors,
242
+ });
243
+
244
+ initLogger(toLoggerConfig(config));
245
+
246
+ export const evlogMiddlewareOptions: EvlogHonoOptions =
247
+ toMiddlewareOptions(config);
248
+
249
+ export async function flushLogs(): Promise<void> {
250
+ await fileDrain?.flush();
251
+ }
252
+
253
+ // Gives every request one id (inbound X-Request-Id or a fresh UUID) that is
254
+ // echoed on the response, available as a context variable, and stamped on the
255
+ // wide event together with the matched route template. Register right after
256
+ // evlog() and before routes.
257
+ export function evlogRequestContext(): MiddlewareHandler {
258
+ return async (context, next) => {
259
+ const requestId = context.req.header('x-request-id') ?? randomUUID();
260
+ context.set('requestId', requestId);
261
+ context.header('X-Request-Id', requestId);
262
+ const requestLogger = context.get('log');
263
+ requestLogger?.set({ requestId });
264
+
265
+ await next();
266
+
267
+ // routePath() with the default index reads the handler that answered; an
268
+ // explicit -1 would pick the last *matched* route (a catch-all).
269
+ const matchedPath = routePath(context);
270
+ if (matchedPath) {
271
+ requestLogger?.set({ route: matchedPath });
272
+ }
273
+ };
274
+ }
275
+
276
+ export function logError(
277
+ context: Record<string, unknown>,
278
+ error: unknown,
279
+ ): void {
280
+ const event = createLogger(context);
281
+ event.error(
282
+ Error.isError(error)
283
+ ? error
284
+ : new Error('Non-Error value thrown', { cause: error }),
285
+ );
286
+ event.emit();
287
+ }
288
+ `;
289
+ }
290
+ export const healthzRouteTs = `import { validate } from '@sdk-it/hono/runtime';
291
+ import type { Hono } from 'hono';
292
+
293
+ // sdk-it discovers a route only when: the path is a string literal, an
294
+ // argument is a call literally named \`validate\` whose selector is an arrow
295
+ // function, the last argument is an arrow function, and the JSDoc block sits
296
+ // directly above the statement.
297
+ export default function (router: Hono): void {
298
+ /**
299
+ * @openapi getHealthz
300
+ * @tags health
301
+ * @description Report whether the API is up, and the commit it was built from.
302
+ */
303
+ router.get(
304
+ '/healthz',
305
+ validate(() => ({})),
306
+ async (c) => {
307
+ return c.json({ status: 'ok', sha: process.env.BUILD_SHA ?? null });
308
+ },
309
+ );
310
+ }
311
+ `;
312
+ export const serverTs = `#!/usr/bin/env tsx
313
+ // @nx-target-name: serve
314
+ import './startup.ts';
315
+
316
+ import { createTerminus } from '@godaddy/terminus';
317
+ import { serve } from '@hono/node-server';
318
+ import { log } from 'evlog';
319
+
320
+ import app from './app.ts';
321
+ import { flushLogs, logError } from './logging.ts';
322
+
323
+ const port = Number.parseInt(process.env.PORT ?? '3000', 10);
324
+ // In development claim 127.0.0.1 explicitly: the dual-stack wildcard leaves
325
+ // the IPv4 address free for a stray local server to capture proxy traffic.
326
+ const hostname =
327
+ process.env.HOST ??
328
+ (process.env.NODE_ENV === 'development' ? '127.0.0.1' : undefined);
329
+
330
+ const server = serve({ fetch: app.fetch, port, hostname }, (info) => {
331
+ log.info({
332
+ event: 'server.started',
333
+ port: info.port,
334
+ address: info.address,
335
+ });
336
+ });
337
+
338
+ // terminus answers /healthz before Hono sees the request and turns SIGTERM
339
+ // into a drained shutdown.
340
+ createTerminus(server, {
341
+ healthChecks: { '/healthz': async () => ({ status: 'ok' }) },
342
+ async onSignal() {
343
+ log.info({ event: 'server.shutdown.started' });
344
+ await flushLogs();
345
+ },
346
+ useExit0: true,
347
+ });
348
+
349
+ process.on('uncaughtException', (error) => {
350
+ logError({ event: 'server.uncaught-exception' }, error);
351
+ process.kill(process.pid, 'SIGTERM');
352
+ });
353
+
354
+ process.on('unhandledRejection', (reason) => {
355
+ logError({ event: 'server.unhandled-rejection' }, reason);
356
+ process.kill(process.pid, 'SIGTERM');
357
+ });
358
+ `;
359
+ export const startupTs = `import './env.ts';
360
+
361
+ // Boot module: connect stores, run migrations, and start queues or workers here
362
+ // before the app serves. Empty until the product needs it.
363
+ export {};
364
+ `;
365
+ export function envExample(port) {
366
+ return `# Copy to \`.env\` (gitignored). Nx loads this project's \`.env\`, \`.env.<target>\`
367
+ # and \`.env.<target>.<configuration>\` into every task it runs here, so
368
+ # \`nx run <project>:serve\` needs no dotenv. NODE_ENV is deliberately absent:
369
+ # the serve target sets it to development, and the Dockerfile to production.
370
+ PORT=${port}
371
+ # Bind address. Unset binds the dual-stack wildcard; development defaults to
372
+ # 127.0.0.1 so portless and the web dev proxy can always reach the server.
373
+ HOST=127.0.0.1
374
+ # Comma-separated browser origins allowed outside development (CORS).
375
+ ALLOWED_ORIGINS=
376
+ `;
377
+ }
378
+ export function dockerfile(options) {
379
+ const { projectRoot, projectName, port, spa } = options;
380
+ const buildProjects = spa ? `${projectName},${spa.projectName}` : projectName;
381
+ const spaCopy = spa
382
+ ? `COPY --from=build /workspace/${spa.projectRoot}/dist ./${spa.projectRoot}/dist\n`
383
+ : '';
384
+ return `# syntax=docker/dockerfile:1
385
+ # @zukhruf/nx:node-app writes this file, and @zukhruf/nx:pair writes it again.
386
+ # Build from the workspace root: \`nx run ${projectName}:docker:build\`.
387
+
388
+ FROM node:lts-alpine AS build
389
+ ENV NX_DAEMON=false
390
+ # The lockfile is the latest npm's; the image's bundled npm can be older and
391
+ # resolve peer ranges differently, so it must not decide the tree.
392
+ RUN npm install -g npm@latest
393
+ WORKDIR /workspace
394
+ # .dockerignore keeps node_modules, dist, .nx, .git, .env* and generated
395
+ # sdk-it output out of the context; the committed .sdk-it/package.json stubs
396
+ # stay in so \`npm ci\` links every client package.
397
+ COPY . .
398
+ RUN npm ci --ignore-scripts
399
+ RUN NODE_ENV=production npx nx run-many --targets build --configuration production --projects ${buildProjects} \\
400
+ && npx nx run ${projectName}:prune-lockfile
401
+
402
+ FROM node:lts-alpine AS runtime
403
+ # The commit this image is built from; /api/healthz reports it. docker:build
404
+ # passes it, and an image built without it does not start (env.ts).
405
+ ARG BUILD_SHA
406
+ ENV NODE_ENV=production HOST=0.0.0.0 PORT=${port} BUILD_SHA=$BUILD_SHA
407
+ RUN npm install -g npm@latest
408
+ WORKDIR /app
409
+ # prune-lockfile writes the runtime manifest (type: module, runtime deps only)
410
+ # and a lockfile reduced to that closure.
411
+ COPY --from=build /workspace/${projectRoot}/dist/package.json /workspace/${projectRoot}/dist/package-lock.json ./
412
+ RUN npm ci --omit=dev --ignore-scripts
413
+ COPY --from=build /workspace/${projectRoot}/dist ./${projectRoot}/dist
414
+ ${spaCopy}USER node
415
+ EXPOSE ${port}
416
+ # No \`\${}\` so /bin/sh never sees a substitution; terminus answers /healthz.
417
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
418
+ CMD node -e "fetch('http://127.0.0.1:' + process.env.PORT + '/healthz').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"
419
+ CMD ["node", "--enable-source-maps", "${projectRoot}/dist/server.js"]
420
+ `;
421
+ }
422
+ export const dockerignore = `.git
423
+ .nx
424
+ node_modules
425
+ **/node_modules
426
+ **/dist
427
+ **/out-tsc
428
+ **/coverage
429
+ **/.env
430
+ **/.env.*
431
+ **/.sdk-it/src
432
+ **/.sdk-it/dist
433
+ **/.sdk-it/.project-hash
434
+ `;
435
+ export function sdkItConfig(projectName, packageName) {
436
+ return `import { defineConfig } from '@sdk-it/cli';
437
+
438
+ // Project mode: the Hono routes reachable from tsconfig.app.json are analyzed
439
+ // in memory and compiled into the ./.sdk-it workspace package
440
+ // (\`nx run ${projectName}:sdk\`). The solution tsconfig.json lists no files,
441
+ // so it must be the app config.
442
+ export default defineConfig({
443
+ tsconfig: './tsconfig.app.json',
444
+ output: './.sdk-it',
445
+ packageName: '${packageName}',
446
+ });
447
+ `;
448
+ }
449
+ /**
450
+ * The committed stub of the generated client. \`sdk-it generate\` (0.46.11,
451
+ * project mode) keeps an existing package.json and assigns only its own
452
+ * fields into it, so a stub with each of those keys, and the \`nx\` block that
453
+ * sdk-it never touches, is written back unchanged. With the stub committed,
454
+ * \`npm ci\` links the client on a fresh clone before the first \`sdk\` run, and
455
+ * the client is an Nx library whose \`sdk\` target is its build: consumers reach
456
+ * it through the \`^sdk\` target default. It has no implicit dependency on the
457
+ * api, which would leak the api's runtime deps into every consumer manifest;
458
+ * the cross-project \`production\` input keeps the cache right.
459
+ */
460
+ export function clientManifest(name, apiProjectName) {
461
+ const manifest = {
462
+ name,
463
+ version: '0.0.1',
464
+ private: true,
465
+ type: 'module',
466
+ main: './dist/index.js',
467
+ module: './dist/index.js',
468
+ types: './dist/index.d.ts',
469
+ publishConfig: { access: 'public' },
470
+ exports: {
471
+ './package.json': './package.json',
472
+ '.': {
473
+ types: './dist/index.d.ts',
474
+ import: './dist/index.js',
475
+ default: './dist/index.js',
476
+ },
477
+ },
478
+ dependencies: { 'fast-content-type-parse': '^3.0.0', zod: '^4.3.0' },
479
+ nx: {
480
+ projectType: 'library',
481
+ targets: {
482
+ sdk: {
483
+ // Config discovery walks up from cwd to the api's sdk-it.config.ts.
484
+ command: 'sdk-it generate',
485
+ options: { cwd: '{projectRoot}' },
486
+ cache: true,
487
+ inputs: [
488
+ { projects: [apiProjectName], input: 'production' },
489
+ '{workspaceRoot}/package-lock.json',
490
+ '{projectRoot}/package.json',
491
+ ],
492
+ outputs: [
493
+ '{projectRoot}/src',
494
+ '{projectRoot}/dist',
495
+ '{projectRoot}/.project-hash',
496
+ ],
497
+ },
498
+ },
499
+ },
500
+ };
501
+ return `${JSON.stringify(manifest, null, 2)}\n`;
502
+ }
503
+ /**
504
+ * A placeholder for the TypeScript sync of Nx and \`tsc --build\`: a consumer
505
+ * gets a project reference to the client, but its types resolve through the
506
+ * package.json exports (dist/index.d.ts). sdk-it keeps an existing
507
+ * tsconfig.json (its own sets noEmit, which \`tsc --build\` refuses) and
508
+ * compiles the client with its own program.
509
+ */
510
+ export function clientTsconfig(rootOffset) {
511
+ const tsconfig = {
512
+ extends: `../${rootOffset}tsconfig.base.json`,
513
+ compilerOptions: {
514
+ outDir: 'out-tsc',
515
+ tsBuildInfoFile: 'out-tsc/tsconfig.tsbuildinfo',
516
+ },
517
+ files: [],
518
+ include: [],
519
+ };
520
+ return `${JSON.stringify(tsconfig, null, 2)}\n`;
521
+ }
522
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/generators/node-app/files.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAE/E,MAAM,UAAU,YAAY,CAAC,WAAmB,EAAE,UAAkB;IAClE,OAAO;;qDAE4C,UAAU;;;;;;;;;;;;;;;;;mCAiB5B,WAAW;;;;;;CAM7C,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EpB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;CAmBxB,CAAC;AAEF,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO;;;;;;;;yCAQgC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC5C,CAAC;AACF,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAgCqB,IAAI;;;;;;;;;;;;;;;;;cAiBpB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEjB,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB7B,CAAC;AAEF,MAAM,CAAC,MAAM,Q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type Tree } from '@nx/devkit';
2
+ export interface NodeAppOptions {
3
+ /** The project root, for example `apps/backend`. */
4
+ directory: string;
5
+ /** The port of the server in development, in `.env.example`, portless and `EXPOSE`. */
6
+ port?: number;
7
+ }
8
+ export declare const createRequireBanner = "import { createRequire as nodeCreateRequire } from 'node:module'; const require = nodeCreateRequire(import.meta.url);";
9
+ /**
10
+ * A Hono backend on @hono/node-server: evlog, terminus, a zod env, one ESM
11
+ * esbuild bundle, a Dockerfile whose image reports its commit at /api/healthz,
12
+ * and a generated sdk-it client. It runs `init` first.
13
+ */
14
+ export default function nodeAppGenerator(tree: Tree, options: NodeAppOptions): Promise<GeneratorCallback>;
15
+ /** The image tag of a project name, as @nx/node sanitizes it: `@acme/backend` gives `acme-backend`. */
16
+ export declare function imageTagFor(projectName: string): string;
17
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/node-app/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AAkCpB,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAYD,eAAO,MAAM,mBAAmB,0HACyF,CAAC;AAO1H;;;;GAIG;AACH,wBAA8B,gBAAgB,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA4F5B;AA8CD,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAOvD"}