nx 22.1.0-rc.1 → 22.1.0-rc.3
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/bin/init-local.d.ts.map +1 -1
- package/bin/init-local.js +40 -2
- package/package.json +11 -11
- package/src/command-line/add/add.d.ts.map +1 -1
- package/src/command-line/add/add.js +5 -2
- package/src/command-line/init/command-object.d.ts.map +1 -1
- package/src/command-line/init/command-object.js +10 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.d.ts +3 -0
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +14 -0
- package/src/daemon/message-types/nx-console.d.ts +18 -0
- package/src/daemon/message-types/nx-console.d.ts.map +1 -0
- package/src/daemon/message-types/nx-console.js +19 -0
- package/src/daemon/server/handle-nx-console.d.ts +4 -0
- package/src/daemon/server/handle-nx-console.d.ts.map +1 -0
- package/src/daemon/server/handle-nx-console.js +54 -0
- package/src/daemon/server/nx-console-operations.d.ts +31 -0
- package/src/daemon/server/nx-console-operations.d.ts.map +1 -0
- package/src/daemon/server/nx-console-operations.js +135 -0
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +12 -0
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +3 -0
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/native/index.d.ts +37 -24
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/process-metrics-service.d.ts +2 -2
- package/src/tasks-runner/process-metrics-service.d.ts.map +1 -1
- package/src/utils/package-json.d.ts +4 -0
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +45 -11
|
@@ -9,10 +9,13 @@ exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
|
|
9
9
|
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
|
10
10
|
exports.readModulePackageJson = readModulePackageJson;
|
|
11
11
|
exports.installPackageToTmp = installPackageToTmp;
|
|
12
|
+
exports.installPackageToTmpAsync = installPackageToTmpAsync;
|
|
12
13
|
exports.getDependencyVersionFromPackageJson = getDependencyVersionFromPackageJson;
|
|
13
14
|
const child_process_1 = require("child_process");
|
|
15
|
+
const util_1 = require("util");
|
|
14
16
|
const fs_1 = require("fs");
|
|
15
17
|
const path_1 = require("path");
|
|
18
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
16
19
|
const tmp_1 = require("tmp");
|
|
17
20
|
const json_1 = require("../generators/utils/json");
|
|
18
21
|
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
|
@@ -199,7 +202,11 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
|
199
202
|
path: packageJsonPath,
|
|
200
203
|
};
|
|
201
204
|
}
|
|
202
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Prepares all necessary information for installing a package to a temporary directory.
|
|
207
|
+
* This is used by both sync and async installation functions.
|
|
208
|
+
*/
|
|
209
|
+
function preparePackageInstallation(pkg, requiredVersion) {
|
|
203
210
|
const { dir: tempDir, cleanup } = (0, package_manager_1.createTempNpmDirectory)?.() ?? {
|
|
204
211
|
dir: (0, tmp_1.dirSync)().name,
|
|
205
212
|
cleanup: () => { },
|
|
@@ -209,29 +216,56 @@ function installPackageToTmp(pkg, requiredVersion) {
|
|
|
209
216
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
210
217
|
generatePackageManagerFiles(tempDir, packageManager);
|
|
211
218
|
const preInstallCommand = (0, package_manager_1.getPackageManagerCommand)(packageManager).preInstall;
|
|
212
|
-
if (preInstallCommand) {
|
|
213
|
-
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
214
|
-
(0, child_process_1.execSync)(preInstallCommand, {
|
|
215
|
-
cwd: tempDir,
|
|
216
|
-
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
217
|
-
windowsHide: false,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
219
|
const pmCommands = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
221
220
|
let addCommand = pmCommands.addDev;
|
|
222
221
|
if (packageManager === 'pnpm') {
|
|
223
222
|
addCommand = 'pnpm add -D'; // we need to ensure that we are not using workspace command
|
|
224
223
|
}
|
|
225
|
-
|
|
224
|
+
const installCommand = `${addCommand} ${pkg}@${requiredVersion} ${pmCommands.ignoreScriptsFlag ?? ''}`;
|
|
225
|
+
const execOptions = {
|
|
226
226
|
cwd: tempDir,
|
|
227
227
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
228
228
|
windowsHide: false,
|
|
229
|
-
}
|
|
229
|
+
};
|
|
230
230
|
return {
|
|
231
231
|
tempDir,
|
|
232
232
|
cleanup,
|
|
233
|
+
preInstallCommand,
|
|
234
|
+
installCommand,
|
|
235
|
+
execOptions,
|
|
233
236
|
};
|
|
234
237
|
}
|
|
238
|
+
function installPackageToTmp(pkg, requiredVersion) {
|
|
239
|
+
const { tempDir, cleanup, preInstallCommand, installCommand, execOptions } = preparePackageInstallation(pkg, requiredVersion);
|
|
240
|
+
if (preInstallCommand) {
|
|
241
|
+
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
242
|
+
(0, child_process_1.execSync)(preInstallCommand, execOptions);
|
|
243
|
+
}
|
|
244
|
+
(0, child_process_1.execSync)(installCommand, execOptions);
|
|
245
|
+
return {
|
|
246
|
+
tempDir,
|
|
247
|
+
cleanup,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
async function installPackageToTmpAsync(pkg, requiredVersion) {
|
|
251
|
+
const { tempDir, cleanup, preInstallCommand, installCommand, execOptions } = preparePackageInstallation(pkg, requiredVersion);
|
|
252
|
+
try {
|
|
253
|
+
if (preInstallCommand) {
|
|
254
|
+
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
255
|
+
await execAsync(preInstallCommand, execOptions);
|
|
256
|
+
}
|
|
257
|
+
await execAsync(installCommand, execOptions);
|
|
258
|
+
return {
|
|
259
|
+
tempDir,
|
|
260
|
+
cleanup,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
// Clean up on error
|
|
265
|
+
cleanup();
|
|
266
|
+
throw error;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
235
269
|
function getDependencyVersionFromPackageJson(treeOrPackageName, packageNameOrRoot, packageJsonPathOrObjectOrRoot, dependencyLookup) {
|
|
236
270
|
if (typeof treeOrPackageName !== 'string') {
|
|
237
271
|
return getDependencyVersionFromPackageJsonFromTree(treeOrPackageName, packageNameOrRoot, packageJsonPathOrObjectOrRoot, dependencyLookup);
|