@smoothbricks/nx-plugin 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1086 -360
- package/dist/.build-inputs.json +138 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +13 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +126 -47
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +54 -119
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +371 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +81 -28
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +68 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +40 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +88 -19
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +164 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +672 -214
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +75 -48
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +16 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +77 -13
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +132 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool.ts +51 -117
- package/src/executors/bounded-exec/executor.ts +423 -259
- package/src/executors/bounded-exec/gateway-lease.ts +82 -33
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +89 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +137 -34
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/executor.ts +205 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +788 -224
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +68 -45
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +122 -98
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/all-verdicts/executor.test.ts +0 -135
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3321
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
|
@@ -1,737 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { dirname, join } from 'node:path';
|
|
5
|
-
|
|
6
|
-
import { readJson, writeJson } from 'nx/src/devkit-exports.js';
|
|
7
|
-
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports.js';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
applyWorkspaceConfig,
|
|
11
|
-
applyWorkspaceConfigPolicy,
|
|
12
|
-
applyWorkspaceConfigTree,
|
|
13
|
-
BUILD_OUTPUT_DEPENDENCIES,
|
|
14
|
-
checkWorkspaceConfig,
|
|
15
|
-
checkWorkspaceConfigPolicy,
|
|
16
|
-
checkWorkspaceConfigTree,
|
|
17
|
-
LINUX_PLATFORM_TARGET_GLOBS,
|
|
18
|
-
MACOS_PLATFORM_TARGET_GLOBS,
|
|
19
|
-
PLATFORM_TARGET_GLOBS,
|
|
20
|
-
} from './workspace-config-policy.js';
|
|
21
|
-
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// Helpers
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
function validNxJson(): Record<string, unknown> {
|
|
27
|
-
return {
|
|
28
|
-
cacheDirectory: '.nx/cache',
|
|
29
|
-
plugins: ['@smoothbricks/nx-plugin'],
|
|
30
|
-
sync: { globalGenerators: ['@smoothbricks/nx-plugin:managed-files'] },
|
|
31
|
-
targetDefaults: validTargetDefaults(),
|
|
32
|
-
namedInputs: validNamedInputs(),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function validTargetDefaults(): Record<string, unknown> {
|
|
37
|
-
return {
|
|
38
|
-
build: { cache: true },
|
|
39
|
-
clean: { executor: '@smoothbricks/nx-plugin:clean-outputs', cache: false },
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const MARKDOWN = '!{projectRoot}/**/*.md';
|
|
44
|
-
|
|
45
|
-
function validNamedInputs(): Record<string, unknown> {
|
|
46
|
-
return {
|
|
47
|
-
default: ['{projectRoot}/**/*', MARKDOWN],
|
|
48
|
-
production: [
|
|
49
|
-
'{projectRoot}/src/**/*',
|
|
50
|
-
'{projectRoot}/package.json',
|
|
51
|
-
'!{projectRoot}/**/__tests__/**',
|
|
52
|
-
'!{projectRoot}/**/*.test.*',
|
|
53
|
-
'!{projectRoot}/**/*.spec.*',
|
|
54
|
-
MARKDOWN,
|
|
55
|
-
],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function validPlugins(): unknown[] {
|
|
60
|
-
return ['@smoothbricks/nx-plugin'];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
// Layer 1: Pure core function tests
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
describe('target family conventions', () => {
|
|
68
|
-
it('separates platform-only families from ordinary build outputs', () => {
|
|
69
|
-
expect(MACOS_PLATFORM_TARGET_GLOBS).toEqual(['*-macos', '*-ios']);
|
|
70
|
-
expect(LINUX_PLATFORM_TARGET_GLOBS).toEqual(['*-linux']);
|
|
71
|
-
expect(PLATFORM_TARGET_GLOBS).toEqual(['*-macos', '*-ios', '*-linux']);
|
|
72
|
-
expect(BUILD_OUTPUT_DEPENDENCIES).toEqual([
|
|
73
|
-
'*-js',
|
|
74
|
-
'*-web',
|
|
75
|
-
'*-html',
|
|
76
|
-
'*-css',
|
|
77
|
-
'*-android',
|
|
78
|
-
'*-native',
|
|
79
|
-
'*-napi',
|
|
80
|
-
'*-bun',
|
|
81
|
-
'*-wasm',
|
|
82
|
-
]);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe('pure core: checkWorkspaceConfig', () => {
|
|
87
|
-
it('returns no issues for valid config', () => {
|
|
88
|
-
const issues = checkWorkspaceConfig(validNxJson());
|
|
89
|
-
expect(issues).toEqual([]);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('uses nx.json as path in issues', () => {
|
|
93
|
-
const issues = checkWorkspaceConfig({});
|
|
94
|
-
for (const issue of issues) {
|
|
95
|
-
expect(issue.path).toBe('nx.json');
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('detects missing plugins', () => {
|
|
100
|
-
const issues = checkWorkspaceConfig({
|
|
101
|
-
cacheDirectory: '.nx/cache',
|
|
102
|
-
plugins: [],
|
|
103
|
-
targetDefaults: validTargetDefaults(),
|
|
104
|
-
namedInputs: validNamedInputs(),
|
|
105
|
-
});
|
|
106
|
-
expect(issues.length).toBe(1);
|
|
107
|
-
expect(issues.some((i) => i.message.includes('plugins must include @smoothbricks/nx-plugin'))).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('detects colon target defaults', () => {
|
|
111
|
-
const issues = checkWorkspaceConfig({
|
|
112
|
-
...validNxJson(),
|
|
113
|
-
targetDefaults: {
|
|
114
|
-
...validTargetDefaults(),
|
|
115
|
-
'build:wasm': { cache: true },
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
expect(issues.some((i) => i.message.includes('build:wasm'))).toBe(true);
|
|
119
|
-
expect(issues.some((i) => i.message.includes('must not use colon target names'))).toBe(true);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('rejects static test typecheck defaults that override per-project inference', () => {
|
|
123
|
-
const issues = checkWorkspaceConfig({
|
|
124
|
-
...validNxJson(),
|
|
125
|
-
targetDefaults: {
|
|
126
|
-
...validTargetDefaults(),
|
|
127
|
-
'typecheck-tests': {
|
|
128
|
-
dependsOn: ['typecheck'],
|
|
129
|
-
options: { command: 'ttsc -p tsconfig.test.json --noEmit' },
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
expect(
|
|
135
|
-
issues.some((issue) => issue.message.includes('targetDefaults.typecheck-tests must not be configured')),
|
|
136
|
-
).toBe(true);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('detects native TypeScript inference', () => {
|
|
140
|
-
const issues = checkWorkspaceConfig({
|
|
141
|
-
plugins: ['@nx/js/typescript', '@smoothbricks/nx-plugin'],
|
|
142
|
-
targetDefaults: validTargetDefaults(),
|
|
143
|
-
namedInputs: validNamedInputs(),
|
|
144
|
-
});
|
|
145
|
-
expect(issues.some((issue) => issue.message.includes('plugins must not configure @nx/js/typescript'))).toBe(true);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('detects imprecise production inputs', () => {
|
|
149
|
-
const issues = checkWorkspaceConfig({
|
|
150
|
-
plugins: validPlugins(),
|
|
151
|
-
targetDefaults: validTargetDefaults(),
|
|
152
|
-
namedInputs: {
|
|
153
|
-
...validNamedInputs(),
|
|
154
|
-
production: ['default'],
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
expect(issues.some((i) => i.message.includes('enumerate precise production inputs'))).toBe(true);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('detects missing build cache', () => {
|
|
161
|
-
const issues = checkWorkspaceConfig({
|
|
162
|
-
plugins: validPlugins(),
|
|
163
|
-
targetDefaults: {
|
|
164
|
-
build: { cache: false },
|
|
165
|
-
clean: { executor: '@smoothbricks/nx-plugin:clean-outputs', cache: false },
|
|
166
|
-
},
|
|
167
|
-
namedInputs: validNamedInputs(),
|
|
168
|
-
});
|
|
169
|
-
expect(issues.some((i) => i.message.includes('build.cache must be true'))).toBe(true);
|
|
170
|
-
expect(issues.some((i) => i.message.includes('build.outputs'))).toBe(false);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('rejects a build outputs default that would clobber the inferred aggregate', () => {
|
|
174
|
-
const issues = checkWorkspaceConfig({
|
|
175
|
-
plugins: validPlugins(),
|
|
176
|
-
targetDefaults: {
|
|
177
|
-
...validTargetDefaults(),
|
|
178
|
-
build: { cache: true, outputs: ['{projectRoot}/dist'] },
|
|
179
|
-
},
|
|
180
|
-
namedInputs: validNamedInputs(),
|
|
181
|
-
});
|
|
182
|
-
expect(issues.some((i) => i.message.includes('targetDefaults.build.outputs must not be set'))).toBe(true);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it('rejects a build dependsOn default that would clobber the inferred aggregate', () => {
|
|
186
|
-
const issues = checkWorkspaceConfig({
|
|
187
|
-
plugins: validPlugins(),
|
|
188
|
-
targetDefaults: {
|
|
189
|
-
...validTargetDefaults(),
|
|
190
|
-
build: { cache: true, dependsOn: ['^build'] },
|
|
191
|
-
},
|
|
192
|
-
namedInputs: validNamedInputs(),
|
|
193
|
-
});
|
|
194
|
-
expect(issues.some((i) => i.message.includes('targetDefaults.build.dependsOn must not be set'))).toBe(true);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('rejects a test dependsOn default that would clobber inferred cargo-test', () => {
|
|
198
|
-
const issues = checkWorkspaceConfig({
|
|
199
|
-
plugins: validPlugins(),
|
|
200
|
-
targetDefaults: {
|
|
201
|
-
...validTargetDefaults(),
|
|
202
|
-
test: { cache: true, dependsOn: ['^build', 'build'] },
|
|
203
|
-
},
|
|
204
|
-
namedInputs: validNamedInputs(),
|
|
205
|
-
});
|
|
206
|
-
expect(issues.some((i) => i.message.includes('targetDefaults.test.dependsOn must not be set'))).toBe(true);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('accepts absent or custom non-CI shared globals', () => {
|
|
210
|
-
for (const globals of [undefined, [], ['{workspaceRoot}/config/shared.json']]) {
|
|
211
|
-
const nxJson = validNxJson();
|
|
212
|
-
nxJson.namedInputs = {
|
|
213
|
-
...validNamedInputs(),
|
|
214
|
-
...(globals === undefined
|
|
215
|
-
? {}
|
|
216
|
-
: { default: ['{projectRoot}/**/*', 'sharedGlobals', MARKDOWN], sharedGlobals: globals }),
|
|
217
|
-
};
|
|
218
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('rejects CI-only shared globals in default but allows explicit workflow inputs', () => {
|
|
223
|
-
const nxJson = validNxJson();
|
|
224
|
-
nxJson.namedInputs = {
|
|
225
|
-
...validNamedInputs(),
|
|
226
|
-
default: ['{projectRoot}/**/*', 'sharedGlobals'],
|
|
227
|
-
sharedGlobals: ['{workspaceRoot}/.github/workflows/ci.yml'],
|
|
228
|
-
};
|
|
229
|
-
expect(checkWorkspaceConfig(nxJson).some((issue) => issue.message.includes('CI-only sharedGlobals'))).toBe(true);
|
|
230
|
-
nxJson.namedInputs = {
|
|
231
|
-
...validNamedInputs(),
|
|
232
|
-
sharedGlobals: ['{workspaceRoot}/.github/workflows/ci.yml'],
|
|
233
|
-
};
|
|
234
|
-
nxJson.targetDefaults = { ...validTargetDefaults(), workflowLint: { inputs: ['sharedGlobals'] } };
|
|
235
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it("requires the checkout's own Nx cache directory", () => {
|
|
239
|
-
for (const cacheDirectory of [undefined, '/tmp/nx-cache', '.cache/nx']) {
|
|
240
|
-
const issues = checkWorkspaceConfig({ ...validNxJson(), cacheDirectory });
|
|
241
|
-
expect(issues.map((issue) => issue.message)).toEqual([
|
|
242
|
-
'cacheDirectory must be ".nx/cache". ' +
|
|
243
|
-
"Without it Nx keeps the task cache and its database in a per-user ~/.nx/<id> shared by every checkout, not in the checkout's own .nx.",
|
|
244
|
-
]);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
describe('pure core: applyWorkspaceConfig', () => {
|
|
250
|
-
it("sets the checkout's own Nx cache directory, once", () => {
|
|
251
|
-
for (const cacheDirectory of [undefined, '/tmp/nx-cache']) {
|
|
252
|
-
const nxJson: Record<string, unknown> = { ...validNxJson(), cacheDirectory };
|
|
253
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
254
|
-
expect(nxJson.cacheDirectory).toBe('.nx/cache');
|
|
255
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
256
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
it('removes workspace-wide lint commands while preserving shared cache policy', () => {
|
|
261
|
-
const nxJson = {
|
|
262
|
-
...validNxJson(),
|
|
263
|
-
targetDefaults: {
|
|
264
|
-
...validTargetDefaults(),
|
|
265
|
-
lint: {
|
|
266
|
-
cache: true,
|
|
267
|
-
executor: 'nx:run-commands',
|
|
268
|
-
dependsOn: ['typecheck-tests', 'cargo-lint'],
|
|
269
|
-
inputs: ['default'],
|
|
270
|
-
outputs: ['dist'],
|
|
271
|
-
options: { command: 'eslint packages/*/src' },
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
expect(checkWorkspaceConfig(nxJson).some((issue) => issue.message.includes('targetDefaults.lint.'))).toBe(true);
|
|
276
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
277
|
-
expect(nxJson.targetDefaults.lint).toMatchObject({ cache: true });
|
|
278
|
-
expect(Object.keys(nxJson.targetDefaults.lint)).toEqual(['cache']);
|
|
279
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
280
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it('preserves lint input extensions that retain inferred inputs and dependency declarations', () => {
|
|
284
|
-
const inputs = ['...', '^production', '{workspaceRoot}/tooling/lint-extra/**/*'];
|
|
285
|
-
const nxJson = {
|
|
286
|
-
...validNxJson(),
|
|
287
|
-
targetDefaults: { ...validTargetDefaults(), lint: { cache: true, inputs } },
|
|
288
|
-
};
|
|
289
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
290
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
291
|
-
expect(nxJson.targetDefaults.lint.inputs).toEqual(inputs);
|
|
292
|
-
for (const invalidInputs of [['^production'], ['...', 'default'], ['default', '^production']]) {
|
|
293
|
-
const invalid = {
|
|
294
|
-
...validNxJson(),
|
|
295
|
-
targetDefaults: { ...validTargetDefaults(), lint: { cache: true, inputs: invalidInputs } },
|
|
296
|
-
};
|
|
297
|
-
expect(checkWorkspaceConfig(invalid).some((issue) => issue.message.includes('targetDefaults.lint.inputs'))).toBe(
|
|
298
|
-
true,
|
|
299
|
-
);
|
|
300
|
-
expect(applyWorkspaceConfig(invalid)).toBe(true);
|
|
301
|
-
expect(Object.keys(invalid.targetDefaults.lint)).toEqual(['cache']);
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it('returns false for already-valid config', () => {
|
|
306
|
-
const nxJson = validNxJson();
|
|
307
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it('strips a build outputs default so the inferred aggregate claims nothing', () => {
|
|
311
|
-
const nxJson = {
|
|
312
|
-
...validNxJson(),
|
|
313
|
-
targetDefaults: {
|
|
314
|
-
...validTargetDefaults(),
|
|
315
|
-
build: { cache: true, outputs: ['{projectRoot}/dist', '{projectRoot}/dist-node'] },
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
319
|
-
const build = expectRecord(expectRecord(nxJson.targetDefaults).build);
|
|
320
|
-
expect(build).toEqual({ cache: true });
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it('strips a build dependsOn default so the inferred host-aware edge survives', () => {
|
|
324
|
-
const nxJson = {
|
|
325
|
-
...validNxJson(),
|
|
326
|
-
targetDefaults: {
|
|
327
|
-
...validTargetDefaults(),
|
|
328
|
-
build: { cache: true, dependsOn: ['^build'] },
|
|
329
|
-
},
|
|
330
|
-
};
|
|
331
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
332
|
-
const build = expectRecord(expectRecord(nxJson.targetDefaults).build);
|
|
333
|
-
expect(build).toEqual({ cache: true });
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
it('strips a test dependsOn default so inferred cargo-test survives', () => {
|
|
337
|
-
const nxJson = {
|
|
338
|
-
...validNxJson(),
|
|
339
|
-
targetDefaults: {
|
|
340
|
-
...validTargetDefaults(),
|
|
341
|
-
test: { cache: true, dependsOn: ['^build', 'build'] },
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
345
|
-
const test = expectRecord(expectRecord(nxJson.targetDefaults).test);
|
|
346
|
-
expect(test).toEqual({ cache: true });
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
it('fixes missing plugins', () => {
|
|
350
|
-
const nxJson: Record<string, unknown> = {
|
|
351
|
-
plugins: [],
|
|
352
|
-
targetDefaults: validTargetDefaults(),
|
|
353
|
-
namedInputs: validNamedInputs(),
|
|
354
|
-
};
|
|
355
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
356
|
-
const pluginNames = readPluginNames(nxJson.plugins);
|
|
357
|
-
expect(pluginNames).not.toContain('@nx/js/typescript');
|
|
358
|
-
expect(pluginNames).toContain('@smoothbricks/nx-plugin');
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
it('keeps configured plugin entries and their order through two policy runs', () => {
|
|
362
|
-
const configured = {
|
|
363
|
-
plugin: '@smoothbricks/nx-plugin',
|
|
364
|
-
options: { custom: { owner: 'declared-owner', enabled: true } },
|
|
365
|
-
include: ['packages/owned/**'],
|
|
366
|
-
exclude: ['packages/foreign/**'],
|
|
367
|
-
};
|
|
368
|
-
const scoped = { ...configured, include: ['targets/owned/**'] };
|
|
369
|
-
const plugins = ['example:before', configured, scoped, 'example:after'];
|
|
370
|
-
const original = JSON.stringify(plugins);
|
|
371
|
-
const nxJson = { ...validNxJson(), plugins };
|
|
372
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
373
|
-
expect(JSON.stringify(nxJson.plugins)).toBe(original);
|
|
374
|
-
expect(nxJson.plugins[1]).toBe(configured);
|
|
375
|
-
expect(nxJson.plugins[2]).toBe(scoped);
|
|
376
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
377
|
-
expect(JSON.stringify(nxJson.plugins)).toBe(original);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
it('removes colon target defaults', () => {
|
|
381
|
-
const nxJson = {
|
|
382
|
-
...validNxJson(),
|
|
383
|
-
targetDefaults: {
|
|
384
|
-
...validTargetDefaults(),
|
|
385
|
-
'build:wasm': { cache: true },
|
|
386
|
-
},
|
|
387
|
-
};
|
|
388
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
389
|
-
expect(expectRecord(nxJson.targetDefaults)['build:wasm']).toBeUndefined();
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
it('removes static test typecheck defaults so inference owns clean-output prerequisites', () => {
|
|
393
|
-
const nxJson = {
|
|
394
|
-
...validNxJson(),
|
|
395
|
-
targetDefaults: {
|
|
396
|
-
...validTargetDefaults(),
|
|
397
|
-
'typecheck-tests': {
|
|
398
|
-
dependsOn: ['typecheck'],
|
|
399
|
-
options: { command: 'ttsc -p tsconfig.test.json --noEmit' },
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
405
|
-
expect(expectRecord(nxJson.targetDefaults)['typecheck-tests']).toBeUndefined();
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
it('fixes imprecise production inputs', () => {
|
|
409
|
-
const nxJson: Record<string, unknown> = {
|
|
410
|
-
plugins: validPlugins(),
|
|
411
|
-
targetDefaults: validTargetDefaults(),
|
|
412
|
-
namedInputs: {
|
|
413
|
-
...validNamedInputs(),
|
|
414
|
-
production: ['default', '{projectRoot}/**/*'],
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
418
|
-
const namedInputs = expectRecord(nxJson.namedInputs);
|
|
419
|
-
expect(namedInputs.production).toEqual([
|
|
420
|
-
'{projectRoot}/src/**/*',
|
|
421
|
-
'{projectRoot}/package.json',
|
|
422
|
-
'!{projectRoot}/**/__tests__/**',
|
|
423
|
-
'!{projectRoot}/**/*.test.*',
|
|
424
|
-
'!{projectRoot}/**/*.spec.*',
|
|
425
|
-
MARKDOWN,
|
|
426
|
-
]);
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// A README or spec edit re-keyed every task of its project and, through `^default`/`^production`, of every
|
|
430
|
-
// project depending on it: 39 tasks for one package README in this repository.
|
|
431
|
-
it('keeps Markdown out of default and production, appending the exclusion to custom definitions', () => {
|
|
432
|
-
const nxJson = validNxJson();
|
|
433
|
-
nxJson.namedInputs = {
|
|
434
|
-
default: ['{projectRoot}/**/*', 'custom'],
|
|
435
|
-
production: ['{projectRoot}/src/**/*.rs', '{projectRoot}/Cargo.toml'],
|
|
436
|
-
custom: ['{workspaceRoot}/config/shared.json'],
|
|
437
|
-
};
|
|
438
|
-
expect(checkWorkspaceConfig(nxJson).map((issue) => issue.message)).toEqual([
|
|
439
|
-
"namedInputs.default must exclude {projectRoot}/**/*.md: Markdown is no task's input unless a target names it.",
|
|
440
|
-
"namedInputs.production must exclude {projectRoot}/**/*.md: Markdown is no task's input unless a target names it.",
|
|
441
|
-
]);
|
|
442
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
443
|
-
expect(nxJson.namedInputs).toEqual({
|
|
444
|
-
default: ['{projectRoot}/**/*', 'custom', MARKDOWN],
|
|
445
|
-
production: ['{projectRoot}/src/**/*.rs', '{projectRoot}/Cargo.toml', MARKDOWN],
|
|
446
|
-
custom: ['{workspaceRoot}/config/shared.json'],
|
|
447
|
-
});
|
|
448
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
449
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
450
|
-
|
|
451
|
-
const fresh: Record<string, unknown> = { plugins: validPlugins(), targetDefaults: validTargetDefaults() };
|
|
452
|
-
applyWorkspaceConfig(fresh);
|
|
453
|
-
expect(fresh.namedInputs).toEqual(validNamedInputs());
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
it('accepts custom precise production inputs unchanged', () => {
|
|
457
|
-
const nxJson: Record<string, unknown> = {
|
|
458
|
-
...validNxJson(),
|
|
459
|
-
namedInputs: {
|
|
460
|
-
...validNamedInputs(),
|
|
461
|
-
production: ['{projectRoot}/src/**/*.rs', '{projectRoot}/Cargo.toml', '!{projectRoot}/**/*.test.*', MARKDOWN],
|
|
462
|
-
},
|
|
463
|
-
};
|
|
464
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
465
|
-
});
|
|
466
|
-
it('migrates only a CI-only sharedGlobals reference and retains explicit workflow targets', () => {
|
|
467
|
-
const nxJson = validNxJson();
|
|
468
|
-
nxJson.namedInputs = {
|
|
469
|
-
...validNamedInputs(),
|
|
470
|
-
default: ['{projectRoot}/**/*', 'sharedGlobals', 'custom', MARKDOWN],
|
|
471
|
-
sharedGlobals: ['{workspaceRoot}/.github/workflows/ci.yml'],
|
|
472
|
-
custom: ['{workspaceRoot}/config/shared.json'],
|
|
473
|
-
lint: ['sharedGlobals'],
|
|
474
|
-
};
|
|
475
|
-
nxJson.targetDefaults = { ...validTargetDefaults(), workflowLint: { inputs: ['sharedGlobals'] } };
|
|
476
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(true);
|
|
477
|
-
expect(expectRecord(nxJson.namedInputs)).toEqual({
|
|
478
|
-
...validNamedInputs(),
|
|
479
|
-
default: ['{projectRoot}/**/*', 'custom', MARKDOWN],
|
|
480
|
-
sharedGlobals: ['{workspaceRoot}/.github/workflows/ci.yml'],
|
|
481
|
-
custom: ['{workspaceRoot}/config/shared.json'],
|
|
482
|
-
lint: ['sharedGlobals'],
|
|
483
|
-
});
|
|
484
|
-
expect(expectRecord(nxJson.targetDefaults).workflowLint).toEqual({ inputs: ['sharedGlobals'] });
|
|
485
|
-
expect(expectRecord(nxJson.namedInputs).lint).toEqual(['sharedGlobals']);
|
|
486
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
487
|
-
expect(checkWorkspaceConfig(nxJson)).toEqual([]);
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
it('preserves a custom non-CI sharedGlobals definition and its default reference', () => {
|
|
491
|
-
const nxJson = validNxJson();
|
|
492
|
-
nxJson.namedInputs = {
|
|
493
|
-
...validNamedInputs(),
|
|
494
|
-
default: ['{projectRoot}/**/*', 'sharedGlobals', MARKDOWN],
|
|
495
|
-
sharedGlobals: ['{workspaceRoot}/config/shared.json'],
|
|
496
|
-
};
|
|
497
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
498
|
-
expect(expectRecord(nxJson.namedInputs).sharedGlobals).toEqual(['{workspaceRoot}/config/shared.json']);
|
|
499
|
-
expect(expectRecord(nxJson.namedInputs).default).toEqual(['{projectRoot}/**/*', 'sharedGlobals', MARKDOWN]);
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
// ---------------------------------------------------------------------------
|
|
504
|
-
// Layer 2: Tree-based function tests
|
|
505
|
-
// ---------------------------------------------------------------------------
|
|
506
|
-
|
|
507
|
-
describe('Tree: checkWorkspaceConfigTree', () => {
|
|
508
|
-
it('returns issue when nx.json missing', () => {
|
|
509
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
510
|
-
// createTreeWithEmptyWorkspace creates an nx.json, remove it
|
|
511
|
-
tree.delete('nx.json');
|
|
512
|
-
const issues = checkWorkspaceConfigTree(tree);
|
|
513
|
-
expect(issues).toHaveLength(1);
|
|
514
|
-
expect(issues[0].message).toBe('nx.json not found');
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
it('detects missing plugins', () => {
|
|
518
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
519
|
-
writeJson(tree, 'nx.json', {
|
|
520
|
-
cacheDirectory: '.nx/cache',
|
|
521
|
-
plugins: [],
|
|
522
|
-
targetDefaults: validTargetDefaults(),
|
|
523
|
-
namedInputs: validNamedInputs(),
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
const issues = checkWorkspaceConfigTree(tree);
|
|
527
|
-
expect(issues.length).toBe(1);
|
|
528
|
-
expect(issues.some((i) => i.message.includes('plugins must include @smoothbricks/nx-plugin'))).toBe(true);
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
it('returns no issues for valid config', () => {
|
|
532
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
533
|
-
writeJson(tree, 'nx.json', validNxJson());
|
|
534
|
-
|
|
535
|
-
expect(checkWorkspaceConfigTree(tree)).toEqual([]);
|
|
536
|
-
});
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
describe('Tree: applyWorkspaceConfigTree', () => {
|
|
540
|
-
it('returns false when nx.json missing', () => {
|
|
541
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
542
|
-
tree.delete('nx.json');
|
|
543
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
it('fixes missing plugins and writes back to tree', () => {
|
|
547
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
548
|
-
writeJson(tree, 'nx.json', {
|
|
549
|
-
plugins: [],
|
|
550
|
-
targetDefaults: validTargetDefaults(),
|
|
551
|
-
namedInputs: validNamedInputs(),
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(true);
|
|
555
|
-
|
|
556
|
-
const nxJson = readJson(tree, 'nx.json');
|
|
557
|
-
const pluginNames = readPluginNames(nxJson.plugins);
|
|
558
|
-
expect(pluginNames).not.toContain('@nx/js/typescript');
|
|
559
|
-
expect(pluginNames).toContain('@smoothbricks/nx-plugin');
|
|
560
|
-
|
|
561
|
-
// Tree version now passes check
|
|
562
|
-
expect(checkWorkspaceConfigTree(tree)).toEqual([]);
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
it('preserves configured plugin options and filters in the real Nx tree through two updates', () => {
|
|
566
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
567
|
-
const configured = {
|
|
568
|
-
plugin: '@smoothbricks/nx-plugin',
|
|
569
|
-
options: { custom: { owner: 'declared-owner', enabled: true } },
|
|
570
|
-
include: ['packages/owned/**'],
|
|
571
|
-
exclude: ['packages/foreign/**'],
|
|
572
|
-
};
|
|
573
|
-
const plugins = ['example:before', configured, 'example:after'];
|
|
574
|
-
writeJson(tree, 'nx.json', { ...validNxJson(), plugins });
|
|
575
|
-
const original = tree.read('nx.json', 'utf8');
|
|
576
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
577
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
578
|
-
expect(tree.read('nx.json', 'utf8')).toBe(original);
|
|
579
|
-
expect(readJson(tree, 'nx.json').plugins).toEqual(plugins);
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
it('does not serialize an unchanged raw JSONC configuration or remove its comments', () => {
|
|
583
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
584
|
-
const configured = {
|
|
585
|
-
plugin: '@smoothbricks/nx-plugin',
|
|
586
|
-
options: { custom: { owner: 'declared-owner', enabled: true } },
|
|
587
|
-
include: ['packages/owned/**'],
|
|
588
|
-
exclude: ['packages/foreign/**'],
|
|
589
|
-
};
|
|
590
|
-
const raw = JSON.stringify({ ...validNxJson(), plugins: [configured] }, null, 2).replace(
|
|
591
|
-
'"plugin":',
|
|
592
|
-
'/* scoped plugin options must remain authored */ "plugin":',
|
|
593
|
-
);
|
|
594
|
-
tree.write('nx.json', `${raw}\n`);
|
|
595
|
-
const original = tree.read('nx.json', 'utf8');
|
|
596
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
597
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
598
|
-
expect(tree.read('nx.json', 'utf8')).toBe(original);
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
it('reports malformed plugin values and never replaces them with a default entry', () => {
|
|
602
|
-
for (const plugins of [
|
|
603
|
-
null,
|
|
604
|
-
'not-an-array',
|
|
605
|
-
[{ plugin: 42 }],
|
|
606
|
-
[{ plugin: '@smoothbricks/nx-plugin', include: 42 }],
|
|
607
|
-
]) {
|
|
608
|
-
const nxJson = { ...validNxJson(), plugins };
|
|
609
|
-
const original = JSON.stringify(plugins);
|
|
610
|
-
expect(checkWorkspaceConfig(nxJson).some((issue) => issue.message.startsWith('plugins is malformed:'))).toBe(
|
|
611
|
-
true,
|
|
612
|
-
);
|
|
613
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
614
|
-
expect(JSON.stringify(nxJson.plugins)).toBe(original);
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
it('returns false when config already valid', () => {
|
|
619
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
620
|
-
writeJson(tree, 'nx.json', validNxJson());
|
|
621
|
-
|
|
622
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(false);
|
|
623
|
-
});
|
|
624
|
-
|
|
625
|
-
it('fixes build target defaults via tree', () => {
|
|
626
|
-
const tree = createTreeWithEmptyWorkspace();
|
|
627
|
-
writeJson(tree, 'nx.json', {
|
|
628
|
-
plugins: validPlugins(),
|
|
629
|
-
targetDefaults: { build: { cache: false, outputs: ['{projectRoot}/dist'] } },
|
|
630
|
-
namedInputs: validNamedInputs(),
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
expect(applyWorkspaceConfigTree(tree)).toBe(true);
|
|
634
|
-
|
|
635
|
-
const nxJson = readJson(tree, 'nx.json');
|
|
636
|
-
expect(expectRecord(nxJson.targetDefaults).build).toEqual({ cache: true });
|
|
637
|
-
expect(expectRecord(nxJson.targetDefaults).clean).toEqual({
|
|
638
|
-
executor: '@smoothbricks/nx-plugin:clean-outputs',
|
|
639
|
-
cache: false,
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
// ---------------------------------------------------------------------------
|
|
645
|
-
// Layer 3: Filesystem wrapper integration test
|
|
646
|
-
// ---------------------------------------------------------------------------
|
|
647
|
-
|
|
648
|
-
describe('filesystem: checkWorkspaceConfigPolicy / applyWorkspaceConfigPolicy', () => {
|
|
649
|
-
it('round-trips check/apply on real temp directory', async () => {
|
|
650
|
-
const root = await mkdtemp(join(tmpdir(), 'smoothbricks-ws-policy-'));
|
|
651
|
-
try {
|
|
652
|
-
await writeJsonFile(join(root, 'nx.json'), {
|
|
653
|
-
plugins: [],
|
|
654
|
-
targetDefaults: {
|
|
655
|
-
build: { cache: false },
|
|
656
|
-
'typecheck-tests': {
|
|
657
|
-
dependsOn: ['typecheck'],
|
|
658
|
-
options: { command: 'ttsc -p tsconfig.test.json --noEmit' },
|
|
659
|
-
},
|
|
660
|
-
},
|
|
661
|
-
namedInputs: validNamedInputs(),
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
const issues = checkWorkspaceConfigPolicy(root);
|
|
665
|
-
expect(issues.length).toBeGreaterThan(0);
|
|
666
|
-
// Filesystem wrapper uses absolute paths
|
|
667
|
-
expect(issues[0].path).toBe(join(root, 'nx.json'));
|
|
668
|
-
|
|
669
|
-
expect(applyWorkspaceConfigPolicy(root)).toBe(true);
|
|
670
|
-
|
|
671
|
-
const nxJson = expectRecord(JSON.parse(await readFile(join(root, 'nx.json'), 'utf8')));
|
|
672
|
-
const pluginNames = readPluginNames(nxJson.plugins);
|
|
673
|
-
expect(pluginNames).not.toContain('@nx/js/typescript');
|
|
674
|
-
expect(expectRecord(nxJson.targetDefaults)['typecheck-tests']).toBeUndefined();
|
|
675
|
-
expect(nxJson.cacheDirectory).toBe('.nx/cache');
|
|
676
|
-
|
|
677
|
-
// No issues after fix
|
|
678
|
-
expect(checkWorkspaceConfigPolicy(root)).toEqual([]);
|
|
679
|
-
expect(applyWorkspaceConfigPolicy(root)).toBe(false);
|
|
680
|
-
} finally {
|
|
681
|
-
await rm(root, { recursive: true, force: true });
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
it('reports issue when nx.json is missing', async () => {
|
|
686
|
-
const root = await mkdtemp(join(tmpdir(), 'smoothbricks-ws-policy-'));
|
|
687
|
-
try {
|
|
688
|
-
const issues = checkWorkspaceConfigPolicy(root);
|
|
689
|
-
expect(issues).toHaveLength(1);
|
|
690
|
-
expect(issues[0].message).toBe('nx.json not found or invalid');
|
|
691
|
-
|
|
692
|
-
expect(applyWorkspaceConfigPolicy(root)).toBe(false);
|
|
693
|
-
} finally {
|
|
694
|
-
await rm(root, { recursive: true, force: true });
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
// ---------------------------------------------------------------------------
|
|
700
|
-
// Test-local file helper (for filesystem integration tests only)
|
|
701
|
-
// ---------------------------------------------------------------------------
|
|
702
|
-
|
|
703
|
-
async function writeJsonFile(path: string, value: unknown): Promise<void> {
|
|
704
|
-
await mkdir(dirname(path), { recursive: true });
|
|
705
|
-
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
function expectRecord(value: unknown): Record<string, unknown> {
|
|
709
|
-
if (!isRecord(value)) {
|
|
710
|
-
throw new Error('expected object');
|
|
711
|
-
}
|
|
712
|
-
return value;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
716
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
function readPluginNames(value: unknown): unknown[] {
|
|
720
|
-
if (!Array.isArray(value)) {
|
|
721
|
-
throw new Error('expected plugins array');
|
|
722
|
-
}
|
|
723
|
-
const plugins: unknown[] = value;
|
|
724
|
-
return plugins.map((plugin) => (typeof plugin === 'string' ? plugin : expectRecord(plugin).plugin));
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
describe('managed-file sync registration', () => {
|
|
728
|
-
it('preserves other generators and is idempotent', () => {
|
|
729
|
-
const nxJson = { sync: { applyChanges: true, globalGenerators: ['example:sync'] } };
|
|
730
|
-
applyWorkspaceConfig(nxJson);
|
|
731
|
-
expect(nxJson.sync).toEqual({
|
|
732
|
-
applyChanges: true,
|
|
733
|
-
globalGenerators: ['example:sync', '@smoothbricks/nx-plugin:managed-files'],
|
|
734
|
-
});
|
|
735
|
-
expect(applyWorkspaceConfig(nxJson)).toBe(false);
|
|
736
|
-
});
|
|
737
|
-
});
|