@smoothbricks/nx-plugin 0.3.0 → 0.3.2
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 +83 -22
- package/dist/package-target-policy.d.ts +3 -2
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +63 -20
- 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 +4 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +11 -35
- 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 +70 -18
- package/src/index.ts +87 -23
- package/src/package-target-policy.test.ts +71 -1
- package/src/package-target-policy.ts +85 -23
- 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 +60 -57
- package/src/workspace-config-policy.ts +16 -42
|
@@ -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,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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;AAyDxG,eAAO,MAAM,aAAa,EAAE,aAsB3B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,20 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
|
|
5
|
-
import { BUILD_OUTPUT_DEPENDENCIES } from './workspace-config-policy.js';
|
|
5
|
+
import { BUILD_OUTPUT_DEPENDENCIES, PLATFORM_TARGET_GLOBS } from './workspace-config-policy.js';
|
|
6
6
|
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
|
-
const BUILD_OUTPUT_TARGET_PATTERN = /-(?:js|web|html|css|
|
|
9
|
+
const BUILD_OUTPUT_TARGET_PATTERN = /-(?:js|web|html|css|android|native|napi|bun|wasm)$/;
|
|
10
|
+
const ZIG_WASM_OUTPUTS = ['{projectRoot}/dist/**/*.wasm'];
|
|
11
|
+
const ZIG_NATIVE_OUTPUTS = ['{projectRoot}/dist/**/*.{node,dylib,so,dll,a}'];
|
|
12
|
+
const ZIG_GENERIC_OUTPUTS = ['{projectRoot}/dist/**/*.{wasm,node,dylib,so,dll,a}'];
|
|
13
|
+
const TYPESCRIPT_TOOLCHAIN_INPUTS = [
|
|
14
|
+
'{workspaceRoot}/package.json',
|
|
15
|
+
'{workspaceRoot}/bun.lock',
|
|
16
|
+
'{workspaceRoot}/patches/**/*',
|
|
17
|
+
'{workspaceRoot}/tsconfig.base.json',
|
|
18
|
+
];
|
|
10
19
|
// Cargo workspace inference: a package.json sitting next to a Cargo.toml that
|
|
11
20
|
// declares [workspace] gets direct cargo-test/test targets, cargo-lint feeding
|
|
12
21
|
// the lint aggregate, mutation (cargo-mutants), bench, and — per cdylib member
|
|
@@ -70,14 +79,44 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
70
79
|
const targets = {};
|
|
71
80
|
const validationTargets = [];
|
|
72
81
|
const hasLibTsconfig = existsSync(join(absoluteProjectRoot, 'tsconfig.lib.json'));
|
|
73
|
-
|
|
82
|
+
const packageLocalBuildOutputs = classifyPackageLocalBuildOutputs(packageJson);
|
|
83
|
+
let hasOrdinaryBuildOutputTarget = hasLibTsconfig || packageLocalBuildOutputs.ordinary;
|
|
84
|
+
let hasAnyBuildOutputTarget = hasOrdinaryBuildOutputTarget || packageLocalBuildOutputs.platform;
|
|
85
|
+
if (hasLibTsconfig) {
|
|
86
|
+
// Official Nx target inference is disabled because its compiler surface only
|
|
87
|
+
// supports tsc/tsgo. Smoo owns the complete transformer-aware ttsc targets.
|
|
88
|
+
targets['tsc-js'] = {
|
|
89
|
+
executor: 'nx:run-commands',
|
|
90
|
+
cache: true,
|
|
91
|
+
inputs: ['production', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.lib.json'],
|
|
92
|
+
outputs: ['{projectRoot}/dist/**/*.{js,cjs,mjs,jsx,d.ts,d.cts,d.mts}{,.map}'],
|
|
93
|
+
dependsOn: ['^tsc-js'],
|
|
94
|
+
options: {
|
|
95
|
+
command: 'ttsc -p tsconfig.lib.json --emit',
|
|
96
|
+
cwd: projectRoot,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
targets.typecheck = {
|
|
100
|
+
executor: 'nx:run-commands',
|
|
101
|
+
cache: true,
|
|
102
|
+
inputs: ['production', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.lib.json'],
|
|
103
|
+
outputs: [],
|
|
104
|
+
dependsOn: ['^tsc-js'],
|
|
105
|
+
options: {
|
|
106
|
+
command: 'ttsc -p tsconfig.lib.json --noEmit',
|
|
107
|
+
cwd: projectRoot,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
74
111
|
const hasTestTsconfig = existsSync(join(absoluteProjectRoot, 'tsconfig.test.json'));
|
|
75
112
|
if (hasTestTsconfig) {
|
|
76
113
|
targets['typecheck-tests'] = {
|
|
77
114
|
executor: 'nx:run-commands',
|
|
78
115
|
cache: true,
|
|
116
|
+
inputs: ['default', '^production', ...TYPESCRIPT_TOOLCHAIN_INPUTS, '{projectRoot}/tsconfig.test.json'],
|
|
117
|
+
dependsOn: ['typecheck'],
|
|
79
118
|
options: {
|
|
80
|
-
command: '
|
|
119
|
+
command: 'ttsc -p tsconfig.test.json --noEmit',
|
|
81
120
|
cwd: projectRoot,
|
|
82
121
|
},
|
|
83
122
|
};
|
|
@@ -85,7 +124,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
85
124
|
executor: 'nx:run-commands',
|
|
86
125
|
continuous: true,
|
|
87
126
|
options: {
|
|
88
|
-
command: '
|
|
127
|
+
command: 'ttsc -p tsconfig.test.json --noEmit --watch',
|
|
89
128
|
cwd: projectRoot,
|
|
90
129
|
},
|
|
91
130
|
};
|
|
@@ -169,7 +208,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
169
208
|
},
|
|
170
209
|
},
|
|
171
210
|
};
|
|
172
|
-
|
|
211
|
+
hasOrdinaryBuildOutputTarget = true;
|
|
212
|
+
hasAnyBuildOutputTarget = true;
|
|
173
213
|
}
|
|
174
214
|
}
|
|
175
215
|
const zigSteps = await readZigSteps(absoluteProjectRoot, projectRoot);
|
|
@@ -179,27 +219,23 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
179
219
|
executor: 'nx:run-commands',
|
|
180
220
|
cache: true,
|
|
181
221
|
inputs: ['{projectRoot}/src/**/*.zig', '{projectRoot}/build.zig', '{projectRoot}/build.zig.zon'],
|
|
182
|
-
outputs:
|
|
183
|
-
'{projectRoot}/dist/**/*.wasm',
|
|
184
|
-
'{projectRoot}/dist/**/*.node',
|
|
185
|
-
'{projectRoot}/dist/**/*.dylib',
|
|
186
|
-
'{projectRoot}/dist/**/*.so',
|
|
187
|
-
'{projectRoot}/dist/**/*.dll',
|
|
188
|
-
'{projectRoot}/dist/**/*.a',
|
|
189
|
-
],
|
|
222
|
+
outputs: zigOutputsForStep(step),
|
|
190
223
|
options: {
|
|
191
224
|
command: `zig build ${step}`,
|
|
192
225
|
cwd: projectRoot,
|
|
193
226
|
},
|
|
194
227
|
};
|
|
195
|
-
|
|
228
|
+
hasOrdinaryBuildOutputTarget = true;
|
|
229
|
+
hasAnyBuildOutputTarget = true;
|
|
196
230
|
}
|
|
197
|
-
if (
|
|
231
|
+
if (hasOrdinaryBuildOutputTarget) {
|
|
198
232
|
targets.build = {
|
|
199
233
|
executor: 'nx:noop',
|
|
200
234
|
cache: true,
|
|
201
235
|
dependsOn: ['^build', ...BUILD_OUTPUT_DEPENDENCIES],
|
|
202
236
|
};
|
|
237
|
+
}
|
|
238
|
+
if (hasAnyBuildOutputTarget) {
|
|
203
239
|
targets.clean = {
|
|
204
240
|
executor: '@smoothbricks/nx-plugin:clean-outputs',
|
|
205
241
|
cache: false,
|
|
@@ -215,7 +251,6 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
215
251
|
}
|
|
216
252
|
if (validationTargets.length > 0) {
|
|
217
253
|
targets.lint = {
|
|
218
|
-
executor: 'nx:noop',
|
|
219
254
|
cache: true,
|
|
220
255
|
dependsOn: validationTargets,
|
|
221
256
|
};
|
|
@@ -231,7 +266,23 @@ async function createProjectTargets(packageJsonPath, workspaceRoot) {
|
|
|
231
266
|
};
|
|
232
267
|
}
|
|
233
268
|
async function readPackageJson(packageJsonPath) {
|
|
234
|
-
|
|
269
|
+
const parsed = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
|
|
270
|
+
if (!isRecord(parsed)) {
|
|
271
|
+
throw new Error(`${packageJsonPath} must contain a JSON object`);
|
|
272
|
+
}
|
|
273
|
+
const rawNx = isRecord(parsed.nx) ? parsed.nx : undefined;
|
|
274
|
+
return {
|
|
275
|
+
...(typeof parsed.name === 'string' ? { name: parsed.name } : {}),
|
|
276
|
+
...(isRecord(parsed.scripts) ? { scripts: parsed.scripts } : {}),
|
|
277
|
+
...(rawNx
|
|
278
|
+
? {
|
|
279
|
+
nx: {
|
|
280
|
+
...(typeof rawNx.name === 'string' ? { name: rawNx.name } : {}),
|
|
281
|
+
...(isRecord(rawNx.targets) ? { targets: rawNx.targets } : {}),
|
|
282
|
+
},
|
|
283
|
+
}
|
|
284
|
+
: {}),
|
|
285
|
+
};
|
|
235
286
|
}
|
|
236
287
|
function inferTestWatchCommand(packageJson) {
|
|
237
288
|
const scriptCommand = packageJson.scripts?.test;
|
|
@@ -274,12 +325,22 @@ function parseEnvPrefixedCommand(command) {
|
|
|
274
325
|
function isRecord(value) {
|
|
275
326
|
return value !== null && typeof value === 'object';
|
|
276
327
|
}
|
|
277
|
-
function
|
|
328
|
+
function classifyPackageLocalBuildOutputs(packageJson) {
|
|
278
329
|
const targets = packageJson.nx?.targets;
|
|
279
|
-
|
|
280
|
-
|
|
330
|
+
const targetNames = isRecord(targets) ? Object.keys(targets) : [];
|
|
331
|
+
return {
|
|
332
|
+
ordinary: targetNames.some((targetName) => BUILD_OUTPUT_TARGET_PATTERN.test(targetName)),
|
|
333
|
+
platform: targetNames.some((targetName) => PLATFORM_TARGET_GLOBS.some((glob) => targetName.endsWith(glob.slice(1)))),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function zigOutputsForStep(step) {
|
|
337
|
+
if (step.endsWith('wasm')) {
|
|
338
|
+
return ZIG_WASM_OUTPUTS;
|
|
339
|
+
}
|
|
340
|
+
if (step.endsWith('native')) {
|
|
341
|
+
return ZIG_NATIVE_OUTPUTS;
|
|
281
342
|
}
|
|
282
|
-
return
|
|
343
|
+
return ZIG_GENERIC_OUTPUTS;
|
|
283
344
|
}
|
|
284
345
|
async function readCargoWorkspace(absoluteProjectRoot) {
|
|
285
346
|
const cargoTomlPath = join(absoluteProjectRoot, 'Cargo.toml');
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { type Tree } from 'nx/src/devkit-exports.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type NxPolicyIssue } from './workspace-config-policy.js';
|
|
3
|
+
export { BUILD_OUTPUT_DEPENDENCIES, PLATFORM_TARGET_GLOBS } from './workspace-config-policy.js';
|
|
3
4
|
export type { NxPolicyIssue };
|
|
4
5
|
export interface ResolvedProjectTargets {
|
|
5
6
|
targets: ReadonlySet<string>;
|
|
6
7
|
buildDependsOn?: readonly string[];
|
|
8
|
+
targetDependencies?: ReadonlyMap<string, readonly string[]>;
|
|
7
9
|
targetExecutors?: ReadonlyMap<string, string>;
|
|
8
10
|
targetScripts?: ReadonlyMap<string, string>;
|
|
9
11
|
}
|
|
10
12
|
export interface PackageTargetPolicyOptions {
|
|
11
13
|
resolvedTargetsByProject?: ReadonlyMap<string, ReadonlySet<string> | ResolvedProjectTargets>;
|
|
12
14
|
}
|
|
13
|
-
export declare const BUILD_OUTPUT_DEPENDENCIES: string[];
|
|
14
15
|
export declare function packageNxProjectName(pkg: Record<string, unknown>): string | null;
|
|
15
16
|
export declare function nxRunAlias(projectName: string, targetName: string, continuous: boolean, command?: string | null): string;
|
|
16
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-target-policy.d.ts","sourceRoot":"","sources":["../src/package-target-policy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,IAAI,EAAc,MAAM,0BAA0B,CAAC;AAGxF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"package-target-policy.d.ts","sourceRo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,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACpC,aAAa,EAAE,CAEjB;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAO,GACtD,OAAO,CAMT;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,aAAa,EAAE,CAoBhH;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CA6BxG"}
|
|
@@ -2,18 +2,8 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { getProjects, readJson, updateJson } from 'nx/src/devkit-exports.js';
|
|
4
4
|
import { boundedTestScriptAlias } from './bounded-test-policy.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'*-web',
|
|
8
|
-
'*-html',
|
|
9
|
-
'*-css',
|
|
10
|
-
'*-ios',
|
|
11
|
-
'*-android',
|
|
12
|
-
'*-native',
|
|
13
|
-
'*-napi',
|
|
14
|
-
'*-bun',
|
|
15
|
-
'*-wasm',
|
|
16
|
-
];
|
|
5
|
+
import { BUILD_OUTPUT_DEPENDENCIES, LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, } from './workspace-config-policy.js';
|
|
6
|
+
export { BUILD_OUTPUT_DEPENDENCIES, PLATFORM_TARGET_GLOBS } from './workspace-config-policy.js';
|
|
17
7
|
const workspaceDependencyFields = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
|
|
18
8
|
function isRecord(value) {
|
|
19
9
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -154,7 +144,7 @@ function targetExistsInResolvedProject(targetName, resolvedTargets) {
|
|
|
154
144
|
return resolvedProjectTargetNames(resolvedTargets)?.has(targetName) === true;
|
|
155
145
|
}
|
|
156
146
|
function isBuildOutputDependencyPattern(dependency) {
|
|
157
|
-
return BUILD_OUTPUT_DEPENDENCIES.
|
|
147
|
+
return BUILD_OUTPUT_DEPENDENCIES.some((pattern) => pattern === dependency);
|
|
158
148
|
}
|
|
159
149
|
function expectedTargetDependencies(targetName) {
|
|
160
150
|
return targetName === 'preview' ? ['build'] : ['^build'];
|
|
@@ -460,13 +450,13 @@ function validateBuildZigPolicy(root, packagePath) {
|
|
|
460
450
|
{ path: join(root, packagePath), message: `${packagePath}/build.zig must define at least one b.step(...) target` },
|
|
461
451
|
];
|
|
462
452
|
}
|
|
463
|
-
function validateExplicitNxTargets(pkg, packagePath,
|
|
453
|
+
function validateExplicitNxTargets(pkg, packagePath, resolvedProject) {
|
|
454
|
+
const issues = validatePlatformTargetDependencies(packagePath, resolvedProject);
|
|
464
455
|
const nx = recordProperty(pkg, 'nx');
|
|
465
456
|
const targets = nx ? recordProperty(nx, 'targets') : null;
|
|
466
457
|
if (!targets) {
|
|
467
|
-
return
|
|
458
|
+
return issues;
|
|
468
459
|
}
|
|
469
|
-
const issues = [];
|
|
470
460
|
for (const [targetName, rawTarget] of Object.entries(targets)) {
|
|
471
461
|
if (targetName.includes(':')) {
|
|
472
462
|
issues.push({
|
|
@@ -478,7 +468,61 @@ function validateExplicitNxTargets(pkg, packagePath, resolvedTargets) {
|
|
|
478
468
|
if (!isRecord(rawTarget)) {
|
|
479
469
|
continue;
|
|
480
470
|
}
|
|
481
|
-
issues.push(...validateTargetDependencies(rawTarget, `${packagePath}: nx.targets.${targetName}`,
|
|
471
|
+
issues.push(...validateTargetDependencies(rawTarget, `${packagePath}: nx.targets.${targetName}`, resolvedProjectTargetNames(resolvedProject)));
|
|
472
|
+
}
|
|
473
|
+
return issues;
|
|
474
|
+
}
|
|
475
|
+
function platformTargetFamily(targetName) {
|
|
476
|
+
if (MACOS_PLATFORM_TARGET_GLOBS.some((glob) => targetName.endsWith(glob.slice(1)))) {
|
|
477
|
+
return 'macos';
|
|
478
|
+
}
|
|
479
|
+
if (LINUX_PLATFORM_TARGET_GLOBS.some((glob) => targetName.endsWith(glob.slice(1)))) {
|
|
480
|
+
return 'linux';
|
|
481
|
+
}
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
function matchingResolvedTargets(dependency, targets) {
|
|
485
|
+
if (!dependency.startsWith('*')) {
|
|
486
|
+
return targets.has(dependency) ? [dependency] : [];
|
|
487
|
+
}
|
|
488
|
+
const suffix = dependency.slice(1);
|
|
489
|
+
return [...targets].filter((targetName) => targetName.endsWith(suffix));
|
|
490
|
+
}
|
|
491
|
+
function validatePlatformTargetDependencies(packagePath, resolvedProject) {
|
|
492
|
+
if (!isResolvedProjectTargets(resolvedProject) || !resolvedProject.targetDependencies) {
|
|
493
|
+
return [];
|
|
494
|
+
}
|
|
495
|
+
const issues = [];
|
|
496
|
+
for (const platformTarget of resolvedProject.targets) {
|
|
497
|
+
const family = platformTargetFamily(platformTarget);
|
|
498
|
+
if (!family) {
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
const visited = new Set();
|
|
502
|
+
const pending = [platformTarget];
|
|
503
|
+
while (pending.length > 0) {
|
|
504
|
+
const targetName = pending.pop();
|
|
505
|
+
if (!targetName || visited.has(targetName)) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
visited.add(targetName);
|
|
509
|
+
for (const dependency of resolvedProject.targetDependencies.get(targetName) ?? []) {
|
|
510
|
+
if (dependency.startsWith('^')) {
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
for (const resolvedDependency of matchingResolvedTargets(dependency, resolvedProject.targets)) {
|
|
514
|
+
if (platformTargetFamily(resolvedDependency) !== family) {
|
|
515
|
+
issues.push({
|
|
516
|
+
path: packagePath,
|
|
517
|
+
message: `${packagePath}: platform target ${platformTarget} dependency closure references ` +
|
|
518
|
+
`non-${family} sibling target ${resolvedDependency} via ${targetName}`,
|
|
519
|
+
});
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
pending.push(resolvedDependency);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
482
526
|
}
|
|
483
527
|
return issues;
|
|
484
528
|
}
|
|
@@ -749,7 +793,7 @@ export function checkPackageTargetPolicyTree(tree, options = {}) {
|
|
|
749
793
|
const packagePath = config.root;
|
|
750
794
|
const resolvedProject = options.resolvedTargetsByProject?.get(projectName);
|
|
751
795
|
const resolvedTargets = resolvedProjectTargetNames(resolvedProject);
|
|
752
|
-
issues.push(...validateExplicitNxTargets(pkg, packagePath,
|
|
796
|
+
issues.push(...validateExplicitNxTargets(pkg, packagePath, resolvedProject));
|
|
753
797
|
issues.push(...validateTestEntrypointPresenceTree(tree, packagePath, pkg));
|
|
754
798
|
issues.push(...validateBuildZigPolicyTree(tree, packagePath));
|
|
755
799
|
issues.push(...validatePackageScriptPolicy(pkg, packagePath, workspaceNames, { resolvedTargets }));
|
|
@@ -933,8 +977,7 @@ export function checkPackageTargetPolicy(root, options = {}) {
|
|
|
933
977
|
const packagePath = packagePathFromJsonPath(root, packageJsonPath);
|
|
934
978
|
const projectName = packageNxProjectName(pkg);
|
|
935
979
|
const resolvedProject = projectName ? options.resolvedTargetsByProject?.get(projectName) : undefined;
|
|
936
|
-
|
|
937
|
-
issues.push(...validateExplicitNxTargets(pkg, packagePath, resolvedTargets));
|
|
980
|
+
issues.push(...validateExplicitNxTargets(pkg, packagePath, resolvedProject));
|
|
938
981
|
issues.push(...validateTestEntrypointPresence(root, packagePath, pkg));
|
|
939
982
|
issues.push(...validateBuildZigPolicy(root, packagePath));
|
|
940
983
|
issues.push(...validatePackageScriptPolicy(pkg, packagePath, workspaceNames, { resolvedTargets: resolvedProject }));
|
|
@@ -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"}
|
|
@@ -3,7 +3,10 @@ export interface NxPolicyIssue {
|
|
|
3
3
|
path: string;
|
|
4
4
|
message: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const BUILD_OUTPUT_DEPENDENCIES:
|
|
6
|
+
export declare const BUILD_OUTPUT_DEPENDENCIES: readonly ['*-js', '*-web', '*-html', '*-css', '*-android', '*-native', '*-napi', '*-bun', '*-wasm'];
|
|
7
|
+
export declare const MACOS_PLATFORM_TARGET_GLOBS: readonly ['*-macos', '*-ios'];
|
|
8
|
+
export declare const LINUX_PLATFORM_TARGET_GLOBS: readonly ['*-linux'];
|
|
9
|
+
export declare const PLATFORM_TARGET_GLOBS: readonly ["*-macos", "*-ios", "*-linux"];
|
|
7
10
|
/**
|
|
8
11
|
* Check workspace config policy on an in-memory nx.json object.
|
|
9
12
|
*/
|
|
@@ -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,
|
|
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,EAA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