@zukhruf/nx 0.8.29 → 0.8.30

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 (51) hide show
  1. package/README.md +466 -9
  2. package/dist/generators/init/files.d.ts +81 -0
  3. package/dist/generators/init/files.d.ts.map +1 -0
  4. package/dist/generators/init/files.js +278 -0
  5. package/dist/generators/init/files.js.map +1 -0
  6. package/dist/generators/init/generator.d.ts +8 -0
  7. package/dist/generators/init/generator.d.ts.map +1 -0
  8. package/dist/generators/init/generator.js +87 -0
  9. package/dist/generators/init/generator.js.map +1 -0
  10. package/dist/generators/init/nx-json.d.ts +7 -0
  11. package/dist/generators/init/nx-json.d.ts.map +1 -0
  12. package/dist/generators/init/nx-json.js +111 -0
  13. package/dist/generators/init/nx-json.js.map +1 -0
  14. package/dist/generators/init/root-package-json.d.ts +19 -0
  15. package/dist/generators/init/root-package-json.d.ts.map +1 -0
  16. package/dist/generators/init/root-package-json.js +46 -0
  17. package/dist/generators/init/root-package-json.js.map +1 -0
  18. package/dist/generators/preset/generator.d.ts +14 -0
  19. package/dist/generators/preset/generator.d.ts.map +1 -0
  20. package/dist/generators/preset/generator.js +43 -0
  21. package/dist/generators/preset/generator.js.map +1 -0
  22. package/dist/generators/versions.d.ts +24 -0
  23. package/dist/generators/versions.d.ts.map +1 -0
  24. package/dist/generators/versions.js +50 -0
  25. package/dist/generators/versions.js.map +1 -0
  26. package/dist/generators/workspace-scope.d.ts +8 -0
  27. package/dist/generators/workspace-scope.d.ts.map +1 -0
  28. package/dist/generators/workspace-scope.js +15 -0
  29. package/dist/generators/workspace-scope.js.map +1 -0
  30. package/dist/opentofu/check-plan-fresh.d.ts +2 -0
  31. package/dist/opentofu/check-plan-fresh.d.ts.map +1 -0
  32. package/dist/opentofu/check-plan-fresh.js +47 -0
  33. package/dist/opentofu/check-plan-fresh.js.map +1 -0
  34. package/dist/opentofu/plugin.d.ts +9 -0
  35. package/dist/opentofu/plugin.d.ts.map +1 -0
  36. package/dist/opentofu/plugin.js +108 -0
  37. package/dist/opentofu/plugin.js.map +1 -0
  38. package/dist/prisma/plugin.d.ts +9 -0
  39. package/dist/prisma/plugin.d.ts.map +1 -0
  40. package/dist/prisma/plugin.js +83 -0
  41. package/dist/prisma/plugin.js.map +1 -0
  42. package/dist/project-roots.d.ts +5 -0
  43. package/dist/project-roots.d.ts.map +1 -1
  44. package/dist/project-roots.js +10 -0
  45. package/dist/project-roots.js.map +1 -1
  46. package/dist/test/plugin.js +1 -7
  47. package/dist/test/plugin.js.map +1 -1
  48. package/generators.json +14 -0
  49. package/package.json +25 -5
  50. package/src/generators/init/schema.json +8 -0
  51. package/src/generators/preset/schema.json +18 -0
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @zukhruf/nx
2
2
 
