@smoothbricks/nx-plugin 0.4.21 → 0.4.23
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 +95 -18
- package/dist/bin/smoo-nx-cargo-hash.js +32 -6
- package/dist/bin/smoo-nx-exec.js +35 -11
- package/dist/cargo-closure-input.d.ts +63 -0
- package/dist/cargo-closure-input.d.ts.map +1 -0
- package/dist/cargo-closure-input.js +197 -0
- package/dist/cargo-source-hash.d.ts +46 -2
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +238 -114
- package/dist/cross-check-policy.d.ts +14 -0
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +15 -1
- package/dist/ensure-built.d.ts +3 -2
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +33 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -76
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +12 -15
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +10 -0
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +12 -6
- package/dist/manifest-hash.d.ts.map +1 -1
- package/dist/manifest-hash.js +24 -30
- package/dist/package-target-policy.js +1 -1
- package/dist/platform-targets.d.ts +7 -0
- package/dist/platform-targets.d.ts.map +1 -1
- package/dist/platform-targets.js +7 -0
- package/dist/workspace-config-policy.d.ts +1 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +1 -1
- package/managed/raw/envrc +38 -1
- package/managed/raw/tooling/direnv/developer-links.ts +201 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +75 -51
- package/managed/raw/tooling/direnv/secret-references.ts +3 -1
- package/managed/raw/tooling/direnv/setup-environment.ts +562 -78
- package/managed/raw/tooling/direnv/shared-caches.sh +53 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +22 -1
- package/managed/templates/github/workflows/managed-files.yml +4 -3
- package/nextest.toml +5 -5
- package/package.json +2 -2
- package/src/__tests__/fixture-nx-env.ts +31 -0
- package/src/__tests__/in-process-nx-index.ts +9 -0
- package/src/bin/smoo-nx-cargo-hash.ts +29 -9
- package/src/bin/smoo-nx-exec.ts +40 -11
- package/src/cargo-closure-input.test.ts +184 -0
- package/src/cargo-closure-input.ts +247 -0
- package/src/cargo-source-hash.test.ts +104 -10
- package/src/cargo-source-hash.ts +290 -37
- package/src/cross-check-policy.ts +15 -3
- package/src/ensure-built.test.ts +65 -5
- package/src/ensure-built.ts +40 -85
- package/src/index.test.ts +94 -53
- package/src/index.ts +164 -84
- package/src/managed-files/ci-workflow.ts +12 -15
- package/src/managed-files/files.ts +10 -0
- package/src/managed-files/generator.test.ts +29 -0
- package/src/managed-files/publish-workflow.ts +17 -6
- package/src/manifest-hash.test.ts +21 -1
- package/src/manifest-hash.ts +26 -29
- package/src/package-target-policy.ts +1 -1
- package/src/platform-targets.ts +8 -0
- package/src/workspace-config-policy.ts +6 -1
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# Every explanation lives out here in Nix comments. Hook bodies are exported as
|
|
14
14
|
# shell text, so a comment inside one becomes part of an environment variable.
|
|
15
15
|
{
|
|
16
|
+
config,
|
|
16
17
|
inputs,
|
|
17
18
|
lib,
|
|
18
19
|
pkgs,
|
|
@@ -29,12 +30,29 @@
|
|
|
29
30
|
rev = "56ab4af42157";
|
|
30
31
|
hash = "sha256-ebjX+1+9axEqsnZXCRZSumA38gPNdmoz98tMt2oftN4=";
|
|
31
32
|
};
|
|
33
|
+
|
|
34
|
+
# A repository that enables uv under languages.python gets its uv workspace
|
|
35
|
+
# synced and activated by this contract (enterShell item 5), never by
|
|
36
|
+
# devenv's own python tasks.
|
|
37
|
+
python = config.languages.python;
|
|
38
|
+
uvProject = python.enable && python.uv.enable;
|
|
32
39
|
in {
|
|
33
40
|
env = lib.mkMerge [
|
|
34
41
|
{
|
|
35
42
|
# Nx otherwise defaults to three workers. Scale to the cores available in each
|
|
36
43
|
# developer shell or CI runner; explicit --parallel flags still take precedence.
|
|
37
44
|
NX_PARALLEL = "100%";
|
|
45
|
+
# Every Nx daemon, when it starts, installs nx@latest from the registry
|
|
46
|
+
# into a temporary directory to ask the newest release whether to prompt
|
|
47
|
+
# for Nx Console and whether AI agent configuration is outdated, and
|
|
48
|
+
# `nx configure-ai-agents` and `nx init` do the same. NX_USE_LOCAL answers
|
|
49
|
+
# from the installed nx, so starting Nx installs nothing from the registry.
|
|
50
|
+
# (A daemon still runs `git ls-remote` against GitHub's
|
|
51
|
+
# nrwl/nx-ai-agents-config when an agent has both rules and Nx's MCP
|
|
52
|
+
# configured; a cowshed sandbox runs Nx without a daemon.) It also makes
|
|
53
|
+
# `nx migrate` run with the installed CLI instead of the newest one;
|
|
54
|
+
# `NX_USE_LOCAL=false nx migrate` restores that for the one command.
|
|
55
|
+
NX_USE_LOCAL = "true";
|
|
38
56
|
TTSC_TYPESCRIPT_GO_DIR = "${typescriptGo}";
|
|
39
57
|
}
|
|
40
58
|
# Playwright's downloaded Ubuntu browser has no runtime closure on NixOS
|
|
@@ -255,6 +273,16 @@ in {
|
|
|
255
273
|
]
|
|
256
274
|
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [pkgs.chromium];
|
|
257
275
|
|
|
276
|
+
# devenv wraps the Python interpreter to find native libraries in
|
|
277
|
+
# `languages.python.libraries`, whose default is this checkout's
|
|
278
|
+
# `.devenv/profile`. That path then lands in the interpreter's store path, the
|
|
279
|
+
# profile that holds it and the uv environment built with it, so every clone
|
|
280
|
+
# evaluates and builds its own interpreter and profile on first entry, and its
|
|
281
|
+
# copied uv environment names another checkout's interpreter. Cleared, the
|
|
282
|
+
# interpreter is one store path in every checkout. devenv still adds the C++
|
|
283
|
+
# runtime; a wheel that needs another library names that library here.
|
|
284
|
+
languages.python.libraries = lib.mkIf uvProject (lib.mkDefault []);
|
|
285
|
+
|
|
258
286
|
enterShell = lib.mkMerge [
|
|
259
287
|
# Prologue, in order:
|
|
260
288
|
#
|
|
@@ -264,47 +292,35 @@ in {
|
|
|
264
292
|
# use, so a hook and a shell resolve one binary the same way.
|
|
265
293
|
# 3. ttsc drives the native TypeScript 7 binary while Nx imports the TypeScript
|
|
266
294
|
# 6 API, so the two must be named separately.
|
|
267
|
-
# 4.
|
|
268
|
-
#
|
|
269
|
-
#
|
|
270
|
-
#
|
|
271
|
-
#
|
|
272
|
-
#
|
|
273
|
-
#
|
|
274
|
-
#
|
|
275
|
-
# unlike Rust's trim-paths it costs no cache reuse.
|
|
276
|
-
#
|
|
277
|
-
# ttsc's plugin builds use the Go it bundles rather than ours, so the
|
|
278
|
-
# repository's own Go work and ttsc's plugin builds are two toolchains by
|
|
279
|
-
# construction. Placing both caches in the shared store is what keeps that
|
|
280
|
-
# from costing a rebuild per workspace.
|
|
295
|
+
# 4. Go and ttsc caches: tooling/direnv/shared-caches.sh places them under
|
|
296
|
+
# the machine's shared caches root when it exists and states why.
|
|
297
|
+
# 5. The shared setup-environment.ts bootstraps repository dependencies. It
|
|
298
|
+
# runs `bun install` — and, for a uv project, `uv sync` — only when that
|
|
299
|
+
# installer's inputs changed since its last successful run, so an
|
|
300
|
+
# unchanged checkout enters in the time it takes to hash a lockfile. It
|
|
301
|
+
# records those inputs, and the managed .envrc watches them, so a shell
|
|
302
|
+
# that direnv keeps loaded re-enters exactly when one of them changes.
|
|
281
303
|
#
|
|
282
|
-
#
|
|
283
|
-
#
|
|
284
|
-
#
|
|
285
|
-
#
|
|
286
|
-
#
|
|
287
|
-
#
|
|
288
|
-
#
|
|
289
|
-
#
|
|
290
|
-
#
|
|
291
|
-
#
|
|
292
|
-
#
|
|
304
|
+
# The uv project environment is devenv's UV_PROJECT_ENVIRONMENT, synced
|
|
305
|
+
# with the interpreter devenv would use and activated here after the
|
|
306
|
+
# sync. It lives under this checkout and names no path of it: uv creates
|
|
307
|
+
# it relocatable, setup-environment.ts rewrites the editable installs of
|
|
308
|
+
# workspace members relative to it, and the interpreter is the same
|
|
309
|
+
# store path everywhere (languages.python.libraries above). A
|
|
310
|
+
# copy-on-write clone copies it along with everything else, installed.
|
|
311
|
+
# devenv's own virtualenv and uv sync tasks are refused below: they
|
|
312
|
+
# activate the environment from its own activation script — which in a
|
|
313
|
+
# clone names the original checkout — before this prologue runs, and key
|
|
314
|
+
# their skip on pyproject.toml alone.
|
|
293
315
|
#
|
|
294
|
-
#
|
|
295
|
-
#
|
|
296
|
-
#
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
#
|
|
302
|
-
# Repo-owned enterShell bodies merge after this prologue.
|
|
303
|
-
# 6. Shell entry resolves the `shell` group of `smoo.secrets` and nothing
|
|
304
|
-
# else. Shell entry happens on every direnv reload and every
|
|
305
|
-
# `devenv shell -- <command>`, and a provider command that runs then is a
|
|
306
|
-
# credential prompt on every one of them (1Password authorises per
|
|
307
|
-
# requesting process lineage, and this one is new each time). A
|
|
316
|
+
# A local install failure is reported and the shell still loads, so the
|
|
317
|
+
# tools to repair it stay available; CI fails. Repo-owned enterShell
|
|
318
|
+
# bodies merge after this prologue.
|
|
319
|
+
# 6. Shell entry resolves the `shell` group of `smoo.secrets`, only when it
|
|
320
|
+
# installs, and nothing else. Shell entry happens on every direnv reload
|
|
321
|
+
# and every `devenv shell -- <command>`, and a provider command that runs
|
|
322
|
+
# then is a credential prompt on every one of them (1Password authorises
|
|
323
|
+
# per requesting process lineage, and this one is new each time). A
|
|
308
324
|
# credential only one deliberate command needs belongs to that command:
|
|
309
325
|
# `smoo secrets run <group> <command...>`. The full statement, and the
|
|
310
326
|
# derivation below, live in tooling/direnv/secret-references.ts.
|
|
@@ -383,19 +399,15 @@ in {
|
|
|
383
399
|
export TMPDIR="''${TMPDIR:-/tmp}"
|
|
384
400
|
fi
|
|
385
401
|
export TTSC_TSGO_BINARY="$PWD/node_modules/@typescript/native/bin/tsc"
|
|
386
|
-
|
|
387
|
-
export TTSC_CACHE_DIR="''${TTSC_CACHE_DIR:-$HOME/.cowshed/caches/ttsc}"
|
|
388
|
-
export GOCACHE="''${GOCACHE:-$HOME/.cowshed/caches/go/build}"
|
|
389
|
-
export GOMODCACHE="''${GOMODCACHE:-$HOME/.cowshed/caches/go/mod}"
|
|
390
|
-
mkdir -p "$GOCACHE" "$GOMODCACHE"
|
|
391
|
-
else
|
|
392
|
-
export TTSC_CACHE_DIR="''${TTSC_CACHE_DIR:-$PWD/.cache/ttsc}"
|
|
393
|
-
fi
|
|
394
|
-
export TTSC_GO_CACHE_DIR="''${TTSC_GO_CACHE_DIR:-$TTSC_CACHE_DIR/go-build}"
|
|
395
|
-
mkdir -p "$TTSC_CACHE_DIR" "$TTSC_GO_CACHE_DIR"
|
|
396
|
-
export GOFLAGS="''${GOFLAGS:--trimpath}"
|
|
402
|
+
. "$DEVENV_ROOT/shared-caches.sh" /private/cowshed/caches
|
|
397
403
|
unset GOROOT
|
|
398
|
-
bun "$DEVENV_ROOT/setup-environment.ts" || exit $?
|
|
404
|
+
bun "$DEVENV_ROOT/setup-environment.ts"${lib.optionalString uvProject " --python ${python.package.interpreter}"} || exit $?
|
|
405
|
+
${lib.optionalString uvProject ''
|
|
406
|
+
if [ -f pyproject.toml ]; then
|
|
407
|
+
export VIRTUAL_ENV="$UV_PROJECT_ENVIRONMENT"
|
|
408
|
+
export PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
409
|
+
fi
|
|
410
|
+
''}
|
|
399
411
|
# One socket dir per Nx workspace. DEVENV_RUNTIME is keyed to the devenv
|
|
400
412
|
# ROOT, so every workspace sharing one devenv - a sibling repository, a
|
|
401
413
|
# copy-on-write clone, a scratch workspace created inside this shell -
|
|
@@ -432,4 +444,16 @@ in {
|
|
|
432
444
|
fi
|
|
433
445
|
'')
|
|
434
446
|
];
|
|
447
|
+
|
|
448
|
+
assertions = [
|
|
449
|
+
{
|
|
450
|
+
assertion = !(uvProject && (python.venv.enable || python.uv.sync.enable));
|
|
451
|
+
message = ''
|
|
452
|
+
devenv.smoo.nix syncs and activates the uv project environment itself (enterShell item 5).
|
|
453
|
+
Set languages.python.venv.enable and languages.python.uv.sync.enable to false in devenv.nix:
|
|
454
|
+
devenv's tasks activate the environment from its own activation script, which in a
|
|
455
|
+
copy-on-write clone names the original checkout, and skip the sync while uv.lock changes.
|
|
456
|
+
'';
|
|
457
|
+
}
|
|
458
|
+
];
|
|
435
459
|
}
|
|
@@ -393,7 +393,9 @@ async function routeSecret(
|
|
|
393
393
|
}
|
|
394
394
|
const requested = group === context.group;
|
|
395
395
|
if (requested || context.dependsOn.includes(group)) {
|
|
396
|
-
|
|
396
|
+
// A CI runner (GitHub or Forgejo Actions, which sets GITHUB_ACTIONS too), never
|
|
397
|
+
// `CI`: agent harnesses set CI=true on every command they run.
|
|
398
|
+
if (env.GITHUB_ACTIONS === 'true') {
|
|
397
399
|
return {
|
|
398
400
|
name,
|
|
399
401
|
group,
|