@nx/js 23.2.0-beta.7 → 23.2.0-beta.8
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/src/executors/copy-workspace-modules/copy-workspace-modules.js +1 -2
- package/dist/src/executors/node/node.impl.js +9 -10
- package/dist/src/executors/prune-lockfile/prune-lockfile.js +4 -7
- package/dist/src/executors/verdaccio/verdaccio.impl.js +1 -2
- package/dist/src/generators/library/library.js +14 -14
- package/dist/src/generators/library/schema.d.ts +2 -0
- package/dist/src/plugins/typescript/plugin.js +9 -14
- package/dist/src/release/utils/update-lock-file.js +1 -2
- package/dist/src/utils/generator-prompts.js +15 -19
- package/dist/src/utils/package-json/update-package-json.js +3 -6
- package/package.json +11 -11
|
@@ -6,7 +6,6 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
10
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
11
10
|
async function copyWorkspaceModules(schema, context) {
|
|
12
11
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
@@ -21,7 +20,7 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
21
20
|
if (!packageJson.dependencies) {
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
|
-
const workspaceModules = (0,
|
|
23
|
+
const workspaceModules = (0, internal_1.getWorkspacePackagesFromGraph)(projectGraph);
|
|
25
24
|
const processedModules = new Set();
|
|
26
25
|
const workspaceModulesDir = (0, path_1.join)(outputDirectory, 'workspace_modules');
|
|
27
26
|
function calculateRelativePath(fromPkgName, toPkgName) {
|
|
@@ -6,16 +6,12 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
10
9
|
const crypto_1 = require("crypto");
|
|
11
10
|
const path = tslib_1.__importStar(require("path"));
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
|
|
14
|
-
const internal_3 = require("@nx/devkit/internal");
|
|
15
13
|
const line_aware_writer_1 = require("./lib/line-aware-writer");
|
|
16
14
|
const coalescing_debounce_1 = require("./lib/coalescing-debounce");
|
|
17
|
-
const internal_4 = require("@nx/devkit/internal");
|
|
18
|
-
const internal_5 = require("@nx/devkit/internal");
|
|
19
15
|
const detect_module_format_1 = require("./lib/detect-module-format");
|
|
20
16
|
const output_file_1 = require("./lib/output-file");
|
|
21
17
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
@@ -175,7 +171,7 @@ async function* nodeExecutor(options, context) {
|
|
|
175
171
|
// Windows cannot deliver graceful signals through this API, so
|
|
176
172
|
// skip the grace period and force-kill immediately (matching the
|
|
177
173
|
// previous taskkill /F behavior).
|
|
178
|
-
await (0,
|
|
174
|
+
await (0, internal_1.killProcessTreeGraceful)(task.childProcess.pid, signal, process.platform === 'win32' ? 0 : undefined);
|
|
179
175
|
}
|
|
180
176
|
if (task.id === globalLineAwareWriter.currentProcessId) {
|
|
181
177
|
globalLineAwareWriter.setActiveProcess(null);
|
|
@@ -237,7 +233,7 @@ async function* nodeExecutor(options, context) {
|
|
|
237
233
|
await debouncedProcessQueue.trigger();
|
|
238
234
|
};
|
|
239
235
|
if ((0, devkit_1.isDaemonEnabled)()) {
|
|
240
|
-
additionalExitHandler = await
|
|
236
|
+
additionalExitHandler = await internal_1.daemonClient.registerFileWatcher({
|
|
241
237
|
watchProjects: [context.projectName],
|
|
242
238
|
includeDependencies: true,
|
|
243
239
|
}, async (err, data) => {
|
|
@@ -279,9 +275,12 @@ async function* nodeExecutor(options, context) {
|
|
|
279
275
|
}, context);
|
|
280
276
|
while (true) {
|
|
281
277
|
const event = await output.next();
|
|
278
|
+
if (event.done) {
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
282
281
|
await addToQueue(null, Promise.resolve(event.value));
|
|
283
282
|
await debouncedProcessQueue.trigger();
|
|
284
|
-
if (
|
|
283
|
+
if (!options.watch) {
|
|
285
284
|
break;
|
|
286
285
|
}
|
|
287
286
|
}
|
|
@@ -337,7 +336,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
337
336
|
// {workspaceRoot}/dist/{projectRoot} -> dist/my-app
|
|
338
337
|
const outputPath = project.data.targets[buildOptions.target]?.outputs?.[0];
|
|
339
338
|
if (outputPath) {
|
|
340
|
-
const outputFilePath = (0,
|
|
339
|
+
const outputFilePath = (0, internal_1.interpolate)(outputPath, {
|
|
341
340
|
projectName: project.name,
|
|
342
341
|
projectRoot: project.data.root,
|
|
343
342
|
workspaceRoot: context.root,
|
|
@@ -366,12 +365,12 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
366
365
|
return (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
|
|
367
366
|
}
|
|
368
367
|
function fileToRunCorrectPath(fileToRun) {
|
|
369
|
-
if ((0,
|
|
368
|
+
if ((0, internal_1.fileExists)(fileToRun))
|
|
370
369
|
return fileToRun;
|
|
371
370
|
const extensionsToTry = ['.cjs', '.mjs', '.cjs.js', '.esm.js'];
|
|
372
371
|
for (const ext of extensionsToTry) {
|
|
373
372
|
const file = fileToRun.replace(/\.js$/, ext);
|
|
374
|
-
if ((0,
|
|
373
|
+
if ((0, internal_1.fileExists)(file))
|
|
375
374
|
return file;
|
|
376
375
|
}
|
|
377
376
|
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
|
|
@@ -6,9 +6,6 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
10
|
-
const internal_3 = require("@nx/devkit/internal");
|
|
11
|
-
const internal_4 = require("@nx/devkit/internal");
|
|
12
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
13
10
|
async function pruneLockfileExecutor(schema, context) {
|
|
14
11
|
devkit_1.logger.log('Pruning lockfile...');
|
|
@@ -33,9 +30,9 @@ async function pruneLockfileExecutor(schema, context) {
|
|
|
33
30
|
}
|
|
34
31
|
function createPrunedLockfile(packageJson, graph) {
|
|
35
32
|
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
36
|
-
const lockfileName = (0,
|
|
37
|
-
const lockFile = (0,
|
|
38
|
-
const workspacePackages = (0,
|
|
33
|
+
const lockfileName = (0, internal_1.getLockFileName)(packageManager);
|
|
34
|
+
const lockFile = (0, internal_1.createLockFile)(packageJson, graph, packageManager);
|
|
35
|
+
const workspacePackages = (0, internal_1.getWorkspacePackagesFromGraph)(graph);
|
|
39
36
|
for (const [pkgName, pkgVersion] of Object.entries(packageJson.dependencies ?? {})) {
|
|
40
37
|
if (pkgVersion.startsWith('workspace:') ||
|
|
41
38
|
pkgVersion.startsWith('file:') ||
|
|
@@ -125,7 +122,7 @@ function getOutputDir(schema, context) {
|
|
|
125
122
|
if (!maybeOutputPath) {
|
|
126
123
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
127
124
|
}
|
|
128
|
-
maybeOutputPath = (0,
|
|
125
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
129
126
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
130
127
|
projectRoot: project.root,
|
|
131
128
|
projectName: project.name,
|
|
@@ -7,7 +7,6 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
9
9
|
const node_fs_1 = require("node:fs");
|
|
10
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
11
10
|
const path_1 = require("path");
|
|
12
11
|
const semver_1 = require("semver");
|
|
13
12
|
let childProcess;
|
|
@@ -68,7 +67,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
69
|
function getVerdaccioBinPath() {
|
|
71
|
-
const { packageJson, path: packageJsonPath } = (0,
|
|
70
|
+
const { packageJson, path: packageJsonPath } = (0, internal_1.readModulePackageJson)('verdaccio');
|
|
72
71
|
const bin = typeof packageJson.bin === 'string'
|
|
73
72
|
? packageJson.bin
|
|
74
73
|
: packageJson.bin['verdaccio'];
|
|
@@ -111,6 +111,8 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
111
111
|
testEnvironment: options.testEnvironment,
|
|
112
112
|
runtimeTsconfigFileName: 'tsconfig.lib.json',
|
|
113
113
|
compiler: options.compiler === 'swc' ? 'swc' : 'babel',
|
|
114
|
+
passWithNoTests: options.passWithNoTests,
|
|
115
|
+
skipPackageJson: options.skipPackageJson,
|
|
114
116
|
addPlugin: options.addPlugin,
|
|
115
117
|
});
|
|
116
118
|
tasks.push(vitestTask);
|
|
@@ -560,22 +562,20 @@ async function normalizeOptions(tree, options) {
|
|
|
560
562
|
const hasPlugin = (0, ts_solution_setup_1.isUsingTypeScriptPlugin)(tree);
|
|
561
563
|
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
562
564
|
if (isUsingTsSolutionConfig) {
|
|
563
|
-
options.unitTestRunner ??=
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}, { unitTestRunner: 'none' }).then(({ unitTestRunner }) => unitTestRunner);
|
|
565
|
+
options.unitTestRunner ??= (0, internal_1.isInteractive)()
|
|
566
|
+
? await (0, internal_1.selectPrompt)({
|
|
567
|
+
message: `Which unit test runner would you like to use?`,
|
|
568
|
+
choices: [{ value: 'none' }, { value: 'vitest' }, { value: 'jest' }],
|
|
569
|
+
})
|
|
570
|
+
: 'none';
|
|
570
571
|
}
|
|
571
572
|
else {
|
|
572
|
-
options.unitTestRunner ??=
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}, { unitTestRunner: undefined }).then(({ unitTestRunner }) => unitTestRunner);
|
|
573
|
+
options.unitTestRunner ??= (0, internal_1.isInteractive)()
|
|
574
|
+
? await (0, internal_1.selectPrompt)({
|
|
575
|
+
message: `Which unit test runner would you like to use?`,
|
|
576
|
+
choices: [{ value: 'jest' }, { value: 'vitest' }, { value: 'none' }],
|
|
577
|
+
})
|
|
578
|
+
: undefined;
|
|
579
579
|
if (!options.unitTestRunner && options.bundler === 'vite') {
|
|
580
580
|
options.unitTestRunner = 'vitest';
|
|
581
581
|
}
|
|
@@ -36,6 +36,8 @@ export interface LibraryGeneratorSchema {
|
|
|
36
36
|
addPlugin?: boolean;
|
|
37
37
|
useProjectJson?: boolean;
|
|
38
38
|
useTscExecutor?: boolean;
|
|
39
|
+
/** @internal Only honored by the vitest setup. */
|
|
40
|
+
passWithNoTests?: boolean;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export interface NormalizedLibraryGeneratorOptions
|
|
@@ -5,12 +5,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
7
|
const node_path_1 = require("node:path");
|
|
8
|
-
const devkit_2 = require("@nx/devkit");
|
|
9
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
10
8
|
const picomatch = require("picomatch");
|
|
11
|
-
const internal_3 = require("@nx/devkit/internal");
|
|
12
|
-
const internal_4 = require("@nx/devkit/internal");
|
|
13
|
-
const internal_5 = require("@nx/devkit/internal");
|
|
14
9
|
const util_1 = require("./util");
|
|
15
10
|
let ts;
|
|
16
11
|
const resolvedTypescriptPaths = {};
|
|
@@ -20,12 +15,12 @@ function resolveTypescriptPath(projectRoot, workspaceRoot) {
|
|
|
20
15
|
// path is outside the workspace tree (e.g. pnpm's enableGlobalVirtualStore),
|
|
21
16
|
// since typescript is not a declared dep.
|
|
22
17
|
resolvedTypescriptPaths[projectRoot] ??= require.resolve('typescript', {
|
|
23
|
-
paths: [projectRoot, ...(0,
|
|
18
|
+
paths: [projectRoot, ...(0, internal_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
|
24
19
|
});
|
|
25
20
|
return resolvedTypescriptPaths[projectRoot];
|
|
26
21
|
}
|
|
27
22
|
const TSCONFIG_CACHE_VERSION = 2;
|
|
28
|
-
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(
|
|
23
|
+
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(internal_1.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
29
24
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
30
25
|
const cacheStore = new Map();
|
|
31
26
|
// Shared tsconfig cache — initialized once per batch, persisted to disk
|
|
@@ -117,8 +112,8 @@ const tsConfigGlob = '**/tsconfig*.json';
|
|
|
117
112
|
exports.createNodesV2 = [
|
|
118
113
|
tsConfigGlob,
|
|
119
114
|
async (configFilePaths, options, context) => {
|
|
120
|
-
const optionsHash = (0,
|
|
121
|
-
const targetsCachePath = (0, node_path_1.join)(
|
|
115
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
116
|
+
const targetsCachePath = (0, node_path_1.join)(internal_1.workspaceDataDirectory, `tsc-${optionsHash}.hash`);
|
|
122
117
|
const targetsCache = readFromCache(targetsCachePath);
|
|
123
118
|
// Each invocation gets a unique Symbol key — guaranteed no collisions
|
|
124
119
|
const cacheKey = Symbol('tsc-invocation');
|
|
@@ -136,7 +131,7 @@ exports.createNodesV2 = [
|
|
|
136
131
|
const normalizedOptions = normalizePluginOptions(options);
|
|
137
132
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
138
133
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
139
|
-
const lockFileName = (0,
|
|
134
|
+
const lockFileName = (0, internal_1.getLockFileName)(packageManager);
|
|
140
135
|
const { configFilePaths: validConfigFilePaths, hashes, projectRoots, } = await resolveValidConfigFilesAndHashes(configFilePaths, normalizedOptions, optionsHash, context, cache, lockFileName);
|
|
141
136
|
try {
|
|
142
137
|
return await (0, devkit_1.createNodesFromFiles)((configFilePath, options, context, idx) => {
|
|
@@ -171,7 +166,7 @@ exports.createNodesV2 = [
|
|
|
171
166
|
];
|
|
172
167
|
exports.createNodes = exports.createNodesV2;
|
|
173
168
|
async function resolveValidConfigFilesAndHashes(configFilePaths, options, optionsHash, context, cache, lockFileName) {
|
|
174
|
-
const lockFileHash = (0,
|
|
169
|
+
const lockFileHash = (0, internal_1.hashFile)((0, node_path_1.join)(context.workspaceRoot, lockFileName)) ?? '';
|
|
175
170
|
const validConfigFilePaths = [];
|
|
176
171
|
const hashes = [];
|
|
177
172
|
const projectRoots = [];
|
|
@@ -218,7 +213,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
218
213
|
packageJson = (0, devkit_1.readJsonFile)((0, node_path_1.join)(workspaceRoot, project.root, 'package.json'));
|
|
219
214
|
}
|
|
220
215
|
catch { }
|
|
221
|
-
return (0,
|
|
216
|
+
return (0, devkit_1.hashArray)([
|
|
222
217
|
...[
|
|
223
218
|
fullConfigPath,
|
|
224
219
|
...extendedConfigFiles.files.sort(),
|
|
@@ -228,7 +223,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
228
223
|
...extendedConfigFiles.packages.sort(),
|
|
229
224
|
lockFileHash,
|
|
230
225
|
optionsHash,
|
|
231
|
-
...(packageJson ? [(0,
|
|
226
|
+
...(packageJson ? [(0, internal_1.hashObject)(packageJson)] : []),
|
|
232
227
|
]);
|
|
233
228
|
}
|
|
234
229
|
function checkIfConfigFileShouldBeProject(config, cache) {
|
|
@@ -956,7 +951,7 @@ function getFileHash(filePath, workspaceRoot, cache) {
|
|
|
956
951
|
const relativePath = posixRelative(workspaceRoot, filePath);
|
|
957
952
|
if (!cache.fileHashes[relativePath]) {
|
|
958
953
|
const content = readFile(filePath, workspaceRoot, cache);
|
|
959
|
-
cache.fileHashes[relativePath] = (0,
|
|
954
|
+
cache.fileHashes[relativePath] = (0, devkit_1.hashArray)([content]);
|
|
960
955
|
}
|
|
961
956
|
return cache.fileHashes[relativePath];
|
|
962
957
|
}
|
|
@@ -4,7 +4,6 @@ exports.updateLockFile = updateLockFile;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
8
7
|
const semver_1 = require("semver");
|
|
9
8
|
async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
10
9
|
if (options?.skipLockFileUpdate) {
|
|
@@ -47,7 +46,7 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
47
46
|
installArgs = `${installArgs} --ignore-scripts`.trim();
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
|
-
const lockFile = (0,
|
|
49
|
+
const lockFile = (0, internal_1.getLockFileName)(packageManager);
|
|
51
50
|
const command = `${packageManagerCommands.updateLockFile} ${installArgs}`.trim();
|
|
52
51
|
if (verbose) {
|
|
53
52
|
if (dryRun) {
|
|
@@ -16,30 +16,26 @@ async function normalizeLinterOption(tree, linter) {
|
|
|
16
16
|
if (detected) {
|
|
17
17
|
return detected;
|
|
18
18
|
}
|
|
19
|
-
// Nothing to follow, so this is a real choice. `
|
|
20
|
-
//
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, { linter: 'none' }).then(({ linter }) => linter);
|
|
19
|
+
// Nothing to follow, so this is a real choice. `none` is the non-interactive
|
|
20
|
+
// answer, and leads the list so the interactive default matches it.
|
|
21
|
+
return (0, internal_1.isInteractive)()
|
|
22
|
+
? (0, internal_1.selectPrompt)({
|
|
23
|
+
message: `Which linter would you like to use?`,
|
|
24
|
+
choices: [{ value: 'none' }, { value: 'eslint' }, { value: 'oxlint' }],
|
|
25
|
+
})
|
|
26
|
+
: 'none';
|
|
28
27
|
}
|
|
29
28
|
async function normalizeUnitTestRunnerOption(tree, unitTestRunner, testRunners = ['jest', 'vitest']) {
|
|
30
29
|
if (unitTestRunner) {
|
|
31
30
|
return unitTestRunner;
|
|
32
31
|
}
|
|
33
32
|
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
34
|
-
const choices = isTsSolutionSetup
|
|
35
|
-
? [{ name: 'none' }, ...testRunners.map((runner) => ({ name: runner }))]
|
|
36
|
-
: [...testRunners.map((runner) => ({ name: runner })), { name: 'none' }];
|
|
33
|
+
const choices = (isTsSolutionSetup ? ['none', ...testRunners] : [...testRunners, 'none']).map((value) => ({ value: value }));
|
|
37
34
|
const defaultValue = (isTsSolutionSetup ? 'none' : testRunners[0]);
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, { unitTestRunner: defaultValue }).then(({ unitTestRunner }) => unitTestRunner);
|
|
35
|
+
return (0, internal_1.isInteractive)()
|
|
36
|
+
? (0, internal_1.selectPrompt)({
|
|
37
|
+
message: `Which unit test runner would you like to use?`,
|
|
38
|
+
choices,
|
|
39
|
+
})
|
|
40
|
+
: defaultValue;
|
|
45
41
|
}
|
|
@@ -5,21 +5,18 @@ exports.getExports = getExports;
|
|
|
5
5
|
exports.getUpdatedPackageJsonContent = getUpdatedPackageJsonContent;
|
|
6
6
|
exports.getOutputDir = getOutputDir;
|
|
7
7
|
const internal_1 = require("@nx/devkit/internal");
|
|
8
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
9
8
|
const devkit_1 = require("@nx/devkit");
|
|
10
9
|
const node_fs_1 = require("node:fs");
|
|
11
10
|
const path_1 = require("path");
|
|
12
|
-
const internal_3 = require("@nx/devkit/internal");
|
|
13
|
-
const internal_4 = require("@nx/devkit/internal");
|
|
14
11
|
const get_main_file_dir_1 = require("../get-main-file-dir");
|
|
15
12
|
const strip_glob_to_base_dir_1 = require("../strip-glob-to-base-dir");
|
|
16
13
|
function updatePackageJson(options, context, target, dependencies, fileMap = null) {
|
|
17
14
|
let packageJson;
|
|
18
15
|
if (fileMap == null) {
|
|
19
|
-
fileMap = (0,
|
|
16
|
+
fileMap = (0, internal_1.readFileMapCache)()?.fileMap?.projectFileMap || {};
|
|
20
17
|
}
|
|
21
18
|
if (options.updateBuildableProjectDepsInPackageJson) {
|
|
22
|
-
packageJson = (0,
|
|
19
|
+
packageJson = (0, internal_1.createPackageJson)(context.projectName, context.projectGraph, {
|
|
23
20
|
target: context.targetName,
|
|
24
21
|
root: context.root,
|
|
25
22
|
// By default we remove devDependencies since this is a production build.
|
|
@@ -32,7 +29,7 @@ function updatePackageJson(options, context, target, dependencies, fileMap = nul
|
|
|
32
29
|
}
|
|
33
30
|
else {
|
|
34
31
|
const pathToPackageJson = (0, path_1.join)(context.root, options.projectRoot, 'package.json');
|
|
35
|
-
packageJson = (0,
|
|
32
|
+
packageJson = (0, internal_1.fileExists)(pathToPackageJson)
|
|
36
33
|
? (0, devkit_1.readJsonFile)(pathToPackageJson)
|
|
37
34
|
: { name: context.projectName, version: '0.0.1' };
|
|
38
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -147,18 +147,18 @@
|
|
|
147
147
|
"source-map-support": "0.5.19",
|
|
148
148
|
"tinyglobby": "^0.2.12",
|
|
149
149
|
"tslib": "^2.3.0",
|
|
150
|
-
"@nx/devkit": "23.2.0-beta.
|
|
151
|
-
"@nx/workspace": "23.2.0-beta.
|
|
150
|
+
"@nx/devkit": "23.2.0-beta.8",
|
|
151
|
+
"@nx/workspace": "23.2.0-beta.8"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
|
-
"@nx/esbuild": "23.2.0-beta.
|
|
155
|
-
"@nx/
|
|
156
|
-
"@nx/
|
|
157
|
-
"@nx/oxlint": "23.2.0-beta.
|
|
158
|
-
"@nx/
|
|
159
|
-
"@nx/
|
|
160
|
-
"@nx/vitest": "23.2.0-beta.
|
|
161
|
-
"nx": "23.2.0-beta.
|
|
154
|
+
"@nx/esbuild": "23.2.0-beta.8",
|
|
155
|
+
"@nx/eslint": "23.2.0-beta.8",
|
|
156
|
+
"@nx/jest": "23.2.0-beta.8",
|
|
157
|
+
"@nx/oxlint": "23.2.0-beta.8",
|
|
158
|
+
"@nx/vite": "23.2.0-beta.8",
|
|
159
|
+
"@nx/rollup": "23.2.0-beta.8",
|
|
160
|
+
"@nx/vitest": "23.2.0-beta.8",
|
|
161
|
+
"nx": "23.2.0-beta.8"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
164
164
|
"@swc/cli": ">=0.6.0 <0.9.0",
|