3
- This package is the Nx part of the monorepo standard. Each workspace copied the same Nx configuration into each project. This package gives that configuration one time, in areas. Each area has its own import path, and the package has no root entry point. The lint rules stay in `@zukhruf/eslint`, and the Git hooks stay in `@zukhruf/git-hooks`.
3
+ This package is the Nx part of the monorepo standard. Each workspace copied the same Nx configuration into each project. This package gives that configuration one time, in areas. Each area has its own import path, and the package has no root entry point. Two [generators](#generators) write the root files of a workspace. The lint rules stay in `@zukhruf/eslint`, and the Git hooks stay in `@zukhruf/git-hooks`.
4
4
 
5
5
  The words in these documents have one meaning each. See the glossary in [CONTEXT.md](./CONTEXT.md).
6
6
 
7
7
  ## Areas
8
8
 
9
- | Area | Import path | Status |
10
- | ---------------- | ---------------------- | --------------------------------------------------------------------------------------------- |
11
- | format | `@zukhruf/nx/format` | This README |
12
- | test | `@zukhruf/nx/test` | This README |
13
- | lint | `@zukhruf/nx/lint` | This README |
14
- | portless | `@zukhruf/nx/portless` | Candidate (#3336): 14 projects in 3 repos |
15
- | opentofu, prisma | — | Candidates (#3339): 5 places each |
16
- | generators | — | Candidates: the workspace generator of `@factory/foundation` (#3337); app kinds later (#3338) |
9
+ | Area | Import path | Status |
10
+ | ---------------- | ---------------------- | -------------------------------------------------------------------------- |
11
+ | format | `@zukhruf/nx/format` | This README |
12
+ | test | `@zukhruf/nx/test` | This README |
13
+ | lint | `@zukhruf/nx/lint` | This README |
14
+ | portless | `@zukhruf/nx/portless` | Candidate (#3336): 14 projects in 3 repos |
15
+ | opentofu, prisma | `@zukhruf/nx/<area>` | This README (#3339) |
16
+ | generators | `@zukhruf/nx:<name>` | This README: `preset` and `init` (#3337); the app generators later (#3338) |
17
17
 
18
18
  The lint rules stay in `@zukhruf/eslint`. The `lint` area gives only the inputs of the `lint` target (#3335).
19
19
 
@@ -495,3 +495,460 @@ The lockfile measured the edges on 2026-10-30. For factory, whatisgoingon, deepa
495
495
  | context-compiler | uses it (#3391) |
496
496
 
497
497
  The umbrella item is #3335.
498
+
499
+ ## opentofu
500
+
501
+ > Status: shipped (#3339).
502
+
503
+ Five projects in two workspaces run OpenTofu through Nx: the `infra` project of whatisgoingon, and four projects of text2sql (`v2-terraform`, `authx-terraform`, `desktop-terraform`, `diagnostics-terraform`). Each one copies the same targets and the same freshness script. The `opentofu` area is an Nx inference plugin. It gives the OpenTofu targets to each project that has environments. You list the plugin one time in `nx.json`. You do not copy the targets or the script.
504
+
505
+ ### Use the opentofu area
506
+
507
+ You need Nx 23.2.1 or later and the `tofu` command on the `PATH`. Add the plugin to `plugins` in `nx.json`, after `@zukhruf/nx/format`:
508
+
509
+ ```json
510
+ {
511
+ "plugins": ["@zukhruf/nx/format", "@zukhruf/nx/opentofu"]
512
+ }
513
+ ```
514
+
515
+ The order is necessary. Both plugins give `format` and `format:check`, and a later plugin wins the merge. In the other order, an OpenTofu project gets the Prettier targets.
516
+
517
+ A workspace that builds this package lists the plugin by path, as zukhruf does for the other areas: `"./packages/nx/src/opentofu/plugin.ts"`.
518
+
519
+ ### Signature of the opentofu area
520
+
521
+ ```ts
522
+ // @zukhruf/nx/opentofu
523
+ export const createNodes: CreateNodes;
524
+ ```
525
+
526
+ The plugin takes no options. The commands are the same in each of the 5 copies. The differences between the copies are of a different kind, and they stay with the project (see [Give the secrets](#give-the-secrets) and [Check that a saved plan is fresh](#check-that-a-saved-plan-is-fresh)).
527
+
528
+ ### Which projects get the OpenTofu targets
529
+
530
+ An **environment** is a folder `src/environments/<name>` of a project root, with at least one `*.tf` file directly in it. Each environment is one OpenTofu root module, with its own state and its own saved plan. A project root gets the OpenTofu targets when it has at least one environment. The project roots are the same as for the other areas (see [ADR 0003](./docs/adr/0003-which-roots-get-targets.md)). A `*.tf` file belongs to its nearest project root.
531
+
532
+ The plugin adds `**/src/environments/*/*.tf` to the files that it reads. Thus Nx runs the plugin again when an environment is added or removed.
533
+
534
+ Each target that works on one environment has one configuration for each environment. The options select the **default environment**: `production` when it exists, else the first environment in name order. Select another environment with `-c`:
535
+
536
+ ```sh
537
+ nx run authx-terraform:preview -c staging
538
+ ```
539
+
540
+ A task dependency runs with the same configuration. Thus `preview -c staging` runs `init -c staging` first.
541
+
542
+ ### What each OpenTofu target runs
543
+
544
+ | Target | Command | `cwd` | Cached | Depends on |
545
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------ | ---------- |
546
+ | `format` | `tofu fmt -recursive` | `{projectRoot}/src` | no | — |
547
+ | `format:check` | `tofu fmt -check -recursive` | `{projectRoot}/src` | yes | — |
548
+ | `typecheck` | for each environment: `tofu -chdir=environments/<name> init -backend=false -input=false -lockfile=readonly && tofu -chdir=environments/<name> validate` | `{projectRoot}/src` | yes | — |
549
+ | `init` | `tofu init -input=false` | `{projectRoot}/src/environments/<name>` | no | — |
550
+ | `preview` | `rm -f tfplan && tofu plan -out tfplan` | the environment | no | `init` |
551
+ | `show` | the freshness check, then `tofu show tfplan` | the environment | no | — |
552
+ | `output` | `tofu output` | the environment | no | — |
553
+
554
+ - `format` writes. `format:check` and `typecheck` only read, as for each check ([ADR 0002](./docs/adr/0002-a-check-never-writes.md)).
555
+ - The inputs of `format:check` and `typecheck` are `{projectRoot}/src/**/*.tf`, `{projectRoot}/src/**/*.hcl` and the output of `tofu version`. The provider lock file `.terraform.lock.hcl` is an `*.hcl` file. A new release of OpenTofu thus runs the checks again.
556
+ - `typecheck` needs no secret. `init -backend=false` reads no state, and `validate` reads no variable value. CI can run it with no secret.
557
+ - `typecheck` sets `TF_DATA_DIR=.terraform/validate`. Its `init` with no backend thus does not replace the working directory of the real `init`. text2sql already does this in its 4 projects.
558
+ - `typecheck` reads the provider lock file and does not write it (`-lockfile=readonly`). When a provider is added or its version changes, `typecheck` stops: "Provider dependency changes detected". Run `nx run <project>:init`, which writes the lock file, and commit the lock file. A new hash for another platform does not stop it: OpenTofu suppresses only that write.
559
+ - `typecheck` checks each environment. `-c` does not select one.
560
+ - `init`, `preview`, `show` and `output` need the state passphrase (see [Give the secrets](#give-the-secrets)).
561
+ - `preview` deletes the old plan first. A plan that fails thus leaves no plan for `show`.
562
+ - `show` does not depend on `preview`. It shows the plan that `preview` saved, and it stops when that plan is not fresh (see [Check that a saved plan is fresh](#check-that-a-saved-plan-is-fresh)).
563
+ - Arguments after `--` go to the last command. For example, `nx run infra:output -- -raw dokploy_api` runs `tofu output -raw dokploy_api`.
564
+
565
+ The plugin gives no `apply` target, on purpose. CI applies: main is the wanted state, and the reusable workflow `tofu-apply.yml` applies it and commits the state. A person does not apply from a laptop. Two old targets also go: `plan` is the same as `preview`, and `validate` is in `typecheck`. `refresh` stays in the project that needs it, as an override. See [ADR 0007](./docs/adr/0007-opentofu-targets-from-environments-with-no-apply.md).
566
+
567
+ ### Give the secrets
568
+
569
+ The state and the saved plans are encrypted. Each project reads the passphrase from the variable `tf_encryption_passphrase`. `init`, `preview`, `show` and `output` thus start with a guard. It stops the target when `TF_ENCRYPTION_PASSPHRASE` is empty or not set. Then the target gives the value to OpenTofu as `TF_VAR_tf_encryption_passphrase`.
570
+
571
+ The plugin sets no `envFile`. Nx already loads the `.env` file of the project root for each task, and `.env.<configuration>` for a task with a configuration (`nx/dist/src/tasks-runner/task-env-paths.js`). A variable that the environment already sets wins. Thus put the secrets in `<projectRoot>/.env`, and keep that file out of Git. With no `.env` file, the target reads the environment only. An `envFile` that does not exist stops the task with an error (`nx/dist/src/executors/run-commands/running-tasks.js:553-558`).
572
+
573
+ The other secrets are different in each project, so the plugin does not check them. OpenTofu reads each variable `<name>` from `TF_VAR_<name>`, and each provider reads its own token, for example `HCLOUD_TOKEN`. Give a variable with a different name in `.env`. Nx expands `${NAME}` in the file (`dotenv-expand`):
574
+
575
+ ```sh
576
+ TF_ENCRYPTION_PASSPHRASE=…
577
+ DOKPLOY_API_KEY=…
578
+ HCLOUD_TOKEN=…
579
+ TF_VAR_dokploy_api_key=${DOKPLOY_API_KEY}
580
+ ```
581
+
582
+ When a variable has no value, OpenTofu asks for it, or stops with "No value for required variable". The copies checked each secret in the shell first. That check predicts the error that OpenTofu already gives.
583
+
584
+ ### Check that a saved plan is fresh
585
+
586
+ `show` runs the freshness check first. The check is a Node script inside this package (`src/opentofu/check-plan-fresh.ts`). The plugin gives its path relative to the environment. The check stops `show` in two cases:
587
+
588
+ - The environment has no `tfplan`. Run `preview` first.
589
+ - A file of the project changed after `preview` wrote the plan. The message names the file.
590
+
591
+ A **file of the project** is each file under the project root that Git tracks or does not ignore (`git ls-files --cached --others --exclude-standard`). A tracked file that was deleted counts as changed. A file named `tfplan` does not count. Thus the check sees each input of the plan in the project: the environment, the modules, the scripts, `project.json`, the provider lock file, the committed state, and a template such as `compose.dokploy.yml`. The `.terraform` folders, `.env` and the plans of the other environments are ignored by Git, so a new `init` does not make the plan stale.
592
+
593
+ The copies listed the inputs by name, and the lists drifted: two copies did not list `src/modules`, and two listed a compose file outside the project root, `../compose.dokploy.yml`. Each project now keeps its plan inputs inside its root. Move a template that the configuration reads into the project root.
594
+
595
+ The check needs Git. Outside a Git work tree, it stops with the error of Git. OpenTofu also refuses to apply a plan when the state changed after the plan. The check adds the files that OpenTofu does not compare.
596
+
597
+ ### Override an OpenTofu target
598
+
599
+ A target in the `project.json` of a project replaces the inferred target, or merges into it. Nx applies the plugin first, then `targetDefaults`, then `project.json`. For example, a project that needs `refresh` adds it:
600
+
601
+ ```json
602
+ {
603
+ "targets": {
604
+ "refresh": {
605
+ "command": ": \"${TF_ENCRYPTION_PASSPHRASE:?TF_ENCRYPTION_PASSPHRASE missing}\" && TF_VAR_tf_encryption_passphrase=\"$TF_ENCRYPTION_PASSPHRASE\" tofu refresh",
606
+ "options": { "cwd": "{projectRoot}/src/environments/production" }
607
+ }
608
+ }
609
+ }
610
+ ```
611
+
612
+ ### Migrate a workspace to the opentofu area
613
+
614
+ 1. Add `@zukhruf/nx/opentofu` to `plugins` in `nx.json`, after `@zukhruf/nx/format`.
615
+ 2. Delete the targets that the plugin now gives from each OpenTofu project: `init`, `format`, `format:check`, `typecheck`, `preview`, `show` and `output`. Delete `plan`, `validate` and `apply`.
616
+ 3. Delete `scripts/check-plan-fresh.sh`.
617
+ 4. Move the secrets with a different name to `TF_VAR_<name>` in `<projectRoot>/.env`, for example `TF_VAR_dokploy_api_key=${DOKPLOY_API_KEY}` and, for authx, `TF_VAR_otlp_headers=${AUTHX_OTLP_HEADERS}`.
618
+ 5. Move a template that the configuration reads into the project root, for example `apps/v2/compose.dokploy.yml`.
619
+ 6. Run `nx run <project>:typecheck`. If it stops with "Provider dependency changes detected", run `nx run <project>:init` and commit the lock file.
620
+ 7. Compare `nx show project <project> --json` before and after.
621
+
622
+ | Workspace | Projects | Changes |
623
+ | ------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
624
+ | whatisgoingon | `infra` | `TF_VAR_dokploy_api_key` in `infra/.env`; `preview` no longer runs `typecheck` first, because `plan` validates the configuration |
625
+ | text2sql | `v2-terraform`, `authx-terraform`, `desktop-terraform`, `diagnostics-terraform` | `init` no longer depends on `typecheck`; the compose files of v2 and authx move into the project roots; authx keeps its 2 environments as configurations |
626
+
627
+ ### Who uses the opentofu area
628
+
629
+ | Workspace | Backlog item |
630
+ | ------------- | ------------ |
631
+ | whatisgoingon | #4612 |
632
+ | text2sql | #4613 |
633
+ | meddit | #4608 |
634
+
635
+ The backlog item of the area is #3339.
636
+
637
+ ## prisma
638
+
639
+ > Status: shipped (#3339).
640
+
641
+ Six projects in two workspaces run Prisma through Nx: `@factory/db` of factory, and five projects of text2sql (`v2-db`, `authx-db`, `desktop-db`, `db` and `@workspace/amail`). Each one copies a cached `generate` target, and five also copy the migrate targets. The `prisma` area is an Nx inference plugin. It gives the Prisma targets to each project with a `prisma.config.ts`. You list the plugin one time in `nx.json`.
642
+
643
+ ### Use the prisma area
644
+
645
+ You need Nx 23.2.1 or later, and `prisma` and `@prisma/client` in the lockfile. Add the plugin to `plugins` in `nx.json`. Then add `generate` to the `dependsOn` of `typecheck` and `build` in `targetDefaults`:
646
+
647
+ ```jsonc
648
+ {
649
+ "plugins": ["@zukhruf/nx/prisma"],
650
+ "targetDefaults": {
651
+ "typecheck": {
652
+ "dependsOn": ["lint", "format:check", "generate", "..."],
653
+ },
654
+ "build": {
655
+ "dependsOn": ["generate", "..."],
656
+ },
657
+ },
658
+ }
659
+ ```
660
+
661
+ Keep the entries that are already in the lists. Nx skips a `dependsOn` on a target that the project does not have, so a project with no Prisma is not changed. The plugin does not change `typecheck` or `build`. Those targets belong to other plugins, as for `format:check` ([ADR 0001](./docs/adr/0001-inferred-targets-not-copied-defaults.md)). The `typecheck:generate` tag of text2sql is then not necessary. See [ADR 0008](./docs/adr/0008-prisma-targets-from-prisma-config-with-outputs-from-the-schema.md).
662
+
663
+ ### Signature of the prisma area
664
+
665
+ ```ts
666
+ // @zukhruf/nx/prisma
667
+ export const createNodes: CreateNodes;
668
+ ```
669
+
670
+ The plugin takes no options. The commands are the same in each copy. The output folder of `generate` is different in each project, and the schema already gives it.
671
+
672
+ ### Which projects get the Prisma targets
673
+
674
+ A project root gets the Prisma targets when it has a `prisma.config.ts` directly in it. Prisma 7 reads its config from that file. The project roots are the same as for the other areas (see [ADR 0003](./docs/adr/0003-which-roots-get-targets.md)). The plugin also reads the `*.prisma` files of the project. A `*.prisma` file belongs to its nearest project root.
675
+
676
+ ### What each Prisma target runs
677
+
678
+ Each target runs in `{projectRoot}`.
679
+
680
+ | Target | Command | Cached | Depends on |
681
+ | ---------- | ----------------------- | ------ | ---------- |
682
+ | `generate` | `prisma generate` | yes | — |
683
+ | `migrate` | `prisma migrate dev` | no | `generate` |
684
+ | `deploy` | `prisma migrate deploy` | no | — |
685
+ | `reset` | `prisma migrate reset` | no | — |
686
+ | `pull` | `prisma db pull` | no | — |
687
+
688
+ - The inputs of `generate` are `{projectRoot}/**/*.prisma`, `{projectRoot}/prisma.config.ts`, and the packages `prisma` and `@prisma/client` (`externalDependencies`). Thus a new model file in `models/` runs `generate` again, and an update of Prisma does too. The copies had the whole `package-lock.json` as an input, so each update of any package ran `generate` again.
689
+ - The outputs of `generate` are the `output` folders of the `generator` blocks in the `*.prisma` files of the project. A path is relative to the file of its block, as Prisma reads it. For example, `output = "src/prisma"` in `schema.prisma` gives `{projectRoot}/src/prisma`. Nx restores these folders from the cache.
690
+ - When a `generator` block has no `output`, Prisma writes into `node_modules`. The plugin then gives `generate` with no cache, because Nx cannot restore that folder.
691
+ - `migrate`, `reset` and `pull` change the database or the schema. Run them on purpose. No target depends on them.
692
+ - Prisma reads the connection string. `prisma.config.ts` reads it from the environment, and Nx loads the `.env` file of the project root for each task.
693
+
694
+ text2sql also has a target `prisma` that runs the Prisma CLI with the arguments that you give. It stays in each project that wants it.
695
+
696
+ ### Migrate a workspace to the prisma area
697
+
698
+ 1. Add `@zukhruf/nx/prisma` to `plugins` in `nx.json`.
699
+ 2. Add `generate` to `targetDefaults.typecheck.dependsOn` and `targetDefaults.build.dependsOn`.
700
+ 3. Delete `generate`, `migrate`, `deploy`, `reset` and `pull` from each Prisma project, and the `typecheck` entry that only adds `generate`.
701
+ 4. Delete the `typecheck:generate` tag and its `targetDefaults` filter.
702
+ 5. Compare `nx show project <project> --json` before and after.
703
+
704
+ | Workspace | Projects | Changes |
705
+ | --------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
706
+ | factory | `@factory/db` | the project gets `reset` and `pull`; `build` gets `generate` from `targetDefaults` |
707
+ | text2sql | `v2-db`, `authx-db`, `desktop-db`, `db` | `migrate` depends on `generate`, not on `build`; `desktop-db` gets `deploy`; `bundle` keeps its own `dependsOn` on `generate` |
708
+ | text2sql | `@workspace/amail` (`tools/playground/amail`) | it has a `prisma.config.ts`, so it gets the targets too; its `generate` in `package.json` goes; the output is `prisma/client` |
709
+
710
+ ### Who uses the prisma area
711
+
712
+ | Workspace | Backlog item |
713
+ | --------- | ------------ |
714
+ | factory | #4611 |
715
+ | text2sql | #4613 |
716
+ | meddit | #4607 |
717
+
718
+ The backlog item of the area is #3339.
719
+
720
+ ## generators
721
+
722
+ The root files of a workspace are the same in each repo: `package.json`, `nx.json`, the tsconfig files, `.npmrc`, the Git hooks and more (whatisgoingon `docs/monorepo-standard.md` §1–8). factory writes them with the `workspace` generator of its private package `@factory/foundation`. Other repos copy them by hand: 3 to 7 copies of each file. meddit is the third repo that starts from the standard, so the generator moves here (#3259).
723
+
724
+ The package gives two Nx generators:
725
+
726
+ - `preset` starts a repo. `create-nx-workspace` runs it.
727
+ - `init` adds the root files of the standard to an Nx workspace. It is safe to run again. `nx add @zukhruf/nx` runs it.
728
+
729
+ The generators write only the root files that each repo needs. The wiring of one kind of app (Hono, React, Vite, Tailwind, Vitest) comes from the app generators `node-app`, `react-app`, `pair` and `ui-package` (#3338).
730
+
731
+ ### Start a repo in a new folder
732
+
733
+ ```sh
734
+ npx create-nx-workspace@latest <name> --preset=@zukhruf/nx --pm=npm --nxCloud=skip --aiAgents=none
735
+ ```
736
+
737
+ The name is the folder name, and the scope of the workspace. `acme` gives the folder `acme` and the root package `@acme/source`.
738
+
739
+ ### Start a repo in an empty Git repo
740
+
741
+ Give `.` as the name, in the folder of the repo:
742
+
743
+ ```sh
744
+ cd ~/Desktop/mo/meddit
745
+ npx create-nx-workspace@latest . --preset=@zukhruf/nx --pm=npm --nxCloud=skip --aiAgents=none
746
+ ```
747
+
748
+ This is the path for meddit, which has only `.git`. Nx 24 supports it, and no step deletes the folder or `.git`:
749
+
750
+ - `.` gives the name of the current folder, and the parent folder as the working folder (`create-nx-workspace/dist/bin/create-nx-workspace.js:612-617`, 24.0.6). The folder must exist, so the "directory exists" check does not apply (`:646-660`).
751
+ - `nx new` then gets `skipEmptyDirCheck`, so it writes into a folder that is not empty (`create-nx-workspace/dist/src/create-empty-workspace.js:31-37`; the check is at `@nx/workspace/dist/src/generators/new/new.js:68-73`).
752
+ - An Nx generator writes files through a `Tree`. It never removes a folder that it did not write, so `.git` stays.
753
+ - In a folder that is already a Git work tree, create-nx-workspace runs no `git init`, no `git add` and no commit (`create-nx-workspace/dist/src/utils/git/git.js:141-149`). The first commit is yours.
754
+
755
+ A smoke test on 2026-11-18 ran this command with the `@zukhruf/nx` preset in a folder with only `git init` (see [Test the preset before a release](#test-the-preset-before-a-release)). The folder and `.git` stayed, `git log` showed no commit, `git status` showed each file as new, `core.hooksPath` was `.husky`, and the first commit passed the hooks. The preset `npm` behaves differently: create-nx-workspace maps it to the template flow for an agent (`bin/create-nx-workspace.js:362-380`), and that flow amends the README and can leave an `error.log` (`create-workspace.js:269-288`).
756
+
757
+ Two other seams do not work for an empty repo:
758
+
759
+ - `nx g @zukhruf/nx:init` needs a workspace. With no `nx.json`, Nx prints "The current directory isn't part of an Nx workspace" and stops with exit code 1 (`nx/dist/bin/nx.js:63`, `:108-110`, `:151-167`).
760
+ - `nx init` in a folder with no `package.json` sets up Nx for a repo that is not JavaScript: a `.nx/installation` folder and an `nx` wrapper script (`nx/dist/src/command-line/init/init-v2.js:137-141`). That is not an npm workspace.
761
+
762
+ The flags:
763
+
764
+ | Flag | Why |
765
+ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
766
+ | `--pm=npm` | The standard uses npm workspaces only. The preset stops with an error for another package manager. |
767
+ | `--nxCloud=skip` | No repo uses Nx Cloud. |
768
+ | `--aiAgents=none` | Without it, create-nx-workspace detects the agent and writes `AGENTS.md`, `CLAUDE.md`, `.claude/settings.json` and more before the preset runs (`@nx/workspace/dist/src/generators/new/generate-workspace-files.js:146-153`). |
769
+
770
+ In a terminal, create-nx-workspace asks you to trust the third-party preset. An agent or CI run does not ask (`create-nx-workspace/dist/src/internal-utils/prompts.js:194-208`).
771
+
772
+ ### What create-nx-workspace runs
773
+
774
+ For a preset from npm, create-nx-workspace runs these steps in order:
775
+
776
+ 1. It installs `nx` and `@nx/workspace` at its own version in a temporary folder (`create-nx-workspace/dist/src/create-sandbox.js:18-29`).
777
+ 2. It runs `nx new` there. `nx new` writes `package.json`, `nx.json`, `.gitignore`, `.editorconfig`, `.vscode/extensions.json` and `README.md`, adds `@zukhruf/nx` to `dependencies`, and runs `npm install` (`@nx/workspace/dist/src/generators/new/new.js:12-35`, `generate-workspace-files.js:119-176`, `generate-preset.js:271-276`). The root `package.json` gets `nx` and `@nx/workspace` at the version of create-nx-workspace, and a `packageManager` key (`generate-workspace-files.js:132-135`).
778
+ 3. It runs `nx g @zukhruf/nx:preset` in the new folder, with the options of the command line (`create-nx-workspace/dist/src/create-preset.js:8-38`).
779
+ 4. It runs `nx format --all` when the workspace has a formatter (`create-nx-workspace/dist/src/create-workspace.js:158-196`).
780
+ 5. It runs `git init` and the first commit, but only when the folder is not a Git work tree (step 4 of the list above).
781
+
782
+ `NX_SKIP_FORMAT=true` is set from step 2 to step 3 (`create-workspace.js:36-41`), so the `formatFiles` of the preset does nothing there (`@nx/devkit/dist/src/generators/format-files.js:40-44`). Step 4 formats all the files with the `.prettierrc` that the preset wrote.
783
+
784
+ ### Add the standard to an Nx workspace
785
+
786
+ ```sh
787
+ npx nx add @zukhruf/nx
788
+ ```
789
+
790
+ `nx add` installs the package and runs its `init` generator (`nx/dist/src/command-line/init/configure-plugins.js:61-87`, 24.0.6). When the package is already installed, run the generator itself:
791
+
792
+ ```sh
793
+ npx nx g @zukhruf/nx:init
794
+ ```
795
+
796
+ Run it in a workspace that has `nx.json` and `@zukhruf/nx`. It writes each missing root file and each missing key. It keeps what is there. A second run changes nothing.
797
+
798
+ ### Signature of the generators
799
+
800
+ ```jsonc
801
+ // packages/nx/generators.json, named by "generators" in package.json
802
+ {
803
+ "generators": {
804
+ "preset": {
805
+ "implementation": "./dist/generators/preset/generator.js",
806
+ "schema": "./src/generators/preset/schema.json",
807
+ "description": "Start a repo of the monorepo standard. create-nx-workspace runs it.",
808
+ },
809
+ "init": {
810
+ "implementation": "./dist/generators/init/generator.js",
811
+ "schema": "./src/generators/init/schema.json",
812
+ "description": "Add the root files of the monorepo standard. Safe to run again.",
813
+ },
814
+ },
815
+ }
816
+ ```
817
+
818
+ ```ts
819
+ // @zukhruf/nx:preset
820
+ interface PresetOptions {
821
+ name: string; // the folder name, from create-nx-workspace
822
+ packageManager?: string; // anything other than 'npm' is an error
823
+ }
824
+
825
+ // @zukhruf/nx:init
826
+ type InitOptions = Record<string, never>;
827
+ ```
828
+
829
+ - The schema of `preset` does not set `additionalProperties: false`. create-nx-workspace passes each option of its command line to the preset, for example `preset`, `defaultBase`, `workspaces` and `aiAgents` (`create-preset.js:9-17`). Nx stops with "'x' is not found in schema" only when the schema sets `additionalProperties: false` (`nx/dist/src/utils/params.js:175-185`). The preset reads `name` and `packageManager`, and ignores the others.
830
+ - `package.json` gets `"generators": "./generators.json"`, and `files` adds `generators.json` and `src/generators/*/schema.json`. `tsc` builds only `.ts` files, so the content of each file that a generator writes is a string in a `.ts` module, not a file in a `files/` folder. Then `dist` has it, and no build step copies assets.
831
+ - `init` takes no options, as `format` and `lint` take none. The workspace scope comes from the root package name (see [The workspace scope](#the-workspace-scope)). Each difference between the copies is the wiring of one kind of app, and the app generators own it.
832
+
833
+ ### What the generators write
834
+
835
+ `init` writes a file in one of three ways:
836
+
837
+ - **Create**: it writes the file only when it is missing, and never changes it later.
838
+ - **Add lines**: it adds each missing line, and never removes or reorders a line.
839
+ - **Merge keys**: it sets the keys that the standard owns, and keeps the other keys.
840
+
841
+ `preset` runs just after `nx new`, so it knows that each file in the folder came from `nx new`. It replaces 4 files of `nx new` with the files of the standard, and it cleans `package.json`. It deletes `apps/.gitkeep` and `libs/.gitkeep`, which `nx g` writes into the `Tree` before it calls a generator named `preset` (`nx/dist/src/command-line/generate/generate.js:250-253`). Then it runs `init`.
842
+
843
+ | File | Content | `init` | `preset` |
844
+ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
845
+ | `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` |
846
+ | `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 | — |
847
+ | `tsconfig.base.json` | the base for bundled apps of §3, with `noUncheckedIndexedAccess` | create | — |
848
+ | `tsconfig.json` | the solution file: `extends` the base, `files: []`, `references: []`; `nx sync` writes the references | create | — |
849
+ | `.npmrc` | `legacy-peer-deps=false`, `save-exact=true`, `strict-allow-scripts=true` | add lines | — |
850
+ | `.nvmrc` | `lts/*` | create | — |
851
+ | `.gitattributes` | `* text=auto eol=lf` | create | — |
852
+ | `.editorconfig` | utf-8, lf, a final newline, 2 spaces, trim trailing whitespace except in `*.md` | create | replaces the file of `nx new` |
853
+ | `.gitignore` | the lines of §2 | add lines | replaces the file of `nx new` |
854
+ | `.prettierrc` | the config of §5, with `^@<scope>/(.*)$` in `importOrder` and no Tailwind plugin | create | — |
855
+ | `.prettierignore` | the lines of §2 | add lines | — |
856
+ | `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` and `nx-project-json` configs of `@zukhruf/eslint`; `manifest.configs.recommended`; Modern Node for the config files and `.husky/*.ts`; `allowDefaultProject` for `*.config.ts` and `.husky/*.ts` | create | — |
857
+ | `.husky/pre-commit.ts`, `pre-push.ts`, `commit-msg.ts` | the hooks of §7 with the steps of `@zukhruf/git-hooks`; mode `755` | create | — |
858
+ | `.husky/pre-commit`, `pre-push`, `commit-msg` | a link to the `.ts` file of the same name | create | — |
859
+ | `.vscode/settings.json` | file nesting, watcher and search excludes for `node_modules`, `.nx`, `tmp` | create | — |
860
+ | `.vscode/extensions.json` | `nrwl.angular-console`, `esbenp.prettier-vscode`, `dbaeumer.vscode-eslint` | create | replaces the file of `nx new` |
861
+ | `AGENTS.md`, `CLAUDE.md` | `AGENTS.md` holds the commands of §13; `CLAUDE.md` is one line, `@AGENTS.md` | create | — |
862
+ | `README.md` | `# <name>` and a link to `AGENTS.md` | — | replaces the file of `nx new` |
863
+
864
+ The `targetDefaults` that `init` writes:
865
+
866
+ | Target | Default |
867
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
868
+ | `typecheck` | `dependsOn: ["lint", "format:check", "..."]`; `"..."` keeps the `^typecheck` of `@nx/js/typescript` |
869
+ | `dev`, `serve`, `preview`, `serve-static` | `continuous: false`; Nx reports a continuous task that no task depends on as a success, whatever its exit code |
870
+
871
+ It writes no `format`, `format:check`, `lint` or `test` default. The `format`, `lint` and `test` areas give those targets, and a default would replace them (see the sections above).
872
+
873
+ ### What only an app generator writes
874
+
875
+ A root file holds no wiring of one kind of app. A pattern that matches no file is not wiring: the root `.gitignore`, `.prettierignore` and ESLint `ignores` keep `.sdk-it` and the Vite timestamp files, and the first two `importOrder` entries (`./env`, `./startup`) stay in `.prettierrc`.
876
+
877
+ | Wiring | Generator |
878
+ | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
879
+ | `@nx/node` and `@nx/esbuild`; the `@nx/esbuild:esbuild` target default; `generators["@nx/node"]` | `node-app` (#3338) |
880
+ | `^sdk` in `build`, `dev`, `typecheck` and `test`; `!{projectRoot}/sdk-it.config.*` in `production` | `node-app` (#3338) |
881
+ | the `hono` config of `@zukhruf/eslint` and the `env` settings, in the project's own `eslint.config.mjs` | `node-app` (#3338) |
882
+ | `Dockerfile`, `.dockerignore`, `esbuild: true` in `allowScripts` | `node-app` (#3338) |
883
+ | `@nx/react`, `@nx/vite`, `@nx/vitest`, Vite, Vitest, Testing Library, happy-dom; `generators["@nx/react"]` | `react-app` (#3338) |
884
+ | `@zukhruf/eslint/react` and its 3 optional peers; the `react-router` and `tailwind` configs, in the project config | `react-app` (#3338) |
885
+ | Tailwind, `prettier-plugin-tailwindcss` in `.prettierrc` `plugins`, the Tailwind sync generator in `sync` and in `build`, `dev`, `serve` | `react-app` (#3338) |
886
+ | `allowDefaultProject` for `sdk-it.config.ts` and `prisma.config.ts`, in the project config | `node-app`, `prisma` (#4604) |
887
+
888
+ 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.
889
+
890
+ ### Versions that the generators write
891
+
892
+ - **The Nx family has one exact version.** `init` sets the root `nx` and each root `@nx/*` to `nxVersion`, also when the version is already there and is another one, a newer one included. Then npm installs one `nx` (#4532). An app generator adds its `@nx/*` packages at the same `nxVersion`. A test checks that the root `nx` equals `nxVersion` after `preset`, and that no root `@nx/*` has another version.
893
+ - **A missing `@zukhruf/*` package gets the version of `@zukhruf/nx` itself.** nx release gives each public package of zukhruf the same version, so the generator reads its own `package.json` and writes no list of versions. A version that is already there stays, for example a `file:` tarball in a smoke test.
894
+ - **The other root tools have exact versions** from one module, `src/generators/versions.ts`, that the app generators share: TypeScript 7 as `@typescript/native: "npm:typescript@7.x"` and the TypeScript 6 API as `typescript: "npm:@typescript/typescript6@6.x"` (§1), ESLint 10, Prettier 3, `@trivago/prettier-plugin-sort-imports`, and the peers of `@zukhruf/eslint` that the root config loads. `init` adds a missing package at that version, and keeps a version that is already there.
895
+ - **`allowScripts`** names each install script of a package that the generator installs: `nx: false` and `unrs-resolver: false`. `init` adds a missing name, and keeps a decision that is already there. The smoke test of 2026-11-18 proved the list: `npm install` with `strict-allow-scripts=true` passed.
896
+
897
+ ### The workspace scope
898
+
899
+ The root package name is `@<scope>/source`. `nx new` writes it from the folder name (`@nx/workspace/dist/src/generators/new/files-integrated-repo/package.json__tmpl__`). One function reads the scope from that name, and each generator calls it: the `importOrder` of `.prettierrc` here, and the name of a generated client (`@<scope>/<app>-client`) and the portless domain in `node-app` (#3338). That is 3 places (#4080). The function stops with an error when the name has no scope. A generator never writes a fallback scope, so no repo gets the scope of another repo (factory falls back to `@factory`).
900
+
901
+ ### Install the dependencies and the hook links
902
+
903
+ A generator returns its install as a callback. Nx runs the callback after it writes the files, and not in a dry run.
904
+
905
+ - Both generators return `runTasksInSerial(installPackagesTask(tree), linkHooks)` (`@nx/devkit/dist/src/generators/run-tasks-in-serial.js:9-15`, `@nx/devkit/dist/src/tasks/install-packages-task.js:15-42`). `installPackagesTask` runs `npm install` only when the generator changed `package.json`, so a second run of `init` installs nothing.
906
+ - After `preset`, `nx format --all` of create-nx-workspace finds Prettier and the sort-imports plugin installed.
907
+
908
+ The `Tree` keeps a file mode, but it has no links:
909
+
910
+ - **Mode.** The generator calls `tree.changePermissions('.husky/<hook>.ts', '755')` after `formatFiles`. `formatFiles` writes each file again with no options, so a mode set before it is lost (`@nx/devkit/dist/src/generators/format-files.js:119`; `nx/dist/src/generators/tree.js:45-68`). Nx applies the mode when it writes the file (`tree.js:185-211`, `:279-292`).
911
+ - **Links.** Git runs `.husky/pre-commit`, so `.husky/pre-commit` is a link to `pre-commit.ts`. The `Tree` cannot write a link, so the callback writes each missing link with `fs.symlink`.
912
+
913
+ `prepare` sets `core.hooksPath` when npm installs. In an empty Git repo, the install of the preset runs it. In a new folder, `git init` comes after the install, so the first `npm install` after create-nx-workspace sets it.
914
+
915
+ ### What the generators do not do
916
+
917
+ - **They do not write CI, deploy or infra files.** The `dokploy` generator writes them (#4603).
918
+ - **They do not write a NodeNext base.** The base is the one for bundled apps (§3). zukhruf and elt run code from source with NodeNext, and they do not use the generators.
919
+ - **They do not change an ESLint config that is already there.** factory splices the configs of `@zukhruf/eslint` into an existing `eslint.config.mjs`. No consumer needs that now: the generator writes the file in a new repo, and factory and whatisgoingon already have their config.
920
+ - **They do not commit.** create-nx-workspace commits only in a new folder. In an existing repo, you make the first commit.
921
+ - **They do not delete a file or a folder** that the standard does not own. Only `preset` deletes, and only what `nx new` and `nx g` wrote a moment before: keys of `package.json`, `apps/.gitkeep` and `libs/.gitkeep`.
922
+
923
+ ### What stays in factory
924
+
925
+ - The brand: the `@factory` scope fallback, the fonts, colors and favicons (#3338).
926
+ - The mirror tests `tests/workspace-mirror.test.ts` and `tests/templates-mirror.test.ts`. They prove that factory's own root files equal the output of the generator. factory keeps them, and calls `@zukhruf/nx:init` (#4611).
927
+ - `--test-force-exit` for each project: factory sets it in the options of `@zukhruf/nx/test`. The standard adds it only for the tag `test:docker` (§8), so `init` writes the plugin with no options.
928
+
929
+ ### Tests of the generators
930
+
931
+ The tests use a virtual `Tree` from `createTreeWithEmptyWorkspace` of `@nx/devkit/testing`, as the tests of `@factory/foundation` do (`src/generators/init/generator.test.ts`, `src/generators/preset/generator.test.ts`). They port these tests of `tools/foundation/tests/workspace.test.ts`: the scope in `importOrder`, the full baseline, a second run that changes nothing, `targetDefaults` that are already there, and a `.prettierrc` that is already there. They drop the test of an ESLint config with a multi-line import, because `init` does not change an existing config. New tests:
932
+
933
+ - `preset` on the files of `nx new`: the result has no `packageManager`, no `apps/.gitkeep` and no `libs/.gitkeep`, `@zukhruf/nx` is in `devDependencies`, and the root `nx` and each `@nx/*` equal `nxVersion` (#4532).
934
+ - `preset` with `packageManager: 'pnpm'` stops with an error.
935
+ - `init` on a root package name with no scope stops with an error.
936
+ - `init` sets a newer `nx` and `@nx/*` down to `nxVersion`, and keeps the version of another root tool.
937
+ - Each hook that `init` creates has the mode `755`.
938
+ - The backend-neutral output: no React, Vite, Vitest or Tailwind package in `package.json`, and no app wiring in `nx.json`.
939
+
940
+ ### Test the preset before a release
941
+
942
+ create-nx-workspace takes the version of a third-party preset from `NX_E2E_PRESET_VERSION` when it is set (`@nx/workspace/dist/src/generators/new/new.js:114-118`). So the preset runs from a tarball of the checkout, before a release:
943
+
944
+ ```sh
945
+ npx nx run nx:build
946
+ (cd packages/nx && npm pack --pack-destination <scratch>)
947
+ mkdir <scratch>/acme && cd <scratch>/acme && git init
948
+ NX_E2E_PRESET_VERSION=file:<scratch>/zukhruf-nx-<version>.tgz \
949
+ npx create-nx-workspace@latest . --preset=@zukhruf/nx --pm=npm --nxCloud=skip --aiAgents=none
950
+ ```
951
+
952
+ Then check that `npm install` passes, that `npx nx run-many -t typecheck` and `npx nx run-many -t lint` pass, and that the first `git commit` passes the hooks. Delete the folder at the end. On 2026-11-18 both paths passed: a new folder (`acme`), and a folder with only `git init` (`.`). In the new folder, a demo package also passed `typecheck` (TypeScript 7.0.2) and `lint`, and its commit passed each hook. A second run of `npx nx g @zukhruf/nx:init` in the generated repo changed no file.
953
+
954
+ The decisions are in [ADR 0009](./docs/adr/0009-a-preset-and-an-init-generator-start-a-repo-from-nothing.md). The backlog item of the generators is #3337.
@@ -0,0 +1,81 @@
1
+ export declare const gitignore = "# Dependencies and Nx state\nnode_modules/\n.nx/\n\n# Build and test output\ndist/\nout-tsc/\ncoverage/\ntest-results.xml\n*.tsbuildinfo\nvite.config.*.timestamp*\nvitest.config.*.timestamp*\n\n# Generated sdk-it clients: only the committed stubs stay\n**/.sdk-it/*\n!**/.sdk-it/package.json\n!**/.sdk-it/tsconfig.json\n\n# Local configuration\n.env*\n!.env.example\n\n# Editors and operating systems\n.DS_Store\n.idea/\n.vscode/*\n!.vscode/extensions.json\n!.vscode/settings.json\n";
2
+ export declare const prettierignore = "node_modules\n.nx\ncoverage\ndist\nout-tsc\npackage-lock.json\n*.tsbuildinfo\n.sdk-it\n";
3
+ export declare const npmrc = "legacy-peer-deps=false\nsave-exact=true\nstrict-allow-scripts=true\n";
4
+ export declare const nvmrc = "lts/*\n";
5
+ export declare const gitattributes = "* text=auto eol=lf\n";
6
+ export declare const editorconfig = "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n";
7
+ export declare const tsconfigBase: {
8
+ compilerOptions: {
9
+ allowImportingTsExtensions: boolean;
10
+ composite: boolean;
11
+ declaration: boolean;
12
+ declarationMap: boolean;
13
+ emitDeclarationOnly: boolean;
14
+ erasableSyntaxOnly: boolean;
15
+ forceConsistentCasingInFileNames: boolean;
16
+ importHelpers: boolean;
17
+ isolatedModules: boolean;
18
+ lib: string[];
19
+ module: string;
20
+ moduleResolution: string;
21
+ noEmitOnError: boolean;
22
+ noFallthroughCasesInSwitch: boolean;
23
+ noImplicitOverride: boolean;
24
+ noImplicitReturns: boolean;
25
+ noUncheckedIndexedAccess: boolean;
26
+ skipLibCheck: boolean;
27
+ strict: boolean;
28
+ target: string;
29
+ useUnknownInCatchVariables: boolean;
30
+ verbatimModuleSyntax: boolean;
31
+ };
32
+ };
33
+ export declare const tsconfigSolution: {
34
+ extends: string;
35
+ compileOnSave: boolean;
36
+ files: never[];
37
+ references: never[];
38
+ };
39
+ export declare function prettierrc(scope: string): {
40
+ singleQuote: boolean;
41
+ importOrder: string[];
42
+ plugins: string[];
43
+ importOrderSeparation: boolean;
44
+ importOrderSortSpecifiers: boolean;
45
+ overrides: {
46
+ files: string[];
47
+ options: {
48
+ singleQuote: boolean;
49
+ };
50
+ }[];
51
+ };
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 ...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 // Files that no tsconfig includes get the default project of typed lint,\n // not a parse error. typescript-eslint refuses '**' here.\n {\n files: ['**/*.ts'],\n languageOptions: {\n parserOptions: {\n projectService: {\n allowDefaultProject: ['*.config.ts', '.husky/*.ts'],\n },\n },\n },\n },\n];\n";
53
+ /** The Git hooks, each in TypeScript. `.husky/<name>` is a link to `.husky/<name>.ts`. */
54
+ export declare const hooks: Record<string, string>;
55
+ export declare const vscodeSettings: {
56
+ 'explorer.fileNesting.enabled': boolean;
57
+ 'explorer.fileNesting.expand': boolean;
58
+ 'explorer.fileNesting.patterns': {
59
+ 'tsconfig.base.json': string;
60
+ 'tsconfig.json': string;
61
+ };
62
+ 'files.watcherExclude': {
63
+ '**/node_modules/**': boolean;
64
+ '**/.nx/**': boolean;
65
+ '**/tmp/**': boolean;
66
+ '**/.git/objects/**': boolean;
67
+ '**/.git/subtree-cache/**': boolean;
68
+ };
69
+ 'search.exclude': {
70
+ '**/node_modules': boolean;
71
+ '**/.nx': boolean;
72
+ '**/tmp': boolean;
73
+ };
74
+ };
75
+ export declare const vscodeExtensions: {
76
+ recommendations: string[];
77
+ };
78
+ export declare const agents = "# Agents\n\nNx monorepo on npm workspaces. Runnable products are in `apps/`, shared modules in `packages/`, and repo tools in `tools/`.\n\n## Commands\n\n- Run each command through an Nx target, from the workspace root: `npx nx run <project>:<target>`.\n- `npx nx run <project>:typecheck` runs `lint`, `format:check`, then `tsc`. Never run raw `tsc`.\n- `npx nx run <project>:test` builds the dependencies first.\n- A check changes no file. `npx nx run <project>:format` writes the files.\n- Read `npx nx show project <project> --json` before you say that a target exists. Most targets are inferred, so no file lists them.\n- In zsh, quote a task name in a variable (`\"${p}:lint\"`): `:l` and `:t` are modifiers.\n- When Nx stops with an error that you do not expect, run it again with the output in a file: `NX_DAEMON=false npx nx \u2026 > log 2>&1; echo $?`.\n";
79
+ export declare const claude = "@AGENTS.md\n";
80
+ export declare function readme(name: string): string;
81
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;;;EAuBvC;AAED,eAAO,MAAM,YAAY,8lEAqExB,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4CxC,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAmB1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAM5B,CAAC;AAEF,eAAO,MAAM,MAAM,o2BAalB,CAAC;AAEF,eAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C"}