@smoothbricks/nx-plugin 0.2.5 → 0.3.1
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/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +44 -3
- package/dist/generators/create-package/generator.js +29 -2
- package/dist/generators/make-public/generator.js +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +192 -5
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +4 -2
- package/dist/version-actions.cjs +8 -3
- package/dist/version-actions.d.cts.map +1 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +8 -34
- package/package.json +3 -3
- package/src/bounded-test-policy.ts +46 -3
- package/src/generators/create-package/generator.ts +37 -9
- package/src/generators/make-public/generator.ts +5 -1
- package/src/index.test.ts +180 -9
- package/src/index.ts +210 -5
- package/src/package-target-policy.test.ts +9 -1
- package/src/release-config-policy.test.ts +22 -11
- package/src/typecheck-test-policy.test.ts +85 -38
- package/src/typecheck-test-policy.ts +6 -2
- package/src/version-actions.cts +12 -5
- package/src/workspace-config-policy.test.ts +37 -57
- package/src/workspace-config-policy.ts +11 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-test-policy.d.ts","sourceRoot":"","sources":["../src/bounded-test-policy.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAC5E,eAAO,MAAM,uBAAuB,SAAU,CAAC;AAC/C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAKjD,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACnD,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mCAAmC;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,4BAA4B,EACzC,OAAO,EAAE,mCAAmC,GAC3C,IAAI,
|
|
1
|
+
{"version":3,"file":"bounded-test-policy.d.ts","sourceRoot":"","sources":["../src/bounded-test-policy.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAC5E,eAAO,MAAM,uBAAuB,SAAU,CAAC;AAC/C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAKjD,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACnD,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mCAAmC;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,4BAA4B,EACzC,OAAO,EAAE,mCAAmC,GAC3C,IAAI,CAuBN;AAED,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA0B3E;AAED,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAyB5F;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,4BAA4B,EACzC,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAmBT;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,4BAA4B,EACzC,cAAc,SAAa,EAC3B,WAAW,CAAC,EAAE,4BAA4B,GACzC,MAAM,CAER;AA+CD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAmC,GAAG,MAAM,CAa9G"}
|
|
@@ -10,7 +10,11 @@ export const BOUNDED_TEST_KILL_AFTER_MS = 10_000;
|
|
|
10
10
|
export const BOUNDED_TEST_PER_TEST_TIMEOUT_MS = 30_000;
|
|
11
11
|
export function applyBoundedTestTargetPolicy(packageJson, options) {
|
|
12
12
|
const command = resolveTestCommand(packageJson, options.defaultCommand ?? 'bun test', options.projectJson);
|
|
13
|
-
|
|
13
|
+
let targetOwner = options.projectJson;
|
|
14
|
+
if (!targetOwner) {
|
|
15
|
+
packageJson.nx ??= {};
|
|
16
|
+
targetOwner = packageJson.nx;
|
|
17
|
+
}
|
|
14
18
|
targetOwner.targets ??= {};
|
|
15
19
|
const existingTestTarget = targetOwner.targets.test;
|
|
16
20
|
const nextTestTarget = isRecord(existingTestTarget) ? { ...existingTestTarget } : {};
|
|
@@ -186,13 +190,50 @@ function listWorkspacePackageJsonPaths(root) {
|
|
|
186
190
|
return paths.sort((a, b) => a.localeCompare(b));
|
|
187
191
|
}
|
|
188
192
|
function readPackageJson(path) {
|
|
189
|
-
|
|
193
|
+
const parsed = readJsonObject(path);
|
|
194
|
+
const nx = isRecord(parsed.nx) ? parsed.nx : undefined;
|
|
195
|
+
const normalizedNx = nx
|
|
196
|
+
? {
|
|
197
|
+
...nx,
|
|
198
|
+
name: typeof nx.name === 'string' ? nx.name : undefined,
|
|
199
|
+
targets: readTargets(nx.targets),
|
|
200
|
+
}
|
|
201
|
+
: undefined;
|
|
202
|
+
return {
|
|
203
|
+
...parsed,
|
|
204
|
+
name: typeof parsed.name === 'string' ? parsed.name : undefined,
|
|
205
|
+
workspaces: parsed.workspaces,
|
|
206
|
+
scripts: isRecord(parsed.scripts) ? parsed.scripts : undefined,
|
|
207
|
+
nx: normalizedNx,
|
|
208
|
+
};
|
|
190
209
|
}
|
|
191
210
|
function writePackageJson(path, packageJson) {
|
|
192
211
|
writeFileSync(path, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
193
212
|
}
|
|
194
213
|
function readProjectJson(path) {
|
|
195
|
-
|
|
214
|
+
const parsed = readJsonObject(path);
|
|
215
|
+
return {
|
|
216
|
+
...parsed,
|
|
217
|
+
name: typeof parsed.name === 'string' ? parsed.name : undefined,
|
|
218
|
+
targets: readTargets(parsed.targets),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function readJsonObject(path) {
|
|
222
|
+
const parsed = JSON.parse(readFileSync(path, 'utf8'));
|
|
223
|
+
if (!isRecord(parsed)) {
|
|
224
|
+
throw new Error(`${path} must contain a JSON object`);
|
|
225
|
+
}
|
|
226
|
+
return parsed;
|
|
227
|
+
}
|
|
228
|
+
function readTargets(value) {
|
|
229
|
+
if (!isRecord(value)) {
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
const targets = {};
|
|
233
|
+
for (const [name, target] of Object.entries(value)) {
|
|
234
|
+
targets[name] = isRecord(target) ? target : {};
|
|
235
|
+
}
|
|
236
|
+
return targets;
|
|
196
237
|
}
|
|
197
238
|
function writeProjectJson(path, projectJson) {
|
|
198
239
|
writeFileSync(path, `${JSON.stringify(projectJson, null, 2)}\n`);
|
|
@@ -112,14 +112,18 @@ function buildPackageJson(schema, packageName, projectRoot, rootPkg) {
|
|
|
112
112
|
packageJson.license = 'MIT';
|
|
113
113
|
packageJson.publishConfig = { access: 'public' };
|
|
114
114
|
const rootRepository = rootPkg.repository;
|
|
115
|
-
if (rootRepository
|
|
115
|
+
if (isRecord(rootRepository)) {
|
|
116
116
|
packageJson.repository = {
|
|
117
117
|
type: rootRepository.type ?? 'git',
|
|
118
118
|
url: rootRepository.url,
|
|
119
119
|
directory: projectRoot,
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
const nx = packageJson.nx;
|
|
123
|
+
if (!isRecord(nx)) {
|
|
124
|
+
throw new Error('generated package.json nx configuration must be an object');
|
|
125
|
+
}
|
|
126
|
+
nx.tags = ['npm:public'];
|
|
123
127
|
}
|
|
124
128
|
else {
|
|
125
129
|
packageJson.private = true;
|
|
@@ -131,11 +135,23 @@ function writeZigFiles(tree, schema, projectRoot) {
|
|
|
131
135
|
const packageJson = readJson(tree, `${projectRoot}/package.json`);
|
|
132
136
|
// Add wasm export and remove development condition
|
|
133
137
|
const exports = packageJson.exports;
|
|
138
|
+
if (!isRecord(exports)) {
|
|
139
|
+
// invariant throw: writeCommonFiles always emits an object-valued exports map.
|
|
140
|
+
throw new Error('generated package.json exports must be an object');
|
|
141
|
+
}
|
|
134
142
|
exports['./wasm'] = `./dist/${schema.name}.wasm`;
|
|
135
143
|
const dotExport = exports['.'];
|
|
144
|
+
if (!isRecord(dotExport)) {
|
|
145
|
+
// invariant throw: writeCommonFiles always emits an object-valued "." export.
|
|
146
|
+
throw new Error('generated package.json "." export must be an object');
|
|
147
|
+
}
|
|
136
148
|
delete dotExport.development;
|
|
137
149
|
// Add build scripts
|
|
138
150
|
const scripts = packageJson.scripts;
|
|
151
|
+
if (!isRecord(scripts)) {
|
|
152
|
+
// invariant throw: writeCommonFiles always emits an object-valued scripts map.
|
|
153
|
+
throw new Error('generated package.json scripts must be an object');
|
|
154
|
+
}
|
|
139
155
|
scripts['build:zig'] = `nx run ${schema.name}:zig-wasm`;
|
|
140
156
|
scripts['build:ts'] = `nx run ${schema.name}:tsc-js`;
|
|
141
157
|
scripts.build = 'bun run build:ts && bun run build:zig';
|
|
@@ -145,6 +161,10 @@ function writeZigFiles(tree, schema, projectRoot) {
|
|
|
145
161
|
// Modify tsconfig.lib.json for ts-zig
|
|
146
162
|
const tsconfigLib = readJson(tree, `${projectRoot}/tsconfig.lib.json`);
|
|
147
163
|
const libCompilerOptions = tsconfigLib.compilerOptions;
|
|
164
|
+
if (!isRecord(libCompilerOptions)) {
|
|
165
|
+
// invariant throw: writeCommonFiles always emits compilerOptions for library builds.
|
|
166
|
+
throw new Error('generated tsconfig.lib.json compilerOptions must be an object');
|
|
167
|
+
}
|
|
148
168
|
libCompilerOptions.lib = ['es2022', 'webworker'];
|
|
149
169
|
libCompilerOptions.declaration = true;
|
|
150
170
|
libCompilerOptions.sourceMap = true;
|
|
@@ -153,6 +173,10 @@ function writeZigFiles(tree, schema, projectRoot) {
|
|
|
153
173
|
// Modify tsconfig.test.json for ts-zig
|
|
154
174
|
const tsconfigTest = readJson(tree, `${projectRoot}/tsconfig.test.json`);
|
|
155
175
|
const testCompilerOptions = tsconfigTest.compilerOptions;
|
|
176
|
+
if (!isRecord(testCompilerOptions)) {
|
|
177
|
+
// invariant throw: writeCommonFiles always emits compilerOptions for test builds.
|
|
178
|
+
throw new Error('generated tsconfig.test.json compilerOptions must be an object');
|
|
179
|
+
}
|
|
156
180
|
testCompilerOptions.lib = ['es2022', 'webworker'];
|
|
157
181
|
writeJson(tree, `${projectRoot}/tsconfig.test.json`, tsconfigTest);
|
|
158
182
|
// Write build.zig
|
|
@@ -202,3 +226,6 @@ pub fn build(b: *std.Build) void {
|
|
|
202
226
|
}
|
|
203
227
|
`);
|
|
204
228
|
}
|
|
229
|
+
function isRecord(value) {
|
|
230
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
231
|
+
}
|
|
@@ -20,7 +20,7 @@ export default async function generator(tree, schema) {
|
|
|
20
20
|
directory: resolved.root,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const nx = (pkg.nx
|
|
23
|
+
const nx = isRecord(pkg.nx) ? pkg.nx : {};
|
|
24
24
|
const tags = Array.isArray(nx.tags) ? [...nx.tags] : [];
|
|
25
25
|
if (!tags.includes('npm:public')) {
|
|
26
26
|
tags.push('npm:public');
|
|
@@ -33,6 +33,9 @@ export default async function generator(tree, schema) {
|
|
|
33
33
|
return pkg;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
function isRecord(value) {
|
|
37
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
38
|
+
}
|
|
36
39
|
function resolveProject(tree, projectInput) {
|
|
37
40
|
const normalizedInput = normalizeLookupValue(projectInput);
|
|
38
41
|
for (const [name, config] of getProjects(tree)) {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,aAAa,EAAuB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,aAAa,EAAuB,MAAM,0BAA0B,CAAC;AAsDxG,eAAO,MAAM,aAAa,EAAE,aAsB3B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,48 @@ const RESERVED_ZIG_STEPS = new Set(['all', 'clean', 'install', 'test']);
|
|
|
7
7
|
const ZIG_STEP_PATTERN = /\bb\.step\(\s*["']([^"']+)["']\s*,/g;
|
|
8
8
|
const VALID_ZIG_STEP_NAME = /^[A-Za-z0-9_-]+$/;
|
|
9
9
|
const BUILD_OUTPUT_TARGET_PATTERN = /-(?:js|web|html|css|ios|android|native|napi|bun|wasm)$/;
|
|
10
|
+
const TYPESCRIPT_TOOLCHAIN_INPUTS = [
|
|
11
|
+
'{workspaceRoot}/package.json',
|
|
12
|
+
'{workspaceRoot}/bun.lock',
|
|
13
|
+
'{workspaceRoot}/patches/**/*',
|
|
14
|
+
'{workspaceRoot}/tsconfig.base.json',
|
|
15
|
+
];
|
|
16
|
+
// Cargo workspace inference: a package.json sitting next to a Cargo.toml that
|
|
17
|
+
// declares [workspace] gets direct cargo-test/test targets, cargo-lint feeding
|
|
18
|
+
// the lint aggregate, mutation (cargo-mutants), bench, and — per cdylib member
|
|
19
|
+
// crate whose package name ends in `-wasm` — a cargo-wasm build producing
|
|
20
|
+
// dist/<crate>.wasm. Explicit nx.targets entries in the package.json always win
|
|
21
|
+
// over inference.
|
|
22
|
+
const CARGO_WORKSPACE_PATTERN = /^\s*\[workspace\]/m;
|
|
23
|
+
const CARGO_MEMBERS_PATTERN = /^\s*members\s*=\s*\[([^\]]*)\]/m;
|
|
24
|
+
const CARGO_MEMBER_ENTRY_PATTERN = /["']([^"']+)["']/g;
|
|
25
|
+
const CARGO_PACKAGE_NAME_PATTERN = /^\s*name\s*=\s*["']([^"']+)["']/m;
|
|
26
|
+
const CARGO_WASM_CRATE_NAME_PATTERN = /-wasm$/;
|
|
27
|
+
const CARGO_CDYLIB_CRATE_TYPE_PATTERN = /^\s*crate-type\s*=\s*\[[^\]]*["']cdylib["']/m;
|
|
28
|
+
const CARGO_WASM_RELEASE_PROFILE_PATTERN = /^\s*\[profile\.wasm-release\]/m;
|
|
29
|
+
const CARGO_INPUTS = [
|
|
30
|
+
'{projectRoot}/**/*.rs',
|
|
31
|
+
'{projectRoot}/**/Cargo.toml',
|
|
32
|
+
'{projectRoot}/Cargo.lock',
|
|
33
|
+
'{projectRoot}/.cargo/config.toml',
|
|
34
|
+
'!{projectRoot}/target/**',
|
|
35
|
+
];
|
|
36
|
+
function createCargoTestTarget(projectRoot) {
|
|
37
|
+
return {
|
|
38
|
+
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
39
|
+
cache: true,
|
|
40
|
+
inputs: CARGO_INPUTS,
|
|
41
|
+
options: {
|
|
42
|
+
command: 'cargo test --workspace',
|
|
43
|
+
cwd: projectRoot,
|
|
44
|
+
timeoutMs: 600000,
|
|
45
|
+
killAfterMs: 10000,
|
|
46
|
+
},
|
|
47
|
+
configurations: {
|
|
48
|
+
production: { command: 'cargo test --workspace --release' },
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
10
52
|
export const createNodesV2 = [
|
|
11
53
|
'**/package.json',
|
|
12
54
|
async (projectConfigurationFiles, _options, context) => {
|
|
@@ -35,13 +77,44 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
35
77
|
const validationTargets = [];
|
|
36
78
|
const hasLibTsconfig = existsSync(join(absoluteProjectRoot, 'tsconfig.lib.json'));
|
|
37
79
|
let hasBuildOutputTarget = hasLibTsconfig || hasPackageLocalBuildOutputTarget(packageJson);
|
|
80
|
+
if (hasLibTsconfig) {
|
|
81
|
+
// Official Nx target inference is disabled because its compiler surface only
|
|
82
|
+
// supports tsc/tsgo. Smoo owns the complete transformer-aware ttsc targets.
|
|
83
|
+
targets['tsc-js'] = {
|
|
84
|
+
executor: 'nx:run-commands',
|
|
85
|
+
cache: true,
|
|
86
|
+
inputs: ['production', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.lib.json'],
|
|
87
|
+
outputs: [
|
|
88
|
+
'{projectRoot}/dist/**/*.{js,cjs,mjs,jsx,d.ts,d.cts,d.mts}{,.map}',
|
|
89
|
+
'{projectRoot}/dist/.build.tsbuildinfo',
|
|
90
|
+
],
|
|
91
|
+
dependsOn: ['^tsc-js'],
|
|
92
|
+
options: {
|
|
93
|
+
command: 'ttsc -p tsconfig.lib.json --emit',
|
|
94
|
+
cwd: projectRoot,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
targets.typecheck = {
|
|
98
|
+
executor: 'nx:run-commands',
|
|
99
|
+
cache: true,
|
|
100
|
+
inputs: ['production', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.lib.json'],
|
|
101
|
+
outputs: [],
|
|
102
|
+
dependsOn: ['^tsc-js'],
|
|
103
|
+
options: {
|
|
104
|
+
command: 'ttsc -p tsconfig.lib.json --noEmit',
|
|
105
|
+
cwd: projectRoot,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
38
109
|
const hasTestTsconfig = existsSync(join(absoluteProjectRoot, 'tsconfig.test.json'));
|
|
39
110
|
if (hasTestTsconfig) {
|
|
40
111
|
targets['typecheck-tests'] = {
|
|
41
112
|
executor: 'nx:run-commands',
|
|
42
113
|
cache: true,
|
|
114
|
+
inputs: ['default', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.test.json'],
|
|
115
|
+
dependsOn: ['typecheck'],
|
|
43
116
|
options: {
|
|
44
|
-
command: '
|
|
117
|
+
command: 'ttsc -p tsconfig.test.json --noEmit',
|
|
45
118
|
cwd: projectRoot,
|
|
46
119
|
},
|
|
47
120
|
};
|
|
@@ -49,7 +122,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
49
122
|
executor: 'nx:run-commands',
|
|
50
123
|
continuous: true,
|
|
51
124
|
options: {
|
|
52
|
-
command: '
|
|
125
|
+
command: 'ttsc -p tsconfig.test.json --noEmit --watch',
|
|
53
126
|
cwd: projectRoot,
|
|
54
127
|
},
|
|
55
128
|
};
|
|
@@ -70,6 +143,72 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
70
143
|
else if (hasLibTsconfig) {
|
|
71
144
|
validationTargets.push('typecheck');
|
|
72
145
|
}
|
|
146
|
+
const cargo = await readCargoWorkspace(absoluteProjectRoot);
|
|
147
|
+
if (cargo) {
|
|
148
|
+
const declared = packageJson.nx?.targets ?? {};
|
|
149
|
+
if (!('cargo-test' in declared)) {
|
|
150
|
+
targets['cargo-test'] = createCargoTestTarget(projectRoot);
|
|
151
|
+
}
|
|
152
|
+
if (!('cargo-lint' in declared)) {
|
|
153
|
+
targets['cargo-lint'] = {
|
|
154
|
+
executor: 'nx:run-commands',
|
|
155
|
+
cache: true,
|
|
156
|
+
inputs: CARGO_INPUTS,
|
|
157
|
+
options: {
|
|
158
|
+
commands: ['cargo fmt --all --check', 'cargo clippy --workspace --all-targets -- -D warnings'],
|
|
159
|
+
cwd: projectRoot,
|
|
160
|
+
parallel: false,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
validationTargets.push('cargo-lint');
|
|
165
|
+
if (!('test' in declared) && typeof packageJson.scripts?.test !== 'string') {
|
|
166
|
+
// Execute Cargo directly: workspace targetDefaults may replace test.dependsOn.
|
|
167
|
+
targets.test = createCargoTestTarget(projectRoot);
|
|
168
|
+
}
|
|
169
|
+
if (!('mutation' in declared)) {
|
|
170
|
+
// Mutation runs are minutes-to-hours: never cached, never part of build/lint.
|
|
171
|
+
// CI runs these per-PR via `cargo mutants --in-diff` (see mutants.toml docs).
|
|
172
|
+
targets.mutation = {
|
|
173
|
+
executor: 'nx:run-commands',
|
|
174
|
+
cache: false,
|
|
175
|
+
options: { command: 'cargo mutants --workspace', cwd: projectRoot },
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (!('bench' in declared)) {
|
|
179
|
+
targets.bench = {
|
|
180
|
+
executor: 'nx:run-commands',
|
|
181
|
+
cache: false,
|
|
182
|
+
options: { command: 'cargo bench --workspace', cwd: projectRoot },
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (cargo.wasmCrates.length > 0 && !('cargo-wasm' in declared)) {
|
|
186
|
+
const profile = cargo.hasWasmReleaseProfile ? 'wasm-release' : 'release';
|
|
187
|
+
const buildAndCopy = (crate, profileName) => {
|
|
188
|
+
const artifact = crate.replace(/-/g, '_');
|
|
189
|
+
const profileFlag = profileName === null ? '' : ` --profile ${profileName}`;
|
|
190
|
+
const outputDirectory = profileName ?? 'debug';
|
|
191
|
+
return `cargo build${profileFlag} --target wasm32-unknown-unknown -p ${crate} && mkdir -p dist && cp target/wasm32-unknown-unknown/${outputDirectory}/${artifact}.wasm dist/${artifact}.wasm`;
|
|
192
|
+
};
|
|
193
|
+
targets['cargo-wasm'] = {
|
|
194
|
+
executor: 'nx:run-commands',
|
|
195
|
+
cache: true,
|
|
196
|
+
inputs: CARGO_INPUTS,
|
|
197
|
+
outputs: ['{projectRoot}/dist/**/*.wasm'],
|
|
198
|
+
options: {
|
|
199
|
+
commands: cargo.wasmCrates.map((crate) => buildAndCopy(crate, profile)),
|
|
200
|
+
cwd: projectRoot,
|
|
201
|
+
parallel: false,
|
|
202
|
+
},
|
|
203
|
+
configurations: {
|
|
204
|
+
development: {
|
|
205
|
+
commands: cargo.wasmCrates.map((crate) => buildAndCopy(crate, null)),
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
hasBuildOutputTarget = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
73
212
|
const zigSteps = await readZigSteps(absoluteProjectRoot, projectRoot);
|
|
74
213
|
for (const step of zigSteps) {
|
|
75
214
|
const targetName = `zig-${step}`;
|
|
@@ -113,19 +252,38 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
113
252
|
}
|
|
114
253
|
if (validationTargets.length > 0) {
|
|
115
254
|
targets.lint = {
|
|
116
|
-
executor: 'nx:noop',
|
|
117
255
|
cache: true,
|
|
118
256
|
dependsOn: validationTargets,
|
|
119
257
|
};
|
|
120
258
|
}
|
|
259
|
+
const projectName = packageJson.nx?.name ?? packageJson.name;
|
|
260
|
+
if (typeof projectName !== 'string' || projectName.length === 0) {
|
|
261
|
+
throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
|
|
262
|
+
}
|
|
121
263
|
return {
|
|
122
264
|
projects: {
|
|
123
|
-
[projectRoot]: { targets },
|
|
265
|
+
[projectRoot]: { name: projectName, targets },
|
|
124
266
|
},
|
|
125
267
|
};
|
|
126
268
|
}
|
|
127
269
|
async function readPackageJson(packageJsonPath) {
|
|
128
|
-
|
|
270
|
+
const parsed = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
|
|
271
|
+
if (!isRecord(parsed)) {
|
|
272
|
+
throw new Error(`${packageJsonPath} must contain a JSON object`);
|
|
273
|
+
}
|
|
274
|
+
const rawNx = isRecord(parsed.nx) ? parsed.nx : undefined;
|
|
275
|
+
return {
|
|
276
|
+
...(typeof parsed.name === 'string' ? { name: parsed.name } : {}),
|
|
277
|
+
...(isRecord(parsed.scripts) ? { scripts: parsed.scripts } : {}),
|
|
278
|
+
...(rawNx
|
|
279
|
+
? {
|
|
280
|
+
nx: {
|
|
281
|
+
...(typeof rawNx.name === 'string' ? { name: rawNx.name } : {}),
|
|
282
|
+
...(isRecord(rawNx.targets) ? { targets: rawNx.targets } : {}),
|
|
283
|
+
},
|
|
284
|
+
}
|
|
285
|
+
: {}),
|
|
286
|
+
};
|
|
129
287
|
}
|
|
130
288
|
function inferTestWatchCommand(packageJson) {
|
|
131
289
|
const scriptCommand = packageJson.scripts?.test;
|
|
@@ -175,6 +333,35 @@ function hasPackageLocalBuildOutputTarget(packageJson) {
|
|
|
175
333
|
}
|
|
176
334
|
return Object.keys(targets).some((targetName) => BUILD_OUTPUT_TARGET_PATTERN.test(targetName));
|
|
177
335
|
}
|
|
336
|
+
async function readCargoWorkspace(absoluteProjectRoot) {
|
|
337
|
+
const cargoTomlPath = join(absoluteProjectRoot, 'Cargo.toml');
|
|
338
|
+
if (!existsSync(cargoTomlPath)) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
const cargoToml = await readFile(cargoTomlPath, 'utf-8');
|
|
342
|
+
if (!CARGO_WORKSPACE_PATTERN.test(cargoToml)) {
|
|
343
|
+
// Member crates get their targets from the workspace-root package.json,
|
|
344
|
+
// never per-crate — one Nx project per Cargo workspace.
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const wasmCrates = [];
|
|
348
|
+
const membersList = CARGO_MEMBERS_PATTERN.exec(cargoToml)?.[1] ?? '';
|
|
349
|
+
for (const match of membersList.matchAll(CARGO_MEMBER_ENTRY_PATTERN)) {
|
|
350
|
+
const memberTomlPath = join(absoluteProjectRoot, match[1], 'Cargo.toml');
|
|
351
|
+
if (!existsSync(memberTomlPath)) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
const memberToml = await readFile(memberTomlPath, 'utf-8');
|
|
355
|
+
const name = CARGO_PACKAGE_NAME_PATTERN.exec(memberToml)?.[1];
|
|
356
|
+
if (name &&
|
|
357
|
+
CARGO_WASM_CRATE_NAME_PATTERN.test(name) &&
|
|
358
|
+
CARGO_CDYLIB_CRATE_TYPE_PATTERN.test(memberToml) &&
|
|
359
|
+
!wasmCrates.includes(name)) {
|
|
360
|
+
wasmCrates.push(name);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return { wasmCrates, hasWasmReleaseProfile: CARGO_WASM_RELEASE_PROFILE_PATTERN.test(cargoToml) };
|
|
364
|
+
}
|
|
178
365
|
async function readZigSteps(absoluteProjectRoot, projectRoot) {
|
|
179
366
|
const buildZigPath = join(absoluteProjectRoot, 'build.zig');
|
|
180
367
|
if (!existsSync(buildZigPath)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck-test-policy.d.ts","sourceRoot":"","sources":["../src/typecheck-test-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typecheck-test-policy.d.ts","sourceRoot":"","sources":["../src/typecheck-test-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,WAAW,CAAC,UAAU,CAAC,CAqDzB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAC5C,WAAW,EAAE,MAAM,GAClB,aAAa,EAAE,CAgDjB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAC/C,WAAW,EAAE,MAAM,GAClB,aAAa,EAAE,CAYjB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,OAAO,EAAE;IACP,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GACA,OAAO,CAoDT;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAO7F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAwCxE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAyDhE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CA2CtE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAyD9D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join, relative } from 'node:path';
|
|
3
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
4
|
import { getProjects, readJson, readProjectConfiguration, updateJson, writeJson } from 'nx/src/devkit-exports.js';
|
|
4
5
|
const workspaceDependencyFields = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
|
|
5
6
|
/**
|
|
@@ -67,7 +68,7 @@ export function checkTypecheckTestConfig(tsconfigTest, packagePath) {
|
|
|
67
68
|
const issues = [];
|
|
68
69
|
const tsconfigTestPath = join(packagePath, 'tsconfig.test.json');
|
|
69
70
|
const compilerOptions = recordProperty(tsconfigTest, 'compilerOptions');
|
|
70
|
-
if (
|
|
71
|
+
if (compilerOptions?.noEmit !== true) {
|
|
71
72
|
issues.push({
|
|
72
73
|
path: tsconfigTestPath,
|
|
73
74
|
message: 'compilerOptions.noEmit must be true',
|
|
@@ -132,7 +133,8 @@ export function applyTypecheckTestDefaults(tsconfigTest, options) {
|
|
|
132
133
|
// Copy relevant compiler options from lib tsconfig
|
|
133
134
|
if (options.libCompilerOptions) {
|
|
134
135
|
for (const key of ['baseUrl', 'module', 'moduleResolution', 'jsx', 'lib']) {
|
|
135
|
-
if (Object.hasOwn(options.libCompilerOptions, key) &&
|
|
136
|
+
if (Object.hasOwn(options.libCompilerOptions, key) &&
|
|
137
|
+
!isDeepStrictEqual(compilerOptions[key], options.libCompilerOptions[key])) {
|
|
136
138
|
compilerOptions[key] = options.libCompilerOptions[key];
|
|
137
139
|
changed = true;
|
|
138
140
|
}
|
package/dist/version-actions.cjs
CHANGED
|
@@ -72,15 +72,20 @@ function workspacePackages(root) {
|
|
|
72
72
|
if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
if (typeof
|
|
75
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, 'utf8'));
|
|
76
|
+
if (!isRecord(parsed) || typeof parsed.name !== 'string' || typeof parsed.version !== 'string') {
|
|
77
77
|
return null;
|
|
78
|
-
|
|
78
|
+
}
|
|
79
|
+
const json = parsed;
|
|
80
|
+
const nx = isRecord(json.nx) ? json.nx : null;
|
|
79
81
|
const projectName = (nx ? (typeof nx.name === 'string' ? nx.name : null) : null) ?? json.name;
|
|
80
82
|
return { path, name: json.name, projectName, version: json.version };
|
|
81
83
|
})
|
|
82
84
|
.filter((pkg) => pkg !== null);
|
|
83
85
|
}
|
|
86
|
+
function isRecord(value) {
|
|
87
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
88
|
+
}
|
|
84
89
|
function escapeRegex(value) {
|
|
85
90
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
86
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-actions.d.cts","sourceRoot":"","sources":["../src/version-actions.cts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5E,QAAA,MAAM,kBAAkB;+BALyC,yBAAyB;CAKf,CAAC;
|
|
1
|
+
{"version":3,"file":"version-actions.d.cts","sourceRoot":"","sources":["../src/version-actions.cts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5E,QAAA,MAAM,kBAAkB;+BALyC,yBAAyB;CAKf,CAAC;SA0BnE,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,UAWrC,CAAC;AAeF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,UAWrC,CAAC;AAeF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,CA+CrF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAa7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAU5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYxE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWhE"}
|
|
@@ -51,19 +51,11 @@ export function checkWorkspaceConfig(nxJson) {
|
|
|
51
51
|
validateNamedInputDefaults(nxJson, 'nx.json', issues);
|
|
52
52
|
// Plugin configuration
|
|
53
53
|
const plugins = Array.isArray(nxJson.plugins) ? nxJson.plugins : [];
|
|
54
|
-
|
|
55
|
-
if (!nxJsPlugin) {
|
|
54
|
+
if (plugins.some(isNxJsTypescriptPlugin)) {
|
|
56
55
|
issues.push({
|
|
57
56
|
path: 'nx.json',
|
|
58
|
-
message: `plugins must configure ${nxJsTypescriptPlugin}. ` +
|
|
59
|
-
'
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else if (nxJsBuildTargetName(nxJsPlugin) !== 'tsc-js') {
|
|
63
|
-
issues.push({
|
|
64
|
-
path: 'nx.json',
|
|
65
|
-
message: `${nxJsTypescriptPlugin} build.targetName must be tsc-js. ` +
|
|
66
|
-
'TypeScript library output is a concrete tool-output target; build is reserved for aggregate targets that depend on concrete build work.',
|
|
57
|
+
message: `plugins must not configure ${nxJsTypescriptPlugin}. ` +
|
|
58
|
+
'Smoo owns transformer-aware TypeScript targets; Nx native inference only supports tsc/tsgo.',
|
|
67
59
|
});
|
|
68
60
|
}
|
|
69
61
|
if (!plugins.includes(smoothBricksNxPlugin) && !plugins.some(isSmoothBricksNxPluginRecord)) {
|
|
@@ -85,7 +77,8 @@ export function applyWorkspaceConfig(nxJson) {
|
|
|
85
77
|
changed = applyCleanTargetDefault(nxJson) || changed;
|
|
86
78
|
changed = applyNamedInputDefaults(nxJson) || changed;
|
|
87
79
|
const currentPlugins = Array.isArray(nxJson.plugins) ? nxJson.plugins : [];
|
|
88
|
-
const
|
|
80
|
+
const pluginsWithoutNxTypeScript = currentPlugins.filter((plugin) => !isNxJsTypescriptPlugin(plugin));
|
|
81
|
+
const nextPlugins = upsertNxPlugin(pluginsWithoutNxTypeScript, smoothBricksNxPlugin);
|
|
89
82
|
if (JSON.stringify(currentPlugins) !== JSON.stringify(nextPlugins)) {
|
|
90
83
|
nxJson.plugins = nextPlugins;
|
|
91
84
|
changed = true;
|
|
@@ -150,7 +143,7 @@ export function applyWorkspaceConfigPolicy(root) {
|
|
|
150
143
|
function validateBuildTargetDefault(nxJson, nxJsonPath, issues) {
|
|
151
144
|
const targetDefaults = recordProperty(nxJson, 'targetDefaults');
|
|
152
145
|
const build = targetDefaults ? recordProperty(targetDefaults, 'build') : null;
|
|
153
|
-
if (
|
|
146
|
+
if (build?.cache !== true) {
|
|
154
147
|
issues.push({ path: nxJsonPath, message: 'targetDefaults.build.cache must be true' });
|
|
155
148
|
}
|
|
156
149
|
const outputs = build?.outputs;
|
|
@@ -164,7 +157,7 @@ function validateCleanTargetDefault(nxJson, nxJsonPath, issues) {
|
|
|
164
157
|
if (!clean || clean.executor !== cleanOutputsExecutor) {
|
|
165
158
|
issues.push({ path: nxJsonPath, message: `targetDefaults.clean.executor must be ${cleanOutputsExecutor}` });
|
|
166
159
|
}
|
|
167
|
-
if (
|
|
160
|
+
if (clean?.cache !== false) {
|
|
168
161
|
issues.push({ path: nxJsonPath, message: 'targetDefaults.clean.cache must be false' });
|
|
169
162
|
}
|
|
170
163
|
}
|
|
@@ -263,20 +256,6 @@ function isPreciseProductionNamedInput(production) {
|
|
|
263
256
|
}
|
|
264
257
|
return hasPositiveProjectInput;
|
|
265
258
|
}
|
|
266
|
-
function expectedNxJsTypescriptPlugin() {
|
|
267
|
-
return {
|
|
268
|
-
plugin: nxJsTypescriptPlugin,
|
|
269
|
-
options: {
|
|
270
|
-
typecheck: { targetName: 'typecheck' },
|
|
271
|
-
build: {
|
|
272
|
-
targetName: 'tsc-js',
|
|
273
|
-
configName: 'tsconfig.lib.json',
|
|
274
|
-
buildDepsName: 'build-deps',
|
|
275
|
-
watchDepsName: 'watch-deps',
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
259
|
function upsertNxPlugin(plugins, plugin) {
|
|
281
260
|
const pluginName = typeof plugin === 'string' ? plugin : stringProperty(plugin, 'plugin');
|
|
282
261
|
const next = plugins.filter((entry) => nxPluginName(entry) !== pluginName);
|
|
@@ -290,16 +269,11 @@ function nxPluginName(value) {
|
|
|
290
269
|
return isRecord(value) ? stringProperty(value, 'plugin') : null;
|
|
291
270
|
}
|
|
292
271
|
function isNxJsTypescriptPlugin(value) {
|
|
293
|
-
return isRecord(value) && stringProperty(value, 'plugin') === nxJsTypescriptPlugin;
|
|
272
|
+
return (value === nxJsTypescriptPlugin || (isRecord(value) && stringProperty(value, 'plugin') === nxJsTypescriptPlugin));
|
|
294
273
|
}
|
|
295
274
|
function isSmoothBricksNxPluginRecord(value) {
|
|
296
275
|
return isRecord(value) && stringProperty(value, 'plugin') === smoothBricksNxPlugin;
|
|
297
276
|
}
|
|
298
|
-
function nxJsBuildTargetName(plugin) {
|
|
299
|
-
const options = recordProperty(plugin, 'options');
|
|
300
|
-
const build = options ? recordProperty(options, 'build') : null;
|
|
301
|
-
return build ? stringProperty(build, 'targetName') : null;
|
|
302
|
-
}
|
|
303
277
|
function readJsonObject(path) {
|
|
304
278
|
if (!existsSync(path)) {
|
|
305
279
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smoothbricks/nx-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./loader.js",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"directory": "packages/nx-plugin"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@nx/js": "
|
|
96
|
-
"nx": "
|
|
95
|
+
"@nx/js": "23.1.0",
|
|
96
|
+
"nx": "23.1.0",
|
|
97
97
|
"tslib": "^2.8.1"
|
|
98
98
|
}
|
|
99
99
|
}
|