@zukhruf/nx 0.8.115 → 0.8.117
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.
- package/README.md +44 -40
- package/dist/generators/init/files.d.ts +24 -2
- package/dist/generators/init/files.d.ts.map +1 -1
- package/dist/generators/init/files.js +21 -13
- package/dist/generators/init/files.js.map +1 -1
- package/dist/generators/init/generator.d.ts.map +1 -1
- package/dist/generators/init/generator.js +3 -1
- package/dist/generators/init/generator.js.map +1 -1
- package/dist/generators/node-app/files.d.ts +16 -1
- package/dist/generators/node-app/files.d.ts.map +1 -1
- package/dist/generators/node-app/files.js +18 -16
- package/dist/generators/node-app/files.js.map +1 -1
- package/dist/generators/node-app/generator.d.ts.map +1 -1
- package/dist/generators/node-app/generator.js +4 -2
- package/dist/generators/node-app/generator.js.map +1 -1
- package/dist/generators/prisma/files.d.ts +16 -1
- package/dist/generators/prisma/files.d.ts.map +1 -1
- package/dist/generators/prisma/files.js +18 -16
- package/dist/generators/prisma/files.js.map +1 -1
- package/dist/generators/prisma/generator.d.ts.map +1 -1
- package/dist/generators/prisma/generator.js +4 -2
- package/dist/generators/prisma/generator.js.map +1 -1
- package/dist/migrations/update-0-8-116/type-check-config-files.d.ts +13 -0
- package/dist/migrations/update-0-8-116/type-check-config-files.d.ts.map +1 -0
- package/dist/migrations/update-0-8-116/type-check-config-files.js +308 -0
- package/dist/migrations/update-0-8-116/type-check-config-files.js.map +1 -0
- package/dist/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.d.ts +15 -0
- package/dist/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.d.ts.map +1 -0
- package/dist/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.js +63 -0
- package/dist/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.js.map +1 -0
- package/dist/migrations/update-0-8-70/move-peers-in-project-manifests.d.ts +14 -4
- package/dist/migrations/update-0-8-70/move-peers-in-project-manifests.d.ts.map +1 -1
- package/dist/migrations/update-0-8-70/move-peers-in-project-manifests.js +34 -13
- package/dist/migrations/update-0-8-70/move-peers-in-project-manifests.js.map +1 -1
- package/migrations.json +10 -0
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -837,19 +837,21 @@ npx nx migrate @zukhruf/nx@latest
|
|
|
837
837
|
npx nx migrate --run-migrations
|
|
838
838
|
```
|
|
839
839
|
|
|
840
|
-
`nx migrate` moves every published @zukhruf package with `@zukhruf/nx` (`packageGroup`), and nothing runs the migrations otherwise. Each one adds only what is missing, writes what the generators write now, and logs the step to take by hand where a file lost the shape that the generator wrote. `packageJsonUpdates` in `migrations.json` move each third-party peer that the generators install to its pin in `versions.ts`, in the root package.json of a repo that has it, so a narrower peer range does not stop npm, and `move-peers-in-project-manifests` moves the same
|
|
841
|
-
|
|
842
|
-
| Migration
|
|
843
|
-
|
|
|
844
|
-
| `add-portless-proxy-env`
|
|
845
|
-
| `add-local-postgres`
|
|
846
|
-
| `node-env-production`
|
|
847
|
-
| `add-prisma-client-inputs`
|
|
848
|
-
| `add-migrate-check`
|
|
849
|
-
| `add-generated-source-defaults`
|
|
850
|
-
| `add-sdk-build-edges`
|
|
851
|
-
| `rename-eslint-react-config`
|
|
852
|
-
| `move-peers-in-project-manifests`
|
|
840
|
+
`nx migrate` moves every published @zukhruf package with `@zukhruf/nx` (`packageGroup`) in the root package.json, `move-zukhruf-pins-in-project-manifests` moves the same packages in each project's package.json that pins them, and nothing runs the migrations otherwise. Each one adds only what is missing, writes what the generators write now, and logs the step to take by hand where a file lost the shape that the generator wrote. `packageJsonUpdates` in `migrations.json` move each third-party peer that the generators install to its pin in `versions.ts`, in the root package.json of a repo that has it, so a narrower peer range does not stop npm, and `move-peers-in-project-manifests` moves a project's pin of the same package to the version that `nx migrate` wrote in the root package.json, so the root and the apps install one copy. [ADR 0017](./docs/adr/0017-nx-migrations-bring-a-change-of-generated-output-to-the-repos-that-ran-the-generator-before.md) has the rules.
|
|
841
|
+
|
|
842
|
+
| Migration | Version | Brings |
|
|
843
|
+
| ---------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
844
|
+
| `add-portless-proxy-env` | 0.8.40 | `PORTLESS_UNPRIVILEGED=1` and `PORTLESS_HTTPS=1` in `targetDefaults.portless` (#4768) |
|
|
845
|
+
| `add-local-postgres` | 0.8.40 | the root `compose.dev.yml`, `up` and `down` of each db package, the local `CONNECTION_STRING`, and `^up` in its backend serve (ADR 0012 decisions 16 and 17) |
|
|
846
|
+
| `node-env-production` | 0.8.40 | the NODE_ENV configuration of ADR 0016 (nx.json defaults, target env, the web exceptions, `.env.example`, the workflow env, `ALLOWED_ORIGINS`), and a log of each NODE_ENV read in source |
|
|
847
|
+
| `add-prisma-client-inputs` | 0.8.40 | `...` and `{ "dependentTasksOutputFiles": "**/*.ts" }` in the `inputs` of `targetDefaults.typecheck` and `.build` of a repo with `@zukhruf/nx/prisma`, so a schema change rebuilds the db package (#4826); since 0.8.60 it writes the rule of ADR 0019 |
|
|
848
|
+
| `add-migrate-check` | 0.8.44 | `migrate:check` in `targetDefaults.typecheck.dependsOn` of a repo with `@zukhruf/nx/prisma`, so the typecheck of a db package fails when its migrations do not build its schema (#4937, ADR 0018) |
|
|
849
|
+
| `add-generated-source-defaults` | 0.8.60 | the rule of ADR 0019 in a repo whose `nx.json` lists the three plugins of `init`; removes the `dependsOn: ["^sdk"]` of a web `test` target; logs each other target that hides the rule (#5219) |
|
|
850
|
+
| `add-sdk-build-edges` | 0.8.69 | `build-deps` in each node-app backend; `implicitDependencies` on the backend, `dependsOn: ["^build-deps"]` and the inputs of ADR 0021 in its client's `sdk`; when either file is not the one `node-app` wrote, or the client has no stub, changes neither and logs both edits (#5102) |
|
|
851
|
+
| `rename-eslint-react-config` | 0.8.66 | `zukhruf.configs['shadcn']` for `zukhruf.configs['react']` or `.react` (whatever the default import of `@zukhruf/eslint` is called) and `'zukhruf/shadcn'` for `'zukhruf/react'` in an `extends` array, in each `eslint.config.*`; `@zukhruf/eslint/react` stays; logs each edit (#5263, ADR 0017 decision 10) |
|
|
852
|
+
| `move-peers-in-project-manifests` | 0.8.70 | an entry's version of `packageJsonUpdates` in each project's package.json that declares the package, only when the root package.json declares it at that version (an entry older than the installed @zukhruf/nx, or a package the root does not declare, moves nothing), in its section, never down, never into a project without it; logs each move and the npm install it needs (#5296, #5689, ADR 0017 decision 9) |
|
|
853
|
+
| `type-check-config-files` | 0.8.116 | the `tsconfig.scripts.json` of ADR 0022 and its reference in each node-app and db package that has none; the `hooks` project and the `./.husky` reference when `.husky/project.json` is missing; deletes an `allowDefaultProject` block a generator wrote once a tsconfig covers its files; a file named by a block that stays gets no tsconfig, and each block no generator wrote is logged (#5649) |
|
|
854
|
+
| `move-zukhruf-pins-in-project-manifests` | 0.8.117 | each `packageGroup` package that a project's package.json pins in `dependencies` or `devDependencies` moves to the root's `@zukhruf/nx` version, in the style of its pin; a peer range stays and is logged when it excludes that version; logs each move (#5688, ADR 0017 decision 11) |
|
|
853
855
|
|
|
854
856
|
## release
|
|
855
857
|
|
|
@@ -1004,7 +1006,7 @@ type InitOptions = Record<string, never>;
|
|
|
1004
1006
|
| `package.json` | `private: true`, `type: "module"`, `workspaces: ["apps/*", "packages/*", "tools/*"]` when missing, `scripts.prepare: "git config core.hooksPath .husky \|\| exit 0"` when missing, the root `devDependencies` (see [Versions](#versions-that-the-generators-write)), `allowScripts` for the packages it installs | merge keys | also deletes `packageManager`, the empty `dependencies` and `@nx/workspace`; moves `@zukhruf/nx` from `dependencies` to `devDependencies`; `name` stays `@<name>/source` |
|
|
1005
1007
|
| `nx.json` | `analytics: false`; `tui.enabled: false`; `namedInputs` `default`, `production` (with `{ "env": "NODE_ENV" }`, without the ESLint config, the tests and the test tsconfigs) and `sharedGlobals` (the root ESLint config, `tsconfig.base.json`); `plugins` in this order: `@nx/js/typescript`, `@nx/eslint/plugin`, `@zukhruf/nx/lint`, `@zukhruf/nx/format`, `@zukhruf/nx/test`; `targetDefaults` below; `sync.applyChanges: true` | merge keys | — |
|
|
1006
1008
|
| `tsconfig.base.json` | the base for bundled apps (`moduleResolution: "Bundler"`, `strict`, `verbatimModuleSyntax`, `erasableSyntaxOnly`), with `noUncheckedIndexedAccess`; `tsconfigBase` in [`files.ts`](./src/generators/init/files.ts) | create | — |
|
|
1007
|
-
| `tsconfig.json` | the solution file: `extends` the base, `files: []`, `references
|
|
1009
|
+
| `tsconfig.json` | the solution file: `extends` the base, `files: []`, `references` to `./.husky`; `nx sync` writes the other references | create | — |
|
|
1008
1010
|
| `.npmrc` | `legacy-peer-deps=false`, `save-exact=true`, `strict-allow-scripts=true` | add lines | — |
|
|
1009
1011
|
| `.nvmrc` | `lts/*` | create | — |
|
|
1010
1012
|
| `.gitattributes` | `* text=auto eol=lf` | create | — |
|
|
@@ -1012,9 +1014,10 @@ type InitOptions = Record<string, never>;
|
|
|
1012
1014
|
| `.gitignore` | `gitignore` in [`files.ts`](./src/generators/init/files.ts) | add lines | replaces the file of `nx new` |
|
|
1013
1015
|
| `.prettierrc` | single quotes, the sort-imports plugin, `importOrder` with `./env` and `./startup` first and `^@<scope>/(.*)$`, and no Tailwind plugin | create | — |
|
|
1014
1016
|
| `.prettierignore` | `prettierignore` in [`files.ts`](./src/generators/init/files.ts) | add lines | — |
|
|
1015
|
-
| `eslint.config.mjs` | `flat/base`, `flat/typescript` and `flat/javascript` of `@nx/eslint-plugin`; the build-output `ignores`; `@nx/enforce-module-boundaries`; the `base`, `tests`, `diagnostics`, `env`, `nx-project-json` and `github-actions` configs of `@zukhruf/eslint`; `manifest.configs.recommended`; Modern Node for the config files and `.husky/*.ts`; `allowDefaultProject
|
|
1017
|
+
| `eslint.config.mjs` | `flat/base`, `flat/typescript` and `flat/javascript` of `@nx/eslint-plugin`; the build-output `ignores`; `@nx/enforce-module-boundaries`; the `base`, `tests`, `diagnostics`, `env`, `nx-project-json` and `github-actions` configs of `@zukhruf/eslint`; `manifest.configs.recommended`; Modern Node for the config files and `.husky/*.ts`; no `allowDefaultProject`: a tsconfig includes each `.ts` file | create | — |
|
|
1016
1018
|
| `.husky/pre-commit.ts`, `pre-push.ts`, `commit-msg.ts` | `Sync`, `Format`, `NoNumericPins`, `NpmrcPolicy`, `LockfileSync`, `OneRuntimeCopy`, `InstallScriptsReviewed`, `DockerfileInstallsFromLockfile`, `DependencyChecks` and `WorkflowChecks` on pre-commit, `Build` with `NODE_ENV=production` on pre-push, `NxReleaseScope` on commit-msg; mode `755` | create | — |
|
|
1017
1019
|
| `.husky/pre-commit`, `pre-push`, `commit-msg` | a link to the `.ts` file of the same name | create | — |
|
|
1020
|
+
| `.husky/project.json`, `.husky/tsconfig.json` | the Nx project `hooks`, so its `typecheck` and `lint` read the hooks; the tsconfig includes `*.ts` and writes to `out-tsc` | create | — |
|
|
1018
1021
|
| `.vscode/settings.json` | file nesting, watcher and search excludes for `node_modules`, `.nx`, `tmp` | create | — |
|
|
1019
1022
|
| `.vscode/extensions.json` | `nrwl.angular-console`, `esbenp.prettier-vscode`, `dbaeumer.vscode-eslint` | create | replaces the file of `nx new` |
|
|
1020
1023
|
| `AGENTS.md`, `CLAUDE.md` | `AGENTS.md` holds the commands of the agent workflow; `CLAUDE.md` is one line, `@AGENTS.md` | create | — |
|
|
@@ -1045,7 +1048,7 @@ A root file holds no wiring of one kind of app. A pattern that matches no file i
|
|
|
1045
1048
|
| `@nx/react`, `@nx/vite`, `@nx/vitest`, Vite, Vitest, Testing Library, happy-dom; `generators["@nx/react"]` | `react-app` (#3338) |
|
|
1046
1049
|
| `@zukhruf/eslint/react` and its 3 optional peers; the `react-router` and `tailwind` configs, in the project config | `react-app` (#3338) |
|
|
1047
1050
|
| Tailwind, `prettier-plugin-tailwindcss` in `.prettierrc` `plugins`, the Tailwind sync generator in `sync` and in `build`, `dev`, `serve` | `react-app` (#3338) |
|
|
1048
|
-
| `
|
|
1051
|
+
| `tsconfig.scripts.json` for `sdk-it.config.ts` and `prisma.config.ts`, which `tsconfig.json` references | `node-app`, `prisma` (#5649) |
|
|
1049
1052
|
|
|
1050
1053
|
The Git hooks are the same in each repo. `Sync` stages `**/tsconfig*.json` and `**/styles.css`: it stages only a file that a sync generator wrote, so the second glob matches nothing in a repo with no Tailwind.
|
|
1051
1054
|
|
|
@@ -1181,12 +1184,12 @@ Each schema sets `additionalProperties: false`. The project name is the package
|
|
|
1181
1184
|
|
|
1182
1185
|
### What each app generator writes
|
|
1183
1186
|
|
|
1184
|
-
| Generator | Files of the project
|
|
1185
|
-
| ------------ |
|
|
1186
|
-
| `node-app` | `src/server.ts` (terminus, the `@nx-target-name: serve` header), `app.ts` (Hono on `/api`), `env.ts` (zod: `HOST` required, `BUILD_SHA`, `LOG_DIR`, `LOG_PRETTY`, no `NODE_ENV`), `logging.ts` (evlog: a file drain when `LOG_DIR` is set, pretty output when `LOG_PRETTY` is `true`), `startup.ts`, `routes/healthz.route.ts`, `app.test.ts`; `.env.example` (always: `NODE_ENV=production`, `HOST=127.0.0.1`, `ALLOWED_ORIGINS=`, `LOG_DIR=.evlog/logs/<app>`, `LOG_PRETTY=true`) and `.env` (when missing); `Dockerfile` (`HOST=0.0.0.0`); `sdk-it.config.ts` and the client stub in `.sdk-it/` (`implicitDependencies` on the backend, `sdk` after `^build-deps`, ADR 0021); the `build-deps` target of the backend; the tsconfigs
|
|
1187
|
-
| `react-app` | `index.html`, `src/main.tsx` (React Router 8 in data mode), `src/app/app.tsx` and its test, `src/styles.css` (Tailwind with the sync markers), `vite.config.ts` (the React Compiler, Tailwind, brotli and gzip, the portless and `/api` dev proxy, dev-server `allowedHosts` for `.localhost` and `.trycloudflare.com` (ADR 0010 decision 11), the `test` block), `tsconfig.app.json` writing to `out-tsc`, `tsconfig.spec.json`, `eslint.config.mjs` with `@zukhruf/eslint/react`, `react-router` and `tailwind`
|
|
1188
|
-
| `pair` | in the web: `src/api.ts` and the client, `zod` and `fast-content-type-parse` in its manifest; in the api: `src/routes/ui.route.ts`, its mount in `app.ts` when `UI_ROOT` is set (the process exits at startup when `<UI_ROOT>/index.html` is missing), `UI_ROOT` (optional) in `env.ts`, and the Dockerfile again with the web build and `UI_ROOT=/app/<web>/dist`
|
|
1189
|
-
| `ui-package` | `package.json` with the `development` export of `src/index.ts`, `src/package-name.tsx` (a `PackageName` component), `vite.config.ts` (a library with `vite-plugin-dts`), the tsconfigs, `eslint.config.mjs` with `@zukhruf/eslint/react` and `tailwind`, `tests/public-api.test.mjs`, `tests/package-name.test.mjs` (renders `PackageName` in happy-dom under `node:test`; `@happy-dom/global-registrator` and `react-dom` in its `devDependencies`)
|
|
1187
|
+
| Generator | Files of the project | Root and nx.json |
|
|
1188
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1189
|
+
| `node-app` | `src/server.ts` (terminus, the `@nx-target-name: serve` header), `app.ts` (Hono on `/api`), `env.ts` (zod: `HOST` required, `BUILD_SHA`, `LOG_DIR`, `LOG_PRETTY`, no `NODE_ENV`), `logging.ts` (evlog: a file drain when `LOG_DIR` is set, pretty output when `LOG_PRETTY` is `true`), `startup.ts`, `routes/healthz.route.ts`, `app.test.ts`; `.env.example` (always: `NODE_ENV=production`, `HOST=127.0.0.1`, `ALLOWED_ORIGINS=`, `LOG_DIR=.evlog/logs/<app>`, `LOG_PRETTY=true`) and `.env` (when missing); `Dockerfile` (`HOST=0.0.0.0`); `sdk-it.config.ts` and the client stub in `.sdk-it/` (`implicitDependencies` on the backend, `sdk` after `^build-deps`, ADR 0021); the `build-deps` target of the backend; the tsconfigs, with `tsconfig.scripts.json` for `sdk-it.config.ts`; `eslint.config.mjs` with `hono`, Modern Node and the env settings | `@nx/node`, `@nx/esbuild`, `esbuild`, `@sdk-it/cli`; `.dockerignore` when missing; the client in `workspaces`; the `.sdk-it` lines of `.gitignore` and `.prettierignore`; the `@nx/esbuild:esbuild` default with the rule of `init` (ADR 0019); the sdk-it exclusion of `production`; `generators["@nx/node"]` |
|
|
1190
|
+
| `react-app` | `index.html`, `src/main.tsx` (React Router 8 in data mode), `src/app/app.tsx` and its test, `src/styles.css` (Tailwind with the sync markers), `vite.config.ts` (the React Compiler, Tailwind, brotli and gzip, the portless and `/api` dev proxy, dev-server `allowedHosts` for `.localhost` and `.trycloudflare.com` (ADR 0010 decision 11), the `test` block), `tsconfig.app.json` writing to `out-tsc`, `tsconfig.spec.json`, `eslint.config.mjs` with `@zukhruf/eslint/react`, `react-router` and `tailwind` | `@nx/react`, `@nx/vite`, `@nx/vitest` with `testMode: "run"`, Vite, Vitest, Testing Library, happy-dom, Tailwind, the 4 React lint plugins; `prettier-plugin-tailwindcss` in `.prettierrc`; the Tailwind sync generator in `sync` and in `build`, `dev`, `serve`; `generators["@nx/react"]`; the `test` default as it was |
|
|
1191
|
+
| `pair` | in the web: `src/api.ts` and the client, `zod` and `fast-content-type-parse` in its manifest; in the api: `src/routes/ui.route.ts`, its mount in `app.ts` when `UI_ROOT` is set (the process exits at startup when `<UI_ROOT>/index.html` is missing), `UI_ROOT` (optional) in `env.ts`, and the Dockerfile again with the web build and `UI_ROOT=/app/<web>/dist` | — |
|
|
1192
|
+
| `ui-package` | `package.json` with the `development` export of `src/index.ts`, `src/package-name.tsx` (a `PackageName` component), `vite.config.ts` (a library with `vite-plugin-dts`), the tsconfigs, `eslint.config.mjs` with `@zukhruf/eslint/react` and `tailwind`, `tests/public-api.test.mjs`, `tests/package-name.test.mjs` (renders `PackageName` in happy-dom under `node:test`; `@happy-dom/global-registrator` and `react-dom` in its `devDependencies`) | the React root packages; `fsevents: false` in `allowScripts` |
|
|
1190
1193
|
|
|
1191
1194
|
The targets of a project are in the `nx` key of its `package.json`: the generators pass `useProjectJson: false` to Nx, and Nx 24 always registers its inference plugins, so the targets come from those plugins. `format`, `lint`, `test` (node) and `typecheck` come from the inference plugins; `node-app` writes `build` (one ESM esbuild bundle, each npm package external, with a `require` banner), `serve` (with `NODE_ENV=production`), `portless` (`<app>.<scope>`), `docker:build` and `docker:run`, and keeps `prune-lockfile` of `@nx/node`. `react-app` writes `portless`, `dev` and `serve` with `NODE_ENV=development` (Vite turns React Fast Refresh off under production), and the `test` target of the project (`NODE_ENV=test`, because production React has no `act()`; its `dependsOn` is the rule of `init`, ADR 0019).
|
|
1192
1195
|
|
|
@@ -1263,22 +1266,22 @@ The schema sets `additionalProperties: false`. The package name is `@<scope>/<la
|
|
|
1263
1266
|
|
|
1264
1267
|
### What the prisma generator writes
|
|
1265
1268
|
|
|
1266
|
-
| File
|
|
1267
|
-
|
|
|
1268
|
-
| `schema.prisma`
|
|
1269
|
-
| `prisma.config.ts`
|
|
1270
|
-
| `migrations/migration_lock.toml`
|
|
1271
|
-
| `models/.gitkeep`
|
|
1272
|
-
| `src/index.ts`
|
|
1273
|
-
| `src/testing.ts`
|
|
1274
|
-
| `src/index.test.ts`
|
|
1275
|
-
| `package.json`
|
|
1276
|
-
| `tsconfig.lib.json`
|
|
1277
|
-
| `tsconfig.json`, `tsconfig.test.json` | the solution file
|
|
1278
|
-
| `eslint.config.mjs`
|
|
1279
|
-
| `.env.example`, `.env`
|
|
1280
|
-
| `package.json` `nx.targets`
|
|
1281
|
-
| `Dockerfile.migration`
|
|
1269
|
+
| File | Content |
|
|
1270
|
+
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1271
|
+
| `schema.prisma` | the `prisma-client` generator with `output = "src/prisma"` and `importFileExtension = "ts"`, and the `postgresql` datasource; the models go in `models/*.prisma` |
|
|
1272
|
+
| `prisma.config.ts` | `schema: '.'`, `migrations.path: 'migrations'`, `url` from `CONNECTION_STRING` and `shadowDatabaseUrl` from `SHADOW_CONNECTION_STRING`, each read only when set, so `generate` runs with none; no dotenv |
|
|
1273
|
+
| `migrations/migration_lock.toml` | `provider = "postgresql"` |
|
|
1274
|
+
| `models/.gitkeep` | the image copies `models/`, so the folder is in Git before the first model |
|
|
1275
|
+
| `src/index.ts` | `createPrisma({ connectionString })` on the Postgres adapter, and each export of the generated client; it reads no environment |
|
|
1276
|
+
| `src/testing.ts` | `applySchema(connectionString)`: runs each `migrations/*/migration.sql` in order with `pg`, with no `_prisma_migrations` record, for a test database that is thrown away |
|
|
1277
|
+
| `src/index.test.ts` | a query on a database of `@zukhruf/testing/postgres` after `applySchema`; the project has the tag `test:docker` |
|
|
1278
|
+
| `package.json` | the `.` and `./testing` exports (`development` the source, `import` `dist`); `@prisma/client`, `@prisma/adapter-pg`, `pg` and `tslib` in `dependencies`; `prisma` and `@types/pg` in `devDependencies` |
|
|
1279
|
+
| `tsconfig.lib.json` | the build: JavaScript and declarations into `dist`, with `rewriteRelativeImportExtensions`, because the generated client imports `.ts` files |
|
|
1280
|
+
| `tsconfig.json`, `tsconfig.test.json`, `tsconfig.scripts.json` | the solution file, the tests and `prisma.config.ts`, as in node-app |
|
|
1281
|
+
| `eslint.config.mjs` | ignores `src/prisma`; Modern Node |
|
|
1282
|
+
| `.env.example`, `.env` | `NODE_ENV=production`, `CONNECTION_STRING=postgresql://postgres:postgres@127.0.0.1:<port>/<scope>`, the local Postgres, and `SHADOW_CONNECTION_STRING=`; `.env` only when missing |
|
|
1283
|
+
| `package.json` `nx.targets` | `up`: `docker compose --file <root>/compose.dev.yml up --detach --wait database`, then `prisma migrate deploy`, with `CONNECTION_STRING` pinned to the local URL; `down`: `docker compose … down`, which keeps the volume |
|
|
1284
|
+
| `Dockerfile.migration` | `npm ci --workspace=<package>` installs the CLI from the lockfile, and `CMD npx prisma migrate deploy` applies the migrations to the `CONNECTION_STRING` of the container |
|
|
1282
1285
|
|
|
1283
1286
|
At the root: `compose.dev.yml` when missing, with one `database` service (the `postgres:18-alpine` of the deployed stack on `127.0.0.1:<port>`, the database `<scope>`, a named volume at `/var/lib/postgresql`, a `pg_isready` healthcheck); `@zukhruf/nx/prisma` in `plugins`; `migrate:check` in the `dependsOn` of the `typecheck` default, with `...` (the `generate` entries are the rule of `init`, ADR 0019); `<root>/src/prisma` in `.gitignore` and `.prettierignore`; `.dockerignore` when missing; the package root in `workspaces` when no `<parent>/*` glob holds it; `@zukhruf/testing`; and `@prisma/engines: true`, `prisma: false`, `ssh2: false`, `cpu-features: false` in `allowScripts`. A second run keeps the files of the package and adds no line or key twice.
|
|
1284
1287
|
|
|
@@ -1537,9 +1540,9 @@ The decisions are in [ADR 0011](./docs/adr/0011-the-dokploy-generator-writes-the
|
|
|
1537
1540
|
- [ADR 0007](./docs/adr/0007-opentofu-targets-from-environments-with-no-apply.md): an inference plugin gives each OpenTofu project its targets, and no apply target.
|
|
1538
1541
|
- [ADR 0008](./docs/adr/0008-prisma-targets-from-prisma-config-with-outputs-from-the-schema.md): an inference plugin gives each Prisma project its targets, with the outputs that the schema names (superseded in part by ADR 0019).
|
|
1539
1542
|
- [ADR 0009](./docs/adr/0009-a-preset-and-an-init-generator-start-a-repo-from-nothing.md): a preset and an init generator start a repo from nothing.
|
|
1540
|
-
- [ADR 0010](./docs/adr/0010-the-app-generators-move-here-and-call-the-generators-of-nx.md): the app generators move here and call the generators of Nx (superseded in part by ADR 0019).
|
|
1543
|
+
- [ADR 0010](./docs/adr/0010-the-app-generators-move-here-and-call-the-generators-of-nx.md): the app generators move here and call the generators of Nx (superseded in part by ADR 0019 and ADR 0022).
|
|
1541
1544
|
- [ADR 0011](./docs/adr/0011-the-dokploy-generator-writes-the-gitops-delivery-of-a-node-app.md): the dokploy generator writes the GitOps delivery of a node-app (decision 17 superseded by ADR 0015 for the files of `infra/`).
|
|
1542
|
-
- [ADR 0012](./docs/adr/0012-the-prisma-generator-writes-a-postgres-db-package-and-wires-a-backend.md): the prisma generator writes a Postgres db package and wires a backend (superseded in part by ADR 0019).
|
|
1545
|
+
- [ADR 0012](./docs/adr/0012-the-prisma-generator-writes-a-postgres-db-package-and-wires-a-backend.md): the prisma generator writes a Postgres db package and wires a backend (superseded in part by ADR 0019 and ADR 0022).
|
|
1543
1546
|
- [ADR 0013](./docs/adr/0013-a-target-names-the-tools-it-needs-and-a-hook-checks-them-before-ci-runs-tasks.md): a target names the tools it needs, and a hook checks them before CI runs tasks (rejected by the owner, #4654).
|
|
1544
1547
|
- [ADR 0014](./docs/adr/0014-the-auth-generator-adds-better-auth-to-a-backend-and-its-db-package.md): the auth generator adds better-auth to a backend and its db package (proposed; superseded in part by ADR 0016).
|
|
1545
1548
|
- [ADR 0015](./docs/adr/0015-an-opentofu-module-of-zukhruf-holds-the-dokploy-delivery-and-the-dokploy-generator-writes-infra-once.md): an OpenTofu module of zukhruf holds the Dokploy delivery, and the dokploy generator writes infra once.
|
|
@@ -1549,6 +1552,7 @@ The decisions are in [ADR 0011](./docs/adr/0011-the-dokploy-generator-writes-the
|
|
|
1549
1552
|
- [ADR 0019](./docs/adr/0019-a-task-that-reads-generated-code-runs-its-generator-first-and-hashes-its-output.md): a task that reads generated code runs its generator first and hashes its output.
|
|
1550
1553
|
- [ADR 0020](./docs/adr/0020-two-nightly-checks-run-the-generated-workspace-and-compare-an-upgraded-one-with-a-fresh-one.md): two nightly checks run the generated workspace and compare an upgraded one with a fresh one.
|
|
1551
1554
|
- [ADR 0021](./docs/adr/0021-the-sdk-it-client-depends-on-its-backend-and-runs-after-the-builds-of-the-backends-dependencies.md): the sdk-it client depends on its backend and runs after the builds of the backend's dependencies.
|
|
1555
|
+
- [ADR 0022](./docs/adr/0022-a-tsconfig-type-checks-every-generated-ts-file-and-typed-lint-has-no-default-project.md): a tsconfig type-checks every generated .ts file, and typed lint has no default project.
|
|
1552
1556
|
|
|
1553
1557
|
**Copied code**
|
|
1554
1558
|
|
|
@@ -34,7 +34,9 @@ export declare const tsconfigSolution: {
|
|
|
34
34
|
extends: string;
|
|
35
35
|
compileOnSave: boolean;
|
|
36
36
|
files: never[];
|
|
37
|
-
references:
|
|
37
|
+
references: {
|
|
38
|
+
path: string;
|
|
39
|
+
}[];
|
|
38
40
|
};
|
|
39
41
|
export declare function prettierrc(scope: string): {
|
|
40
42
|
singleQuote: boolean;
|
|
@@ -49,9 +51,29 @@ export declare function prettierrc(scope: string): {
|
|
|
49
51
|
};
|
|
50
52
|
}[];
|
|
51
53
|
};
|
|
52
|
-
export declare const eslintConfig = "import nx from '@nx/eslint-plugin';\nimport zukhruf from '@zukhruf/eslint';\nimport modernNode from '@zukhruf/eslint/modern-node';\nimport { manifest } from '@zukhruf/eslint/nx';\nimport { defineConfig } from 'eslint/config';\n\n// Modern Node is for code that runs on Node. A browser bundle stays out. Each\n// project has its own eslint.config.mjs that spreads the default export, so a\n// Node project spreads this block too.\nexport const modernNodeRecommended = defineConfig({\n plugins: { 'modern-node': modernNode },\n extends: ['modern-node/recommended'],\n});\n\nexport default [\n ...nx.configs['flat/base'],\n ...nx.configs['flat/typescript'],\n ...nx.configs['flat/javascript'],\n {\n // Flat config never reads .gitignore, so build output is listed here.\n ignores: [\n '**/.nx',\n '**/coverage',\n '**/dist',\n '**/node_modules',\n '**/out-tsc',\n '**/*.tsbuildinfo',\n '**/vite.config.*.timestamp*',\n '**/vitest.config.*.timestamp*',\n '**/.sdk-it',\n ],\n },\n {\n files: ['**/*.{js,jsx,ts,tsx}'],\n rules: {\n '@nx/enforce-module-boundaries': [\n 'error',\n {\n enforceBuildableLibDependency: true,\n depConstraints: [{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] }],\n },\n ],\n },\n },\n ...zukhruf.configs['base'],\n ...zukhruf.configs['tests'],\n ...zukhruf.configs['diagnostics'],\n ...zukhruf.configs['env'],\n ...zukhruf.configs['nx-project-json'],\n ...zukhruf.configs['github-actions'],\n ...manifest.configs.recommended,\n // The files that this config lints itself, and the config files of each\n // project: all of them run on Node.\n ...defineConfig({\n files: ['*.config.{ts,mjs}', '.husky/*.ts', 'tools/*.mjs'],\n extends: [modernNodeRecommended],\n }),\n
|
|
54
|
+
export declare const eslintConfig = "import nx from '@nx/eslint-plugin';\nimport zukhruf from '@zukhruf/eslint';\nimport modernNode from '@zukhruf/eslint/modern-node';\nimport { manifest } from '@zukhruf/eslint/nx';\nimport { defineConfig } from 'eslint/config';\n\n// Modern Node is for code that runs on Node. A browser bundle stays out. Each\n// project has its own eslint.config.mjs that spreads the default export, so a\n// Node project spreads this block too.\nexport const modernNodeRecommended = defineConfig({\n plugins: { 'modern-node': modernNode },\n extends: ['modern-node/recommended'],\n});\n\nexport default [\n ...nx.configs['flat/base'],\n ...nx.configs['flat/typescript'],\n ...nx.configs['flat/javascript'],\n {\n // Flat config never reads .gitignore, so build output is listed here.\n ignores: [\n '**/.nx',\n '**/coverage',\n '**/dist',\n '**/node_modules',\n '**/out-tsc',\n '**/*.tsbuildinfo',\n '**/vite.config.*.timestamp*',\n '**/vitest.config.*.timestamp*',\n '**/.sdk-it',\n ],\n },\n {\n files: ['**/*.{js,jsx,ts,tsx}'],\n rules: {\n '@nx/enforce-module-boundaries': [\n 'error',\n {\n enforceBuildableLibDependency: true,\n depConstraints: [{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] }],\n },\n ],\n },\n },\n ...zukhruf.configs['base'],\n ...zukhruf.configs['tests'],\n ...zukhruf.configs['diagnostics'],\n ...zukhruf.configs['env'],\n ...zukhruf.configs['nx-project-json'],\n ...zukhruf.configs['github-actions'],\n ...manifest.configs.recommended,\n // The files that this config lints itself, and the config files of each\n // project: all of them run on Node.\n ...defineConfig({\n files: ['*.config.{ts,mjs}', '.husky/*.ts', 'tools/*.mjs'],\n extends: [modernNodeRecommended],\n }),\n];\n";
|
|
53
55
|
/** The Git hooks, each in TypeScript. `.husky/<name>` is a link to `.husky/<name>.ts`. */
|
|
54
56
|
export declare const hooks: Record<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* The hooks are the Nx project `hooks`, so its typecheck and lint targets
|
|
59
|
+
* read them: a hook is a file that git runs, not a package, and no other
|
|
60
|
+
* tsconfig includes it.
|
|
61
|
+
*/
|
|
62
|
+
export declare const hooksProjectJson: {
|
|
63
|
+
name: string;
|
|
64
|
+
$schema: string;
|
|
65
|
+
sourceRoot: string;
|
|
66
|
+
projectType: string;
|
|
67
|
+
};
|
|
68
|
+
export declare const hooksTsconfig: {
|
|
69
|
+
extends: string;
|
|
70
|
+
compilerOptions: {
|
|
71
|
+
rootDir: string;
|
|
72
|
+
outDir: string;
|
|
73
|
+
tsBuildInfoFile: string;
|
|
74
|
+
};
|
|
75
|
+
include: string[];
|
|
76
|
+
};
|
|
55
77
|
export declare const vscodeSettings: {
|
|
56
78
|
'explorer.fileNesting.enabled': boolean;
|
|
57
79
|
'explorer.fileNesting.expand': boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/generators/init/files.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,ueA4BrB,CAAC;AAEF,eAAO,MAAM,cAAc,4FAQ1B,CAAC;AAEF,eAAO,MAAM,KAAK,yEAGjB,CAAC;AAEF,eAAO,MAAM,KAAK,YAAY,CAAC;AAE/B,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD,eAAO,MAAM,YAAY,6MAYxB,CAAC;AAEF,eAAO,MAAM,YAAY;IACvB,eAAe;QACb,0BAA0B;QAC1B,SAAS;QACT,WAAW;QACX,cAAc;QACd,mBAAmB;QACnB,kBAAkB;QAClB,gCAAgC;QAChC,aAAa;QACb,eAAe;QACf,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,aAAa;QACb,0BAA0B;QAC1B,kBAAkB;QAClB,iBAAiB;QACjB,wBAAwB;QACxB,YAAY;QACZ,MAAM;QACN,MAAM;QACN,0BAA0B;QAC1B,oBAAoB;;CAEvB,CAAC;AAEF,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":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AA0B;;IAE5B,gBAAgB;QACd,iBAAiB;QACjB,QAAQ;QACR,QAAQ;;CAEX,CAAC;AAEF,eAAO,MAAM,gBAAgB;IAC3B,eAAe;CAKhB,CAAC;AAEF,eAAO,MAAM,MAAM,o2BAalB,CAAC;AAEF,eAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C"}
|
|
@@ -88,7 +88,7 @@ export const tsconfigSolution = {
|
|
|
88
88
|
extends: './tsconfig.base.json',
|
|
89
89
|
compileOnSave: false,
|
|
90
90
|
files: [],
|
|
91
|
-
references: [],
|
|
91
|
+
references: [{ path: './.husky' }],
|
|
92
92
|
};
|
|
93
93
|
export function prettierrc(scope) {
|
|
94
94
|
return {
|
|
@@ -171,18 +171,6 @@ export default [
|
|
|
171
171
|
files: ['*.config.{ts,mjs}', '.husky/*.ts', 'tools/*.mjs'],
|
|
172
172
|
extends: [modernNodeRecommended],
|
|
173
173
|
}),
|
|
174
|
-
// Files that no tsconfig includes get the default project of typed lint,
|
|
175
|
-
// not a parse error. typescript-eslint refuses '**' here.
|
|
176
|
-
{
|
|
177
|
-
files: ['**/*.ts'],
|
|
178
|
-
languageOptions: {
|
|
179
|
-
parserOptions: {
|
|
180
|
-
projectService: {
|
|
181
|
-
allowDefaultProject: ['*.config.ts', '.husky/*.ts'],
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
174
|
];
|
|
187
175
|
`;
|
|
188
176
|
/** The Git hooks, each in TypeScript. `.husky/<name>` is a link to `.husky/<name>.ts`. */
|
|
@@ -242,6 +230,26 @@ import { NxReleaseScope, commitMsg } from '@zukhruf/git-hooks';
|
|
|
242
230
|
await commitMsg([new NxReleaseScope()]);
|
|
243
231
|
`,
|
|
244
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* The hooks are the Nx project `hooks`, so its typecheck and lint targets
|
|
235
|
+
* read them: a hook is a file that git runs, not a package, and no other
|
|
236
|
+
* tsconfig includes it.
|
|
237
|
+
*/
|
|
238
|
+
export const hooksProjectJson = {
|
|
239
|
+
name: 'hooks',
|
|
240
|
+
$schema: '../node_modules/nx/schemas/project-schema.json',
|
|
241
|
+
sourceRoot: '.husky',
|
|
242
|
+
projectType: 'application',
|
|
243
|
+
};
|
|
244
|
+
export const hooksTsconfig = {
|
|
245
|
+
extends: '../tsconfig.base.json',
|
|
246
|
+
compilerOptions: {
|
|
247
|
+
rootDir: '.',
|
|
248
|
+
outDir: 'out-tsc',
|
|
249
|
+
tsBuildInfoFile: 'out-tsc/tsconfig.tsbuildinfo',
|
|
250
|
+
},
|
|
251
|
+
include: ['*.ts'],
|
|
252
|
+
};
|
|
245
253
|
export const vscodeSettings = {
|
|
246
254
|
'explorer.fileNesting.enabled': true,
|
|
247
255
|
'explorer.fileNesting.expand': false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/generators/init/files.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,wBAAwB;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;CAQ7B,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;;;CAGpB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;CAY3B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe,EAAE;QACf,0BAA0B,EAAE,IAAI;QAChC,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,mBAAmB,EAAE,IAAI;QAC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CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC;AAErC,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,KAAK,IAAI,qDAAqD,CAAC;AACxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/init/generator.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/init/generator.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;AAqCpB;;;;GAIG;AACH,wBAA8B,aAAa,CACzC,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,iBAAiB,CAAC,CAmC5B"}
|
|
@@ -3,7 +3,7 @@ import { basename, join } from 'node:path';
|
|
|
3
3
|
import { formatFiles, installPackagesTask, runTasksInSerial, writeJson, } from '@nx/devkit';
|
|
4
4
|
import { addLines } from '../add-lines.js';
|
|
5
5
|
import { workspaceScope } from '../workspace-scope.js';
|
|
6
|
-
import { agents, claude, editorconfig, eslintConfig, gitattributes, gitignore, hooks, npmrc, nvmrc, prettierignore, prettierrc, tsconfigBase, tsconfigSolution, vscodeExtensions, vscodeSettings, } from './files.js';
|
|
6
|
+
import { agents, claude, editorconfig, eslintConfig, gitattributes, gitignore, hooks, hooksProjectJson, hooksTsconfig, npmrc, nvmrc, prettierignore, prettierrc, tsconfigBase, tsconfigSolution, vscodeExtensions, vscodeSettings, } from './files.js';
|
|
7
7
|
import { mergeNxJson } from './nx-json.js';
|
|
8
8
|
import { mergeRootPackageJson } from './root-package-json.js';
|
|
9
9
|
/** Writes a file only when it is missing. Returns whether it wrote. */
|
|
@@ -40,6 +40,8 @@ export default async function initGenerator(tree) {
|
|
|
40
40
|
const newHooks = Object.entries(hooks)
|
|
41
41
|
.filter(([path, content]) => create(tree, path, content))
|
|
42
42
|
.map(([path]) => path);
|
|
43
|
+
create(tree, '.husky/project.json', hooksProjectJson);
|
|
44
|
+
create(tree, '.husky/tsconfig.json', hooksTsconfig);
|
|
43
45
|
create(tree, '.vscode/settings.json', vscodeSettings);
|
|
44
46
|
create(tree, '.vscode/extensions.json', vscodeExtensions);
|
|
45
47
|
create(tree, 'AGENTS.md', agents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/init/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAGL,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,EACL,KAAK,EACL,cAAc,EACd,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,uEAAuE;AACvE,SAAS,MAAM,CAAC,IAAU,EAAE,IAAY,EAAE,OAAwB;IAChE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,IAAI,E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ClC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAElC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACxB,+EAA+E;IAC/E,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,gBAAgB,CACrB,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAC/B,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CACH,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACpB,MAAM,IAAI,KAAK;gBACf,KAAK,CAAC,IAAI,KAAK,QAAQ,CACxB,EAAE,CAAC;gBACF,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
export declare function eslintConfig(
|
|
1
|
+
export declare function eslintConfig(rootOffset: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* The type-check-only tsconfig of sdk-it.config.ts: it is outside src, so this
|
|
4
|
+
* tsconfig is what type-checks it, and the project's tsconfig.json references
|
|
5
|
+
* it (ADR 0022).
|
|
6
|
+
*/
|
|
7
|
+
export declare function scriptsTsconfig(rootOffset: string): {
|
|
8
|
+
extends: string;
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
outDir: string;
|
|
11
|
+
rootDir: string;
|
|
12
|
+
tsBuildInfoFile: string;
|
|
13
|
+
types: string[];
|
|
14
|
+
};
|
|
15
|
+
include: string[];
|
|
16
|
+
};
|
|
2
17
|
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 // A browser origin gets CORS only when ALLOWED_ORIGINS lists it, in every\n // setup.\n cors({\n origin: (origin) => {\n // A request with no Origin header (a health check, a server call) needs\n // no CORS and never reads ALLOWED_ORIGINS.\n if (!origin) return '';\n const allowed = process.env.ALLOWED_ORIGINS.split(',');\n return allowed.map((entry) => entry.trim()).includes(origin)\n ? origin\n : '';\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\n// The evlog middleware logs the error that reaches here, its cause included,\n// and logging.ts sets the level from the status.\napp.onError((error, c) => {\n if (error instanceof HTTPException) {\n return c.json({ error: error.message, cause: error.cause }, error.status);\n }\n // The log has the error; the response never carries it.\n return c.json(\n {\n error: 'Internal Server Error',\n cause: { code: 'api/internal', detail: 'Unexpected error' },\n },\n 500,\n );\n});\n\nexport default app;\n";
|
|
3
18
|
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
19
|
export declare function envTs(port: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/generators/node-app/files.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/generators/node-app/files.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM;IAE9C,OAAO;IACP,eAAe;QACb,MAAM;QACN,OAAO;QACP,eAAe;QACf,KAAK;;IAEP,OAAO;EAEV;AAED,eAAO,MAAM,KAAK,kmEAyEjB,CAAC;AAEF,eAAO,MAAM,SAAS,8qBAmBrB,CAAC;AAEF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA6C1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgI9C;AAED,eAAO,MAAM,cAAc,6sBAqB1B,CAAC;AAEF,eAAO,MAAM,QAAQ,w3CA6CpB,CAAC;AAEF,eAAO,MAAM,SAAS,sLAKrB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAiB7D;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,CA6C7D;AAED,eAAO,MAAM,YAAY,gKAYxB,CAAC;AAEF,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAa5E;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe;IAAK,SAAS;CAAc,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAgD3E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAWzD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The content of each file that node-app writes into the project. Each is a
|
|
2
2
|
// string in a .ts module, so tsc puts it in dist with no copy step (ADR 0009).
|
|
3
|
-
export function eslintConfig(
|
|
3
|
+
export function eslintConfig(rootOffset) {
|
|
4
4
|
return `import zukhruf from '@zukhruf/eslint';
|
|
5
5
|
|
|
6
6
|
import baseConfig, { modernNodeRecommended } from '${rootOffset}eslint.config.mjs';
|
|
@@ -10,24 +10,26 @@ export default [
|
|
|
10
10
|
...zukhruf.configs['hono'],
|
|
11
11
|
...modernNodeRecommended,
|
|
12
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
13
|
];
|
|
29
14
|
`;
|
|
30
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The type-check-only tsconfig of sdk-it.config.ts: it is outside src, so this
|
|
18
|
+
* tsconfig is what type-checks it, and the project's tsconfig.json references
|
|
19
|
+
* it (ADR 0022).
|
|
20
|
+
*/
|
|
21
|
+
export function scriptsTsconfig(rootOffset) {
|
|
22
|
+
return {
|
|
23
|
+
extends: `${rootOffset}tsconfig.base.json`,
|
|
24
|
+
compilerOptions: {
|
|
25
|
+
outDir: 'out-tsc/scripts',
|
|
26
|
+
rootDir: '.',
|
|
27
|
+
tsBuildInfoFile: 'out-tsc/tsconfig.scripts.tsbuildinfo',
|
|
28
|
+
types: ['node'],
|
|
29
|
+
},
|
|
30
|
+
include: ['sdk-it.config.ts'],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
31
33
|
export const appTs = `import { evlog } from 'evlog/hono';
|
|
32
34
|
import { Hono } from 'hono';
|
|
33
35
|
import { compress } from 'hono/compress';
|
|
@@ -1 +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,
|
|
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,UAAkB;IAC7C,OAAO;;qDAE4C,UAAU;;;;;;;;CAQ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T,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -1 +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,EAOV,MAAM,YAAY,CAAC;
|
|
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,EAOV,MAAM,YAAY,CAAC;AAwCpB,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAqBD,eAAO,MAAM,mBAAmB,0HACyF,CAAC;AAO1H;;;;GAIG;AACH,wBAA8B,gBAAgB,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA8F5B;AAoDD,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAOvD"}
|
|
@@ -9,7 +9,7 @@ import { addPortlessProxyEnv } from '../portless-env.js';
|
|
|
9
9
|
import { fseventsScript, rootDependencyNames, settleRootDependencies, } from '../root-dependencies.js';
|
|
10
10
|
import { appPackageVersions as versions } from '../versions.js';
|
|
11
11
|
import { workspaceScope } from '../workspace-scope.js';
|
|
12
|
-
import { appTestTs, appTs, buildDepsTarget, clientManifest, clientTsconfig, dockerfile, dockerignore, envExample, envTs, eslintConfig, healthzRouteTs, loggingTs, sdkItConfig, serverTs, startupTs, } from './files.js';
|
|
12
|
+
import { appTestTs, appTs, buildDepsTarget, clientManifest, clientTsconfig, dockerfile, dockerignore, envExample, envTs, eslintConfig, healthzRouteTs, loggingTs, scriptsTsconfig, sdkItConfig, serverTs, startupTs, } from './files.js';
|
|
13
13
|
export const createRequireBanner = "import { createRequire as nodeCreateRequire } from 'node:module'; const require = nodeCreateRequire(import.meta.url);";
|
|
14
14
|
const tsSolutionTsconfigInput = {
|
|
15
15
|
json: '{workspaceRoot}/tsconfig.json',
|
|
@@ -57,7 +57,7 @@ export default async function nodeAppGenerator(tree, options) {
|
|
|
57
57
|
tree.delete(`${projectRoot}/src/assets/.gitkeep`);
|
|
58
58
|
writeTsconfigs(tree, projectRoot, rootOffset);
|
|
59
59
|
writeProjectPackageJson(tree, { projectRoot, name, projectName, port, scope }, previousServe);
|
|
60
|
-
tree.write(`${projectRoot}/eslint.config.mjs`, eslintConfig(
|
|
60
|
+
tree.write(`${projectRoot}/eslint.config.mjs`, eslintConfig(rootOffset));
|
|
61
61
|
tree.write(`${projectRoot}/src/app.ts`, appTs);
|
|
62
62
|
tree.write(`${projectRoot}/src/app.test.ts`, appTestTs);
|
|
63
63
|
tree.write(`${projectRoot}/src/env.ts`, envTs(port));
|
|
@@ -119,6 +119,7 @@ function writeTsconfigs(tree, projectRoot, rootOffset) {
|
|
|
119
119
|
references: [
|
|
120
120
|
{ path: './tsconfig.app.json' },
|
|
121
121
|
{ path: './tsconfig.test.json' },
|
|
122
|
+
{ path: './tsconfig.scripts.json' },
|
|
122
123
|
],
|
|
123
124
|
});
|
|
124
125
|
writeJson(tree, `${projectRoot}/tsconfig.app.json`, {
|
|
@@ -143,6 +144,7 @@ function writeTsconfigs(tree, projectRoot, rootOffset) {
|
|
|
143
144
|
include: ['src/**/*.test.ts'],
|
|
144
145
|
references: [{ path: './tsconfig.app.json' }],
|
|
145
146
|
});
|
|
147
|
+
writeJson(tree, `${projectRoot}/tsconfig.scripts.json`, scriptsTsconfig(rootOffset));
|
|
146
148
|
}
|
|
147
149
|
/** The image tag of a project name, as @nx/node sanitizes it: `@acme/backend` gives `acme-backend`. */
|
|
148
150
|
export function imageTagFor(projectName) {
|