@smoothbricks/nx-plugin 0.4.14 → 0.4.16
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 +20 -3
- package/dist/deploy-policy.d.ts +26 -0
- package/dist/deploy-policy.d.ts.map +1 -0
- package/dist/deploy-policy.js +36 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +160 -37
- package/dist/managed-assets.d.ts +3 -0
- package/dist/managed-assets.d.ts.map +1 -0
- package/dist/managed-assets.js +3 -0
- package/dist/managed-files/ci-workflow.d.ts +215 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -0
- package/dist/managed-files/ci-workflow.js +1082 -0
- package/dist/managed-files/context.d.ts +51 -0
- package/dist/managed-files/context.d.ts.map +1 -0
- package/dist/managed-files/context.js +206 -0
- package/dist/managed-files/files.d.ts +53 -0
- package/dist/managed-files/files.d.ts.map +1 -0
- package/dist/managed-files/files.js +248 -0
- package/dist/managed-files/generator.d.ts +16 -0
- package/dist/managed-files/generator.d.ts.map +1 -0
- package/dist/managed-files/generator.js +41 -0
- package/dist/managed-files/github-runs-on.d.ts +19 -0
- package/dist/managed-files/github-runs-on.d.ts.map +1 -0
- package/dist/managed-files/github-runs-on.js +48 -0
- package/dist/managed-files/managed-content.d.ts +45 -0
- package/dist/managed-files/managed-content.d.ts.map +1 -0
- package/dist/managed-files/managed-content.js +102 -0
- package/dist/managed-files/managed-format.d.ts +37 -0
- package/dist/managed-files/managed-format.d.ts.map +1 -0
- package/dist/managed-files/managed-format.js +94 -0
- package/dist/managed-files/paths.d.ts +8 -0
- package/dist/managed-files/paths.d.ts.map +1 -0
- package/dist/managed-files/paths.js +46 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +5 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.js +38 -0
- package/dist/managed-files/private-npm-policy.d.ts +7 -0
- package/dist/managed-files/private-npm-policy.d.ts.map +1 -0
- package/dist/managed-files/private-npm-policy.js +51 -0
- package/dist/managed-files/publish-workflow.d.ts +150 -0
- package/dist/managed-files/publish-workflow.d.ts.map +1 -0
- package/dist/managed-files/publish-workflow.js +989 -0
- package/dist/managed-files/tree.d.ts +30 -0
- package/dist/managed-files/tree.d.ts.map +1 -0
- package/dist/managed-files/tree.js +91 -0
- package/dist/package-target-policy.d.ts +0 -1
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +50 -23
- package/dist/platform-targets.d.ts +5 -0
- package/dist/platform-targets.d.ts.map +1 -0
- package/dist/platform-targets.js +4 -0
- package/dist/typecheck-test-policy.d.ts +5 -9
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +69 -99
- package/dist/workspace-config-policy.d.ts +23 -3
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +35 -3
- package/dist/workspace-manifest.d.ts +291 -0
- package/dist/workspace-manifest.d.ts.map +1 -0
- package/dist/workspace-manifest.js +6 -0
- package/dist/workspace-package-policy.d.ts +13 -0
- package/dist/workspace-package-policy.d.ts.map +1 -0
- package/dist/workspace-package-policy.js +24 -0
- package/generators.json +5 -0
- package/managed/raw/envrc +20 -0
- package/managed/raw/git-format-staged.yml +82 -0
- package/managed/raw/gitattributes +8 -0
- package/managed/raw/tooling/devenv +83 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +422 -0
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +251 -0
- package/managed/raw/tooling/direnv/merge-newer-pins.sh +48 -0
- package/managed/raw/tooling/direnv/repo-path +34 -0
- package/managed/raw/tooling/direnv/secret-references.ts +636 -0
- package/managed/raw/tooling/direnv/setup-environment.ts +585 -0
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +88 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +9 -0
- package/managed/raw/tooling/git-hooks/post-commit.sh +71 -0
- package/managed/raw/tooling/git-hooks/pre-commit.sh +18 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +48 -0
- package/managed/raw/tsconfig.lib.json +28 -0
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +45 -0
- package/managed/templates/github/actions/cache-node-modules/action.yml +17 -0
- package/managed/templates/github/actions/cache-nx/action.yml +21 -0
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +19 -0
- package/managed/templates/github/actions/save-nix-devenv/action.yml +32 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +241 -0
- package/managed/templates/github/workflows/managed-files.yml +127 -0
- package/package.json +89 -5
- package/src/bun-bootstrap.test.ts +0 -6
- package/src/deploy-policy.ts +40 -0
- package/src/index.test.ts +232 -9
- package/src/index.ts +187 -40
- package/src/managed-assets.ts +4 -0
- package/src/managed-files/ci-workflow.ts +1365 -0
- package/src/managed-files/context.ts +240 -0
- package/src/managed-files/files.ts +324 -0
- package/src/managed-files/generator.test.ts +151 -0
- package/src/managed-files/generator.ts +60 -0
- package/src/managed-files/github-runs-on.ts +51 -0
- package/src/managed-files/managed-content.test.ts +147 -0
- package/src/managed-files/managed-content.ts +121 -0
- package/src/managed-files/managed-format.ts +102 -0
- package/src/managed-files/paths.ts +44 -0
- package/src/managed-files/pr-preview-cleanup-workflow.ts +44 -0
- package/src/managed-files/private-npm-policy.ts +62 -0
- package/src/managed-files/publish-workflow.ts +1523 -0
- package/src/managed-files/schema.json +8 -0
- package/src/managed-files/tree-permissions.test.ts +109 -0
- package/src/managed-files/tree.test.ts +123 -0
- package/src/managed-files/tree.ts +118 -0
- package/src/package-target-policy.test.ts +4 -28
- package/src/package-target-policy.ts +55 -31
- package/src/platform-targets.ts +4 -0
- package/src/typecheck-test-policy.test.ts +28 -3
- package/src/typecheck-test-policy.ts +46 -121
- package/src/workspace-config-policy.test.ts +14 -2
- package/src/workspace-config-policy.ts +42 -3
- package/src/workspace-manifest.ts +327 -0
- package/src/workspace-package-policy.ts +32 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { readJson, updateJson } from 'nx/src/devkit-exports.js';
|
|
4
|
+
import { CARGO_TEST_TARGET } from './cargo-workspace.js';
|
|
5
|
+
export const MANAGED_FILES_SYNC_GENERATOR = '@smoothbricks/nx-plugin:managed-files';
|
|
4
6
|
export const BUILD_OUTPUT_DEPENDENCIES = [
|
|
5
7
|
'*-js',
|
|
6
8
|
'*-web',
|
|
@@ -12,9 +14,33 @@ export const BUILD_OUTPUT_DEPENDENCIES = [
|
|
|
12
14
|
'*-bun',
|
|
13
15
|
'*-wasm',
|
|
14
16
|
];
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS } from './platform-targets.js';
|
|
18
|
+
const buildOutputTargetSuffixes = BUILD_OUTPUT_DEPENDENCIES.map((glob) => glob.slice(1));
|
|
19
|
+
/**
|
|
20
|
+
* The glob list above, spelled as a target name: a target whose name ends in a
|
|
21
|
+
* reserved family suffix EMITS that kind of artifact. Inference collects
|
|
22
|
+
* exactly these names into the `nx:noop` build aggregate, which makes this the
|
|
23
|
+
* same rule that decides whether a hand-declared aggregate names an edge
|
|
24
|
+
* inference could have produced on its own — one definition, two readers, so
|
|
25
|
+
* the removal policy cannot drift away from what it judges redundant.
|
|
26
|
+
*/
|
|
27
|
+
export function isBuildOutputTargetName(name) {
|
|
28
|
+
return buildOutputTargetSuffixes.some((suffix) => name.endsWith(suffix));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A target whose job is to RUN tests. `test`, anything under `test-`/`test:`,
|
|
32
|
+
* and the plugin's own `cargo-test-<crate>` namespace. Deliberately name-based:
|
|
33
|
+
* the aggregate is assembled from declared AND inferred target names, and a
|
|
34
|
+
* declaration carries no marker saying "this executes rather than emits".
|
|
35
|
+
*
|
|
36
|
+
* A runner collides with the families by construction whenever its name ends in
|
|
37
|
+
* one: a crate named `…-js` puts `cargo-test-<crate>` in the family, and a bun
|
|
38
|
+
* suite named `test-bun` reads as "tool=test, output=bun". Both would drag a
|
|
39
|
+
* test suite into `build`, so the rule is the CLASS, not one namespace.
|
|
40
|
+
*/
|
|
41
|
+
export function isTestRunnerTargetName(name) {
|
|
42
|
+
return (name === 'test' || name.startsWith('test-') || name.startsWith('test:') || name.startsWith(`${CARGO_TEST_TARGET}-`));
|
|
43
|
+
}
|
|
18
44
|
const nxJsTypescriptPlugin = '@nx/js/typescript';
|
|
19
45
|
const smoothBricksNxPlugin = '@smoothbricks/nx-plugin';
|
|
20
46
|
const cleanOutputsExecutor = '@smoothbricks/nx-plugin:clean-outputs';
|
|
@@ -98,6 +124,12 @@ export function applyWorkspaceConfig(nxJson) {
|
|
|
98
124
|
nxJson.plugins = nextPlugins;
|
|
99
125
|
changed = true;
|
|
100
126
|
}
|
|
127
|
+
const sync = recordProperty(nxJson, 'sync') ?? {};
|
|
128
|
+
const generators = Array.isArray(sync.globalGenerators) ? sync.globalGenerators : [];
|
|
129
|
+
if (!generators.includes(MANAGED_FILES_SYNC_GENERATOR)) {
|
|
130
|
+
nxJson.sync = { ...sync, globalGenerators: [...generators, MANAGED_FILES_SYNC_GENERATOR] };
|
|
131
|
+
changed = true;
|
|
132
|
+
}
|
|
101
133
|
return changed;
|
|
102
134
|
}
|
|
103
135
|
/**
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type typia from 'typia';
|
|
2
|
+
/** String-keyed dependency / script / engine maps. */
|
|
3
|
+
export type StringMap = Record<string, string>;
|
|
4
|
+
/** An array statically known to hold at least one item. */
|
|
5
|
+
export type NonEmptyArray<T> = [T, ...T[]];
|
|
6
|
+
export declare function isNonEmpty<T>(items: T[]): items is NonEmptyArray<T>;
|
|
7
|
+
/** A git branch usable as a workflow push trigger; an empty string would render a trigger that matches nothing. */
|
|
8
|
+
export type BranchName = string & typia.tags.MinLength<1>;
|
|
9
|
+
/**
|
|
10
|
+
* A repository secret referenced from a workflow `env:` block. GitHub forbids creating secrets whose name
|
|
11
|
+
* starts with GITHUB_, so such a reference could only ever resolve to an empty value.
|
|
12
|
+
*/
|
|
13
|
+
export type RepositorySecretName = string & typia.tags.MinLength<1> & typia.tags.Pattern<'^(?![Gg][Ii][Tt][Hh][Uu][Bb]_)'>;
|
|
14
|
+
/** Environment variable names mapped to repository secret names. */
|
|
15
|
+
export type SecretEnvMap = Record<string, RepositorySecretName>;
|
|
16
|
+
/** A pull-request preview URL template; `{stage}` is replaced with the stage name at deploy time. */
|
|
17
|
+
export type PreviewUrlTemplate = string & typia.tags.Pattern<'.*\\{stage\\}.*'>;
|
|
18
|
+
export interface PackageRepository {
|
|
19
|
+
type?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
directory?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PackageNxConfig {
|
|
24
|
+
name?: string;
|
|
25
|
+
tags?: string[];
|
|
26
|
+
includedScripts?: string[];
|
|
27
|
+
targets?: Record<string, NxTargetConfig>;
|
|
28
|
+
}
|
|
29
|
+
export interface PackagePublishConfig {
|
|
30
|
+
access?: string;
|
|
31
|
+
/** Real registry URL for publication metadata. Resolved configuration only — never an environment placeholder in a packed package.json. */
|
|
32
|
+
registry?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PackageSmooGithubEnvironments {
|
|
35
|
+
/** GitHub Environment for the staging deploy and e2e jobs. */
|
|
36
|
+
staging?: string;
|
|
37
|
+
/** GitHub Environment for the production-on-push deploy job. */
|
|
38
|
+
production?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface PackageSmooGithub {
|
|
41
|
+
/** Action repository provider selected while generating workflows. Default: GitHub. */
|
|
42
|
+
actionsProvider?: 'github' | 'forgejo';
|
|
43
|
+
pushBranches?: NonEmptyArray<BranchName>;
|
|
44
|
+
/** GitHub Actions runs-on for managed CI (string or label list). Default: ubuntu-latest. */
|
|
45
|
+
runsOn?: string | string[];
|
|
46
|
+
environments?: PackageSmooGithubEnvironments;
|
|
47
|
+
deploySecrets?: SecretEnvMap;
|
|
48
|
+
/** Secrets exposed only to the e2e-deployment step. */
|
|
49
|
+
e2eSecrets?: SecretEnvMap;
|
|
50
|
+
/** Pull-request preview URL templates; `{stage}` is replaced with the stage name. */
|
|
51
|
+
previewUrls?: PreviewUrlTemplate[];
|
|
52
|
+
/** macOS platform job runs-on labels (string or label list). Default: macos-latest. */
|
|
53
|
+
macosRunsOn?: string | string[];
|
|
54
|
+
/** Opt in to building foreign platform artifacts on Linux without native-host runtime tests. */
|
|
55
|
+
platformProducer?: {
|
|
56
|
+
kind: 'linux-cross';
|
|
57
|
+
/** Required shell preflight, run from the repository root before toolchain setup or builds. */
|
|
58
|
+
preflight: string;
|
|
59
|
+
/** Toolchain environment on the Linux foreign-platform producer, such as an SDK path. */
|
|
60
|
+
env?: StringMap;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Platform target families the RELEASE workflow must not produce, as target
|
|
64
|
+
* globs (`*-macos`, `*-ios`, `*-linux`). A repository whose Nx graph carries
|
|
65
|
+
* a family it does not release from `publish.yml` — because another workflow
|
|
66
|
+
* owns it, or because the leg is not production yet — names it here, and the
|
|
67
|
+
* publish workflow renders without that job instead of carrying a leg whose
|
|
68
|
+
* failure blocks every release.
|
|
69
|
+
*/
|
|
70
|
+
releasePlatformFamiliesExcluded?: string[];
|
|
71
|
+
/**
|
|
72
|
+
* Sibling source checkouts a repo path-depends on (Cargo path
|
|
73
|
+
* dependencies, nix path inputs). The CI workflow clones each entry beside
|
|
74
|
+
* the main checkout before any build step runs, so the workspace layout on
|
|
75
|
+
* CI matches the developer workspace. Private sources need tokenEnv naming
|
|
76
|
+
* the repo-scoped read secret; fork PRs receive no secrets and skip the
|
|
77
|
+
* step entirely.
|
|
78
|
+
*/
|
|
79
|
+
sourceCheckouts?: PackageSourceCheckoutConfig[];
|
|
80
|
+
/** Declared Cargo private-dependency credentials; absent means no private Cargo fetch. */
|
|
81
|
+
cargoCredentials?: PackageCargoCredentialsConfig;
|
|
82
|
+
}
|
|
83
|
+
/** One declared sibling source checkout for managed CI. */
|
|
84
|
+
export interface PackageSourceCheckoutConfig {
|
|
85
|
+
/** Destination relative to the CI workspace root, e.g. `../smoothbricks`. */
|
|
86
|
+
path: string;
|
|
87
|
+
/** HTTPS clone URL of the source repository. */
|
|
88
|
+
repository: string;
|
|
89
|
+
/** Exact commit or ref to check out; the remote default branch when omitted. */
|
|
90
|
+
ref?: string;
|
|
91
|
+
/** Secret name holding the source-read credential; required for private sources. */
|
|
92
|
+
tokenEnv?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Declared opt-in for Cargo fetching private dependencies in managed CI. The
|
|
96
|
+
* generator wires the named secrets into the job environment and, for private
|
|
97
|
+
* git origins, installs a host-gated credential helper through `GIT_CONFIG_*`
|
|
98
|
+
* process environment: the token is read at helper-call time, never embedded
|
|
99
|
+
* in a URL, argv, or any stored git/cargo configuration, and an empty
|
|
100
|
+
* `credential.helper` reset keeps an ambient credential store from capturing
|
|
101
|
+
* it. Registry tokens are plain `CARGO_REGISTRIES_<NAME>_TOKEN` mappings read
|
|
102
|
+
* by Cargo's own credential provider.
|
|
103
|
+
*/
|
|
104
|
+
export interface PackageCargoCredentialsConfig {
|
|
105
|
+
/** Private git origins Cargo fetches dependencies from. */
|
|
106
|
+
gitOrigins?: PackageCargoGitOrigin[];
|
|
107
|
+
/** Credential env names Cargo's `cargo:token` provider reads for private registries. */
|
|
108
|
+
registryTokenEnvs?: string[];
|
|
109
|
+
}
|
|
110
|
+
/** One private git origin with the secret that reads it. */
|
|
111
|
+
export interface PackageCargoGitOrigin {
|
|
112
|
+
/** Credential-free https origin, e.g. `https://git.example.net`. */
|
|
113
|
+
origin: string;
|
|
114
|
+
/** Secret name holding the source-read credential for this origin. */
|
|
115
|
+
tokenEnv: string;
|
|
116
|
+
/**
|
|
117
|
+
* Internal mirror of the origin, e.g. `http://10.89.0.1:3000` for a runner
|
|
118
|
+
* that reaches its own forge over guest networking instead of the public
|
|
119
|
+
* URL. Managed CI rewrites the origin prefix to the mirror with
|
|
120
|
+
* `url.<mirror>.insteadOf` and answers the same credential for the
|
|
121
|
+
* mirror's host (git passes helpers the rewritten URL). Omitted means the
|
|
122
|
+
* origin is fetched as declared.
|
|
123
|
+
*/
|
|
124
|
+
internalMirror?: string;
|
|
125
|
+
/**
|
|
126
|
+
* SSH spellings of the same forge that managed CI rewrites onto
|
|
127
|
+
* `internalMirror` as well, e.g. `ssh://forgejo@forge.example.net:2223/`
|
|
128
|
+
* as Cargo and uv pin a git dependency. A runner holds the read token the
|
|
129
|
+
* mirror accepts and no SSH key at all, so every spelling a lockfile can
|
|
130
|
+
* carry needs its own rewrite: git matches `insteadOf` values as literal
|
|
131
|
+
* URL prefixes and infers no spelling from another — not the SSH host from
|
|
132
|
+
* the HTTPS one, and not the userless form from the one carrying a user.
|
|
133
|
+
* Each entry is a credential-free `ssh://` origin without a path; the SSH
|
|
134
|
+
* user is part of the spelling and stays in it. Requires
|
|
135
|
+
* `internalMirror`, since the entry is a rewrite source and nothing else.
|
|
136
|
+
*/
|
|
137
|
+
sshOrigins?: string[];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Declared opt-in for private npm distribution. The registry URL itself is
|
|
141
|
+
* the scoped `@scope:registry` entry in the committed .npmrc — never a
|
|
142
|
+
* required environment variable and never a shell-entry check. Token env
|
|
143
|
+
* names are taken from `.npmrc` `${VAR}` auth lines when omitted. A consumer
|
|
144
|
+
* that never publishes packages in this scope omits publishTokenEnv; a
|
|
145
|
+
* producer whose install is fully `workspace:`/`link:`/`file:` omits
|
|
146
|
+
* readTokenEnv.
|
|
147
|
+
*/
|
|
148
|
+
export interface PackagePrivateNpmConfig {
|
|
149
|
+
scope: string;
|
|
150
|
+
/** Environment variable holding the package-read token, referenced from .npmrc. */
|
|
151
|
+
readTokenEnv?: string;
|
|
152
|
+
/** Environment variable holding the separate publisher token; publishers only. */
|
|
153
|
+
publishTokenEnv?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Declared self-hosted Nx remote cache (`smoo.remoteCache`). Nx enables its
|
|
157
|
+
* HTTP cache on a nonempty NX_SELF_HOSTED_REMOTE_CACHE_SERVER and reads the
|
|
158
|
+
* credential from NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN; this declaration
|
|
159
|
+
* is what puts that pair in a managed CI job's environment and in a developer
|
|
160
|
+
* shell (tooling/direnv/secret-references.ts). Absent means every workspace
|
|
161
|
+
* keeps its own local cache and nothing is shared.
|
|
162
|
+
*
|
|
163
|
+
* The pair is emitted whole or not at all, because Nx accepts only 200 or 404
|
|
164
|
+
* from a cache server: a server without a working credential fails every task
|
|
165
|
+
* with 401 rather than missing quietly.
|
|
166
|
+
*/
|
|
167
|
+
export interface PackageRemoteCacheConfig {
|
|
168
|
+
/**
|
|
169
|
+
* Origin every runner and developer machine can reach, e.g.
|
|
170
|
+
* `https://nx-cache.example.net`. Credential-free, no path, and no trailing
|
|
171
|
+
* slash — Nx appends `/v1/cache/<hash>`, so a trailing slash requests
|
|
172
|
+
* `//v1/cache/<hash>`, which is a different route and answers 404 forever.
|
|
173
|
+
*/
|
|
174
|
+
server: string;
|
|
175
|
+
/**
|
|
176
|
+
* Origin an internal runner reaches instead of `server`, e.g.
|
|
177
|
+
* `http://10.89.0.1:8765` across a container bridge. Same declaration as a
|
|
178
|
+
* git origin's `internalMirror`: declaring it says this repository's managed
|
|
179
|
+
* runners are inside that network, so managed CI uses it and shells outside
|
|
180
|
+
* keep `server`. Omitted means CI uses `server` too.
|
|
181
|
+
*/
|
|
182
|
+
internalServer?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Repository secret holding the cache token, and the same variable name a
|
|
185
|
+
* developer shell resolves locally (an ambient value or a `smoo.secrets`
|
|
186
|
+
* entry). A read-only token here keeps an untrusted context reading the
|
|
187
|
+
* cache without being able to publish into it.
|
|
188
|
+
*/
|
|
189
|
+
tokenSecret: RepositorySecretName;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A `smoo.secrets` group: which operation resolves the credential. One argv
|
|
193
|
+
* word of `smoo secrets run <group> <command...>`, so whitespace would make
|
|
194
|
+
* that command unwritable. Only the shape is validated — the values are the
|
|
195
|
+
* repository's, and a new group must not need a new smoo release.
|
|
196
|
+
*/
|
|
197
|
+
export type SecretGroupName = string & typia.tags.MinLength<1> & typia.tags.Pattern<'^\\S+$'>;
|
|
198
|
+
/**
|
|
199
|
+
* Local bootstrap fallback; existing environment values always take
|
|
200
|
+
* precedence, and CI injects these variables instead of running commands.
|
|
201
|
+
*
|
|
202
|
+
* Shell entry resolves the `shell` group and nothing else; every other group
|
|
203
|
+
* is resolved by `smoo secrets run <group> <command...>`, the one command
|
|
204
|
+
* that needs it. The group is DERIVED from what this manifest already
|
|
205
|
+
* declares — a variable `.npmrc` interpolates as `${VAR}` is `registry`, the
|
|
206
|
+
* variable `smoo.remoteCache.tokenSecret` names is `nx-cache`, everything
|
|
207
|
+
* else is `shell` — so `group` below is only for what those declarations
|
|
208
|
+
* cannot say. The routing lives in tooling/direnv/secret-references.ts,
|
|
209
|
+
* whose header states the rule and the derivation.
|
|
210
|
+
*/
|
|
211
|
+
export interface PackageSecretCommand {
|
|
212
|
+
/** Executed directly, without a shell; stdout supplies the secret value. */
|
|
213
|
+
command: NonEmptyArray<string>;
|
|
214
|
+
/** Overrides the derived group; absent derives one from this manifest and `.npmrc`. */
|
|
215
|
+
group?: SecretGroupName;
|
|
216
|
+
}
|
|
217
|
+
export interface PackageSmooConfig {
|
|
218
|
+
github?: PackageSmooGithub;
|
|
219
|
+
privateNpm?: PackagePrivateNpmConfig;
|
|
220
|
+
/** Declared self-hosted Nx remote cache; absent means local caching only. */
|
|
221
|
+
remoteCache?: PackageRemoteCacheConfig;
|
|
222
|
+
/** Provider-neutral local secret commands. CI supplies these variables externally. */
|
|
223
|
+
secrets?: Record<string, PackageSecretCommand>;
|
|
224
|
+
}
|
|
225
|
+
export interface PackageWorkspacesObject {
|
|
226
|
+
packages?: string[];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* package.json shape used by smoo. Optional fields stay optional so partial
|
|
230
|
+
* manifests parse; mutation helpers create nested objects on demand.
|
|
231
|
+
*/
|
|
232
|
+
export interface PackageJson {
|
|
233
|
+
name?: string;
|
|
234
|
+
version?: string;
|
|
235
|
+
private?: boolean;
|
|
236
|
+
license?: string;
|
|
237
|
+
types?: string;
|
|
238
|
+
typings?: string;
|
|
239
|
+
packageManager?: string;
|
|
240
|
+
files?: string[];
|
|
241
|
+
bin?: string | StringMap;
|
|
242
|
+
exports?: PackageExports;
|
|
243
|
+
workspaces?: string[] | PackageWorkspacesObject;
|
|
244
|
+
dependencies?: StringMap;
|
|
245
|
+
devDependencies?: StringMap;
|
|
246
|
+
peerDependencies?: StringMap;
|
|
247
|
+
optionalDependencies?: StringMap;
|
|
248
|
+
/** Bun patchedDependencies map (package@version → patch path). */
|
|
249
|
+
patchedDependencies?: StringMap;
|
|
250
|
+
engines?: StringMap;
|
|
251
|
+
scripts?: StringMap;
|
|
252
|
+
publishConfig?: PackagePublishConfig;
|
|
253
|
+
repository?: string | PackageRepository;
|
|
254
|
+
nx?: PackageNxConfig;
|
|
255
|
+
smoo?: PackageSmooConfig;
|
|
256
|
+
}
|
|
257
|
+
/** Recursive package exports map (conditions nest arbitrarily). */
|
|
258
|
+
export type PackageExports = string | PackageExportMap | null | undefined;
|
|
259
|
+
export interface PackageExportMap {
|
|
260
|
+
[condition: string]: PackageExports;
|
|
261
|
+
}
|
|
262
|
+
export interface NxDependsOnObject {
|
|
263
|
+
target: string;
|
|
264
|
+
projects?: string | string[];
|
|
265
|
+
}
|
|
266
|
+
export type NxDependsOn = string | NxDependsOnObject;
|
|
267
|
+
/** Nx target options are executor-specific open bags. */
|
|
268
|
+
export type NxTargetOptions = Record<string, unknown>;
|
|
269
|
+
export type NxInput = string | object;
|
|
270
|
+
export interface NxTargetConfig {
|
|
271
|
+
executor?: string;
|
|
272
|
+
dependsOn?: NxDependsOn[];
|
|
273
|
+
outputs?: string[];
|
|
274
|
+
inputs?: NxInput[];
|
|
275
|
+
options?: NxTargetOptions;
|
|
276
|
+
configurations?: Record<string, NxTargetConfig>;
|
|
277
|
+
cache?: boolean;
|
|
278
|
+
command?: string;
|
|
279
|
+
parallelism?: boolean;
|
|
280
|
+
}
|
|
281
|
+
export interface NxProjectJson {
|
|
282
|
+
name?: string;
|
|
283
|
+
root?: string;
|
|
284
|
+
tags?: string[];
|
|
285
|
+
targets?: Record<string, NxTargetConfig>;
|
|
286
|
+
}
|
|
287
|
+
export interface NxJson {
|
|
288
|
+
namedInputs?: Record<string, Array<string | Record<string, unknown>> | string>;
|
|
289
|
+
}
|
|
290
|
+
export declare function ciPushBranches(github: PackageSmooGithub | undefined): NonEmptyArray<string>;
|
|
291
|
+
//# sourceMappingURL=workspace-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-manifest.d.ts","sourceRoot":"","sources":["../src/workspace-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,CAEnE;AAED,mHAAmH;AACnH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAE1D;;;GA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C;AAEtC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;CAChF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAE3F"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PackageJson } from './workspace-manifest.js';
|
|
2
|
+
export interface RepositoryInfo {
|
|
3
|
+
type: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const smoothBricksCodebasePackageName = "@smoothbricks/codebase";
|
|
7
|
+
export declare function isSmoothBricksCodebasePackageName(name: string | undefined): boolean;
|
|
8
|
+
export declare function isPublishablePackage(pkg: {
|
|
9
|
+
private: boolean;
|
|
10
|
+
tags: string[];
|
|
11
|
+
}): boolean;
|
|
12
|
+
export declare function repositoryInfo(pkg: PackageJson): RepositoryInfo | null;
|
|
13
|
+
//# sourceMappingURL=workspace-package-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-package-policy.d.ts","sourceRoot":"","sources":["../src/workspace-package-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AACD,eAAO,MAAM,+BAA+B,2BAA2B,CAAC;AACxE,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEnF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,CAKvF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAatE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const smoothBricksCodebasePackageName = '@smoothbricks/codebase';
|
|
2
|
+
export function isSmoothBricksCodebasePackageName(name) {
|
|
3
|
+
return name === smoothBricksCodebasePackageName;
|
|
4
|
+
}
|
|
5
|
+
export function isPublishablePackage(pkg) {
|
|
6
|
+
if (pkg.private) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return pkg.tags.includes('npm:public') !== pkg.tags.includes('npm:private');
|
|
10
|
+
}
|
|
11
|
+
export function repositoryInfo(pkg) {
|
|
12
|
+
const repository = pkg.repository;
|
|
13
|
+
if (typeof repository === 'string') {
|
|
14
|
+
return { type: 'git', url: repository };
|
|
15
|
+
}
|
|
16
|
+
if (!repository || typeof repository !== 'object') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const url = repository.url;
|
|
20
|
+
if (!url) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return { type: repository.type ?? 'git', url };
|
|
24
|
+
}
|
package/generators.json
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"factory": "./dist/generators/make-public/generator.js",
|
|
20
20
|
"schema": "./src/generators/make-public/schema.json",
|
|
21
21
|
"description": "Promote a private package to public npm publication"
|
|
22
|
+
},
|
|
23
|
+
"managed-files": {
|
|
24
|
+
"factory": "./dist/managed-files/generator.js",
|
|
25
|
+
"schema": "./src/managed-files/schema.json",
|
|
26
|
+
"description": "Synchronize managed monorepo files from workspace conventions and the Nx graph"
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Worktrees inherit the real project .envrc once, then stop. The same file is
|
|
2
|
+
# checked out inside .jcode-worktrees, so continuing after source_up_if_exists
|
|
3
|
+
# would run the devenv setup twice while sandbox blocks access to tooling/.
|
|
4
|
+
case "$PWD" in
|
|
5
|
+
*/.jcode-worktrees/*)
|
|
6
|
+
;;
|
|
7
|
+
*)
|
|
8
|
+
source_up_if_exists
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
watch_file tooling/direnv/envrc.sh
|
|
13
|
+
|
|
14
|
+
# Load local extensions and overrides from the project root (the gitignored
|
|
15
|
+
# .envrc-local); capture it before we cd into tooling/direnv, since envrc.sh
|
|
16
|
+
# leaves us there and a bare relative path would resolve under tooling/direnv.
|
|
17
|
+
local_override="$PWD/.envrc-local"
|
|
18
|
+
cd tooling/direnv
|
|
19
|
+
. envrc.sh
|
|
20
|
+
source_env_if_exists "$local_override"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# git-format-staged configuration for SmoothBricks-style monorepos
|
|
2
|
+
|
|
3
|
+
formatters:
|
|
4
|
+
# ESLint for Astro files (run first as it only handles .astro files)
|
|
5
|
+
eslint:
|
|
6
|
+
command: "eslint-stdout '{}'"
|
|
7
|
+
patterns:
|
|
8
|
+
- '*.astro'
|
|
9
|
+
- '!.*' # Exclude hidden files
|
|
10
|
+
|
|
11
|
+
# Biome for JS/TS family (including CommonJS/CTS and ESM .mjs/.mts)
|
|
12
|
+
biome:
|
|
13
|
+
command: "biome check --files-ignore-unknown=true --use-editorconfig=true '--stdin-file-path={}' --fix"
|
|
14
|
+
patterns:
|
|
15
|
+
- '*.js'
|
|
16
|
+
- '*.cjs'
|
|
17
|
+
- '*.mjs'
|
|
18
|
+
- '*.ts'
|
|
19
|
+
- '*.cts'
|
|
20
|
+
- '*.mts'
|
|
21
|
+
- '*.jsx'
|
|
22
|
+
- '*.tsx'
|
|
23
|
+
- '*.json'
|
|
24
|
+
- '*.jsonc'
|
|
25
|
+
- '*.html'
|
|
26
|
+
- '*.css'
|
|
27
|
+
- '*.graphql'
|
|
28
|
+
|
|
29
|
+
# Prettier for all other files (mainly Markdown)
|
|
30
|
+
prettier:
|
|
31
|
+
command: "prettier --ignore-unknown --stdin-filepath '{}'"
|
|
32
|
+
patterns:
|
|
33
|
+
# Match all files
|
|
34
|
+
- '*'
|
|
35
|
+
# Exclude files handled by Biome
|
|
36
|
+
- '!*.js'
|
|
37
|
+
- '!*.cjs'
|
|
38
|
+
- '!*.mjs'
|
|
39
|
+
- '!*.ts'
|
|
40
|
+
- '!*.cts'
|
|
41
|
+
- '!*.mts'
|
|
42
|
+
- '!*.jsx'
|
|
43
|
+
- '!*.tsx'
|
|
44
|
+
- '!*.json'
|
|
45
|
+
- '!*.jsonc'
|
|
46
|
+
- '!*.html'
|
|
47
|
+
- '!*.css'
|
|
48
|
+
- '!*.graphql'
|
|
49
|
+
# Exclude files handled by rustfmt
|
|
50
|
+
- '!*.rs'
|
|
51
|
+
# Exclude files handled by Alejandra
|
|
52
|
+
- '!*.nix'
|
|
53
|
+
# Bun lockfiles are generated and should not be rewritten by Prettier
|
|
54
|
+
- '!bun.lock'
|
|
55
|
+
# Cargo lockfiles are generated and should not be rewritten by Prettier
|
|
56
|
+
- '!Cargo.lock'
|
|
57
|
+
# Binary artifacts: not text, nothing for Prettier to do.
|
|
58
|
+
- '!*.wasm'
|
|
59
|
+
- '!*.wasm.sha256'
|
|
60
|
+
# Prettier has no parser for these; --ignore-unknown swallows stdin and
|
|
61
|
+
# emits nothing, so formatting them would truncate the file.
|
|
62
|
+
- '!*.jsonl'
|
|
63
|
+
- '!*.tsv'
|
|
64
|
+
# Workflow templates carry __SMOO_*__ placeholders in key position and are
|
|
65
|
+
# not YAML until rendered; the rendered copies are formatted on write.
|
|
66
|
+
- '!packages/nx-plugin/managed/templates/github/workflows/*.yml'
|
|
67
|
+
|
|
68
|
+
# rustfmt for Rust files
|
|
69
|
+
rustfmt:
|
|
70
|
+
command: 'rustfmt --edition 2024'
|
|
71
|
+
patterns:
|
|
72
|
+
- '*.rs'
|
|
73
|
+
|
|
74
|
+
# Alejandra for Nix files
|
|
75
|
+
alejandra:
|
|
76
|
+
command: 'alejandra'
|
|
77
|
+
patterns:
|
|
78
|
+
- '*.nix'
|
|
79
|
+
|
|
80
|
+
settings:
|
|
81
|
+
update_working_tree: true
|
|
82
|
+
show_commands: true # Verbose output
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# smoo-managed. Keep the newer runtime version pins on any merge (especially a
|
|
2
|
+
# mirror sync's `git am --3way`) instead of stalling on a conflict. The driver
|
|
3
|
+
# `smoo-newer-pins` is defined by `smoo` (git config, installed at devenv setup)
|
|
4
|
+
# and implemented in tooling/direnv/merge-newer-pins.sh. Files not present in a
|
|
5
|
+
# given repo are simply ignored.
|
|
6
|
+
tooling/direnv/nixpkgs-overlay/_sources/generated.json merge=smoo-newer-pins
|
|
7
|
+
tooling/direnv/nixpkgs-overlay/_sources/generated.nix merge=smoo-newer-pins
|
|
8
|
+
tooling/direnv/devenv.lock merge=smoo-newer-pins
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Wrapper script to run devenv from anywhere in the monorepo
|
|
3
|
+
# This allows us to keep all devenv files in tooling/direnv
|
|
4
|
+
|
|
5
|
+
# Save the current working directory
|
|
6
|
+
ORIGINAL_PWD="$(pwd)"
|
|
7
|
+
SELF_PATH="$(realpath "$0")"
|
|
8
|
+
|
|
9
|
+
# Locate this repository's tooling/ from the INVOCATION path, not from
|
|
10
|
+
# realpath($0). WHY: tooling/devenv is a symlink into
|
|
11
|
+
# packages/nx-plugin/managed/raw/tooling/, so realpath lands inside the managed
|
|
12
|
+
# template, whose tooling/direnv holds no devenv.yaml — `devenv update` then ran
|
|
13
|
+
# against a directory with nothing to update, printed nothing, and exited 0. A
|
|
14
|
+
# lock-updating command that silently succeeds without updating anything is the
|
|
15
|
+
# worst possible failure, so resolve the directory lexically (only the leaf is a
|
|
16
|
+
# symlink; tooling/ itself is real) and refuse to run if the config is absent.
|
|
17
|
+
TOOLING_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
18
|
+
DEVENV_DIR="$TOOLING_DIR/direnv"
|
|
19
|
+
if [ ! -d "$DEVENV_DIR" ]; then
|
|
20
|
+
echo "Error: Could not find devenv directory at $DEVENV_DIR" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
if [ ! -f "$DEVENV_DIR/devenv.yaml" ] && [ ! -f "$DEVENV_DIR/devenv.nix" ]; then
|
|
24
|
+
echo "Error: $DEVENV_DIR holds no devenv.yaml or devenv.nix." >&2
|
|
25
|
+
echo " Refusing to run: devenv would report success having done nothing." >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Find the actual Nix-built devenv binary, skipping every wrapper script.
|
|
30
|
+
# WHY: PATH routinely holds more than one of these wrappers at once — this
|
|
31
|
+
# repo's tooling/devenv, sibling repos' wrappers, and direnv-stacked parent
|
|
32
|
+
# environments. A plain "not equal to SELF_PATH" check happily selects a
|
|
33
|
+
# *different* wrapper and exec's it, so `devenv` bounces into the wrong repo
|
|
34
|
+
# (or self-execs forever on cheap checks like `devenv version`). The real devenv
|
|
35
|
+
# is always the Nix-managed executable under /nix/store, so match that and ignore
|
|
36
|
+
# every wrapper regardless of PATH ordering. (Matching the store path is also more
|
|
37
|
+
# robust than a "is it a binary" test: Nix sometimes ships tools as makeWrapper
|
|
38
|
+
# shell scripts, which are still the correct entry point.)
|
|
39
|
+
DEVENV_BIN=""
|
|
40
|
+
while IFS= read -r candidate; do
|
|
41
|
+
candidate_path="$(realpath "$candidate")"
|
|
42
|
+
case "$candidate_path" in
|
|
43
|
+
/nix/store/*)
|
|
44
|
+
if [ -f "$candidate_path" ] && [ -x "$candidate_path" ]; then
|
|
45
|
+
DEVENV_BIN="$candidate_path"
|
|
46
|
+
break
|
|
47
|
+
fi
|
|
48
|
+
;;
|
|
49
|
+
esac
|
|
50
|
+
done < <(which -a devenv 2>/dev/null)
|
|
51
|
+
|
|
52
|
+
if [ -z "$DEVENV_BIN" ]; then
|
|
53
|
+
echo "Error: Could not find the Nix-built devenv binary (under /nix/store) in PATH" >&2
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# If we're in a project, just run devenv
|
|
58
|
+
if [ -f devenv.nix ]; then
|
|
59
|
+
exec "$DEVENV_BIN" "$@"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# Change to the tooling/direnv directory where devenv files are located
|
|
63
|
+
cd "$DEVENV_DIR" || exit 1
|
|
64
|
+
|
|
65
|
+
# Export the original directory so enterShell can use it
|
|
66
|
+
export DEVENV_SHELL_PWD="$ORIGINAL_PWD"
|
|
67
|
+
|
|
68
|
+
# Run the actual devenv command with all arguments passed through.
|
|
69
|
+
# For updates, refresh nvfetcher-managed overlay sources first so packages like
|
|
70
|
+
# overlay tools are current before devenv.lock is updated.
|
|
71
|
+
if [ "${1:-}" = "update" ]; then
|
|
72
|
+
if [ -f "$DEVENV_DIR/nixpkgs-overlay/nvfetcher.toml" ]; then
|
|
73
|
+
echo "Running nvfetcher for nixpkgs-overlay/..."
|
|
74
|
+
(cd "$DEVENV_DIR/nixpkgs-overlay" && echo "
|
|
75
|
+
[keys]
|
|
76
|
+
github = \"$(gh auth token)\"
|
|
77
|
+
" > .gh-auth && (nvfetcher -k .gh-auth -o _sources || true) && rm .gh-auth)
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
exec "$DEVENV_BIN" "$@"
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
exec "$DEVENV_BIN" "$@"
|