nx 19.2.1 → 19.3.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/post-install.js +3 -1
- package/package.json +12 -12
- package/src/command-line/init/implementation/utils.js +2 -15
- package/src/daemon/client/client.js +2 -0
- package/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/src/executors/run-commands/run-commands.impl.js +11 -17
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
package/bin/post-install.js
CHANGED
@@ -14,6 +14,7 @@ const workspace_context_1 = require("../src/utils/workspace-context");
|
|
14
14
|
const logger_1 = require("../src/utils/logger");
|
15
15
|
(async () => {
|
16
16
|
const start = new Date();
|
17
|
+
let errored = false;
|
17
18
|
try {
|
18
19
|
(0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
|
19
20
|
if (isMainNxPackage() && (0, fileutils_1.fileExists)((0, path_1.join)(workspace_root_1.workspaceRoot, 'nx.json'))) {
|
@@ -38,12 +39,13 @@ const logger_1 = require("../src/utils/logger");
|
|
38
39
|
}
|
39
40
|
}
|
40
41
|
catch (e) {
|
42
|
+
errored = true;
|
41
43
|
logger_1.logger.verbose(e);
|
42
44
|
}
|
43
45
|
finally {
|
44
46
|
const end = new Date();
|
45
47
|
logger_1.logger.verbose(`Nx postinstall steps took ${end.getTime() - start.getTime()}ms`);
|
46
|
-
process.exit(0);
|
48
|
+
process.exit(errored ? 1 : 0);
|
47
49
|
}
|
48
50
|
})();
|
49
51
|
function isMainNxPackage() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.3.0-beta.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"yargs-parser": "21.1.1",
|
71
71
|
"node-machine-id": "1.1.12",
|
72
72
|
"ora": "5.3.0",
|
73
|
-
"@nrwl/tao": "19.
|
73
|
+
"@nrwl/tao": "19.3.0-beta.0"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
76
76
|
"@swc-node/register": "^1.8.0",
|
@@ -85,16 +85,16 @@
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
"optionalDependencies": {
|
88
|
-
"@nx/nx-darwin-x64": "19.
|
89
|
-
"@nx/nx-darwin-arm64": "19.
|
90
|
-
"@nx/nx-linux-x64-gnu": "19.
|
91
|
-
"@nx/nx-linux-x64-musl": "19.
|
92
|
-
"@nx/nx-win32-x64-msvc": "19.
|
93
|
-
"@nx/nx-linux-arm64-gnu": "19.
|
94
|
-
"@nx/nx-linux-arm64-musl": "19.
|
95
|
-
"@nx/nx-linux-arm-gnueabihf": "19.
|
96
|
-
"@nx/nx-win32-arm64-msvc": "19.
|
97
|
-
"@nx/nx-freebsd-x64": "19.
|
88
|
+
"@nx/nx-darwin-x64": "19.3.0-beta.0",
|
89
|
+
"@nx/nx-darwin-arm64": "19.3.0-beta.0",
|
90
|
+
"@nx/nx-linux-x64-gnu": "19.3.0-beta.0",
|
91
|
+
"@nx/nx-linux-x64-musl": "19.3.0-beta.0",
|
92
|
+
"@nx/nx-win32-x64-msvc": "19.3.0-beta.0",
|
93
|
+
"@nx/nx-linux-arm64-gnu": "19.3.0-beta.0",
|
94
|
+
"@nx/nx-linux-arm64-musl": "19.3.0-beta.0",
|
95
|
+
"@nx/nx-linux-arm-gnueabihf": "19.3.0-beta.0",
|
96
|
+
"@nx/nx-win32-arm64-msvc": "19.3.0-beta.0",
|
97
|
+
"@nx/nx-freebsd-x64": "19.3.0-beta.0"
|
98
98
|
},
|
99
99
|
"nx-migrations": {
|
100
100
|
"migrations": "./migrations.json",
|
@@ -98,23 +98,10 @@ function updateGitIgnore(root) {
|
|
98
98
|
const ignorePath = (0, path_1.join)(root, '.gitignore');
|
99
99
|
try {
|
100
100
|
let contents = (0, fs_1.readFileSync)(ignorePath, 'utf-8');
|
101
|
-
const lines = contents.split('\n');
|
102
|
-
let sepIncluded = false;
|
103
101
|
if (!contents.includes('.nx/cache')) {
|
104
|
-
|
105
|
-
|
106
|
-
sepIncluded = true;
|
107
|
-
}
|
108
|
-
lines.push('.nx/cache');
|
109
|
-
}
|
110
|
-
if (!contents.includes('.nx/workspace-data')) {
|
111
|
-
if (!sepIncluded) {
|
112
|
-
lines.push('\n');
|
113
|
-
sepIncluded = true;
|
114
|
-
}
|
115
|
-
lines.push('.nx/workspace-data');
|
102
|
+
contents = [contents, '', '.nx/cache'].join('\n');
|
103
|
+
(0, fs_1.writeFileSync)(ignorePath, contents, 'utf-8');
|
116
104
|
}
|
117
|
-
(0, fs_1.writeFileSync)(ignorePath, lines.join('\n'), 'utf-8');
|
118
105
|
}
|
119
106
|
catch { }
|
120
107
|
}
|
@@ -19,6 +19,7 @@ const nx_json_1 = require("../../config/nx-json");
|
|
19
19
|
const daemon_socket_messenger_1 = require("./daemon-socket-messenger");
|
20
20
|
const cache_1 = require("../cache");
|
21
21
|
const error_types_1 = require("../../project-graph/error-types");
|
22
|
+
const dotenv_1 = require("../../utils/dotenv");
|
22
23
|
const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
|
23
24
|
const get_context_file_data_1 = require("../message-types/get-context-file-data");
|
24
25
|
const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
|
@@ -40,6 +41,7 @@ class DaemonClient {
|
|
40
41
|
this._daemonReady = null;
|
41
42
|
this._out = null;
|
42
43
|
this._err = null;
|
44
|
+
(0, dotenv_1.loadRootEnvFiles)(workspace_root_1.workspaceRoot);
|
43
45
|
try {
|
44
46
|
this.nxJson = (0, configuration_1.readNxJson)();
|
45
47
|
}
|
@@ -29,9 +29,7 @@ const propKeys = [
|
|
29
29
|
'command',
|
30
30
|
'commands',
|
31
31
|
'color',
|
32
|
-
'no-color',
|
33
32
|
'parallel',
|
34
|
-
'no-parallel',
|
35
33
|
'readyWhen',
|
36
34
|
'cwd',
|
37
35
|
'args',
|
@@ -133,7 +131,6 @@ function normalizeOptions(options) {
|
|
133
131
|
'parse-numbers': false,
|
134
132
|
'parse-positional-numbers': false,
|
135
133
|
'dot-notation': false,
|
136
|
-
'camel-case-expansion': false,
|
137
134
|
},
|
138
135
|
});
|
139
136
|
options.unknownOptions = Object.keys(options)
|
@@ -297,21 +294,20 @@ function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
|
|
297
294
|
else if (forwardAllArgs) {
|
298
295
|
let args = '';
|
299
296
|
if (Object.keys(opts.unknownOptions ?? {}).length > 0) {
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
}
|
297
|
+
args +=
|
298
|
+
' ' +
|
299
|
+
Object.keys(opts.unknownOptions)
|
300
|
+
.filter((k) => typeof opts.unknownOptions[k] !== 'object' &&
|
301
|
+
opts.parsedArgs[k] === opts.unknownOptions[k])
|
302
|
+
.map((k) => `--${k}=${opts.unknownOptions[k]}`)
|
303
|
+
.map(wrapArgIntoQuotesIfNeeded)
|
304
|
+
.join(' ');
|
309
305
|
}
|
310
306
|
if (opts.args) {
|
311
307
|
args += ` ${opts.args}`;
|
312
308
|
}
|
313
309
|
if (opts.__unparsed__?.length > 0) {
|
314
|
-
const filterdParsedOptions = filterPropKeysFromUnParsedOptions(opts.__unparsed__, opts.
|
310
|
+
const filterdParsedOptions = filterPropKeysFromUnParsedOptions(opts.__unparsed__, opts.unparsedCommandArgs);
|
315
311
|
if (filterdParsedOptions.length > 0) {
|
316
312
|
args += ` ${filterdParsedOptions
|
317
313
|
.map(wrapArgIntoQuotesIfNeeded)
|
@@ -339,14 +335,13 @@ function parseArgs(unparsedCommandArgs, unknownOptions, args) {
|
|
339
335
|
* @param unparsedCommandArgs e.g. { prop1: 'value1', prop2: 'value2', args: 'test'}
|
340
336
|
* @returns filtered options that are not part of the propKeys array e.g. ['--prop1', 'value1', '--prop2=value2']
|
341
337
|
*/
|
342
|
-
function filterPropKeysFromUnParsedOptions(__unparsed__,
|
338
|
+
function filterPropKeysFromUnParsedOptions(__unparsed__, unparsedCommandArgs = {}) {
|
343
339
|
const parsedOptions = [];
|
344
340
|
for (let index = 0; index < __unparsed__.length; index++) {
|
345
341
|
const element = __unparsed__[index];
|
346
342
|
if (element.startsWith('--')) {
|
347
343
|
const key = element.replace('--', '');
|
348
344
|
if (element.includes('=')) {
|
349
|
-
// key can be in the format of --key=value or --key.subkey=value (e.g. env.foo=bar)
|
350
345
|
if (!propKeys.includes(key.split('=')[0].split('.')[0])) {
|
351
346
|
// check if the key is part of the propKeys array
|
352
347
|
parsedOptions.push(element);
|
@@ -356,8 +351,7 @@ function filterPropKeysFromUnParsedOptions(__unparsed__, parseArgs = {}) {
|
|
356
351
|
// check if the next element is a value for the key
|
357
352
|
if (propKeys.includes(key)) {
|
358
353
|
if (index + 1 < __unparsed__.length &&
|
359
|
-
|
360
|
-
__unparsed__[index + 1].toString() === parseArgs[key].toString()) {
|
354
|
+
__unparsed__[index + 1] === unparsedCommandArgs[key]) {
|
361
355
|
index++; // skip the next element
|
362
356
|
}
|
363
357
|
}
|
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
|
|
9
9
|
* @param nxJson
|
10
10
|
*/
|
11
11
|
export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
|
12
|
-
allWorkspaceFiles: import("
|
12
|
+
allWorkspaceFiles: import("../file-utils").FileData[];
|
13
13
|
fileMap: {
|
14
14
|
projectFileMap: ProjectFiles;
|
15
|
-
nonProjectFiles: import("
|
15
|
+
nonProjectFiles: import("../../native").FileData[];
|
16
16
|
};
|
17
|
-
rustReferences: import("
|
17
|
+
rustReferences: import("../../native").NxWorkspaceFilesExternals;
|
18
18
|
}>;
|
19
19
|
/**
|
20
20
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|