nx 19.2.0-canary.20240530-316dcb9 → 19.2.0-canary.20240601-6f22300
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +12 -12
- package/src/command-line/deprecated/command-objects.js +2 -1
- package/src/command-line/examples.js +59 -5
- package/src/command-line/graph/command-object.d.ts +25 -2
- package/src/command-line/graph/command-object.js +57 -3
- package/src/command-line/graph/graph.js +2 -1
- package/src/command-line/init/implementation/react/index.js +1 -1
- package/src/command-line/init/implementation/react/rename-js-to-jsx.d.ts +1 -1
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +2 -2
- package/src/command-line/init/init-v2.js +1 -1
- package/src/command-line/nx-commands.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +0 -21
- package/src/command-line/yargs-utils/shared-options.js +2 -52
- package/src/daemon/client/client.d.ts +6 -0
- package/src/daemon/client/client.js +45 -2
- package/src/daemon/is-on-daemon.d.ts +1 -0
- package/src/daemon/is-on-daemon.js +7 -0
- package/src/daemon/message-types/get-context-file-data.d.ts +5 -0
- package/src/daemon/message-types/get-context-file-data.js +11 -0
- package/src/daemon/message-types/get-files-in-directory.d.ts +6 -0
- package/src/daemon/message-types/get-files-in-directory.js +11 -0
- package/src/daemon/message-types/get-nx-workspace-files.d.ts +6 -0
- package/src/daemon/message-types/get-nx-workspace-files.js +11 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +11 -0
- package/src/daemon/message-types/hash-glob.d.ts +7 -0
- package/src/daemon/message-types/hash-glob.js +11 -0
- package/src/daemon/message-types/update-context-files.d.ts +7 -0
- package/src/daemon/message-types/update-context-files.js +11 -0
- package/src/daemon/server/handle-context-file-data.d.ts +2 -0
- package/src/daemon/server/handle-context-file-data.js +13 -0
- package/src/daemon/server/handle-get-files-in-directory.d.ts +2 -0
- package/src/daemon/server/handle-get-files-in-directory.js +13 -0
- package/src/daemon/server/handle-glob.d.ts +2 -0
- package/src/daemon/server/handle-glob.js +13 -0
- package/src/daemon/server/handle-hash-glob.d.ts +2 -0
- package/src/daemon/server/handle-hash-glob.js +13 -0
- package/src/daemon/server/handle-nx-workspace-files.d.ts +2 -0
- package/src/daemon/server/handle-nx-workspace-files.js +13 -0
- package/src/daemon/server/server.js +39 -9
- package/src/devkit-exports.d.ts +4 -2
- package/src/devkit-exports.js +6 -1
- package/src/generators/utils/glob.d.ts +11 -0
- package/src/generators/utils/glob.js +20 -3
- package/src/generators/utils/project-configuration.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +16 -3
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +2 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +40 -27
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +2 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +14 -19
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +32 -5
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +146 -47
- package/src/plugins/js/utils/resolve-relative-to-dir.d.ts +5 -0
- package/src/plugins/js/utils/resolve-relative-to-dir.js +18 -0
- package/src/project-graph/error-types.d.ts +37 -19
- package/src/project-graph/error-types.js +31 -19
- package/src/project-graph/file-map-utils.js +1 -8
- package/src/project-graph/file-utils.js +33 -34
- package/src/project-graph/plugins/index.d.ts +1 -0
- package/src/project-graph/plugins/index.js +3 -1
- package/src/project-graph/plugins/internal-api.d.ts +2 -2
- package/src/project-graph/plugins/internal-api.js +33 -3
- package/src/project-graph/plugins/isolation/plugin-pool.js +10 -9
- package/src/project-graph/plugins/public-api.d.ts +34 -3
- package/src/project-graph/plugins/utils.d.ts +4 -3
- package/src/project-graph/plugins/utils.js +13 -26
- package/src/project-graph/utils/project-configuration-utils.js +89 -74
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -4
- package/src/project-graph/utils/retrieve-workspace-files.js +6 -6
- package/src/utils/all-file-data.js +1 -7
- package/src/utils/workspace-context.d.ts +13 -5
- package/src/utils/workspace-context.js +45 -14
- package/src/daemon/server/handle-request-file-data.d.ts +0 -4
- package/src/daemon/server/handle-request-file-data.js +0 -13
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.2.0-canary.
|
3
|
+
"version": "19.2.0-canary.20240601-6f22300",
|
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": {
|
@@ -69,7 +69,7 @@
|
|
69
69
|
"yargs-parser": "21.1.1",
|
70
70
|
"node-machine-id": "1.1.12",
|
71
71
|
"ora": "5.3.0",
|
72
|
-
"@nrwl/tao": "19.2.0-canary.
|
72
|
+
"@nrwl/tao": "19.2.0-canary.20240601-6f22300"
|
73
73
|
},
|
74
74
|
"peerDependencies": {
|
75
75
|
"@swc-node/register": "^1.8.0",
|
@@ -84,16 +84,16 @@
|
|
84
84
|
}
|
85
85
|
},
|
86
86
|
"optionalDependencies": {
|
87
|
-
"@nx/nx-darwin-x64": "19.2.0-canary.
|
88
|
-
"@nx/nx-darwin-arm64": "19.2.0-canary.
|
89
|
-
"@nx/nx-linux-x64-gnu": "19.2.0-canary.
|
90
|
-
"@nx/nx-linux-x64-musl": "19.2.0-canary.
|
91
|
-
"@nx/nx-win32-x64-msvc": "19.2.0-canary.
|
92
|
-
"@nx/nx-linux-arm64-gnu": "19.2.0-canary.
|
93
|
-
"@nx/nx-linux-arm64-musl": "19.2.0-canary.
|
94
|
-
"@nx/nx-linux-arm-gnueabihf": "19.2.0-canary.
|
95
|
-
"@nx/nx-win32-arm64-msvc": "19.2.0-canary.
|
96
|
-
"@nx/nx-freebsd-x64": "19.2.0-canary.
|
87
|
+
"@nx/nx-darwin-x64": "19.2.0-canary.20240601-6f22300",
|
88
|
+
"@nx/nx-darwin-arm64": "19.2.0-canary.20240601-6f22300",
|
89
|
+
"@nx/nx-linux-x64-gnu": "19.2.0-canary.20240601-6f22300",
|
90
|
+
"@nx/nx-linux-x64-musl": "19.2.0-canary.20240601-6f22300",
|
91
|
+
"@nx/nx-win32-x64-msvc": "19.2.0-canary.20240601-6f22300",
|
92
|
+
"@nx/nx-linux-arm64-gnu": "19.2.0-canary.20240601-6f22300",
|
93
|
+
"@nx/nx-linux-arm64-musl": "19.2.0-canary.20240601-6f22300",
|
94
|
+
"@nx/nx-linux-arm-gnueabihf": "19.2.0-canary.20240601-6f22300",
|
95
|
+
"@nx/nx-win32-arm64-msvc": "19.2.0-canary.20240601-6f22300",
|
96
|
+
"@nx/nx-freebsd-x64": "19.2.0-canary.20240601-6f22300"
|
97
97
|
},
|
98
98
|
"nx-migrations": {
|
99
99
|
"migrations": "./migrations.json",
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsPrintAffectedCommand = exports.yargsAffectedGraphCommand = void 0;
|
4
4
|
const params_1 = require("../../utils/params");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
+
const command_object_1 = require("../graph/command-object");
|
6
7
|
const affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command has been removed in Nx 19.';
|
7
8
|
const printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command has been removed in Nx 19.';
|
8
9
|
/**
|
@@ -12,7 +13,7 @@ exports.yargsAffectedGraphCommand = {
|
|
12
13
|
command: 'affected:graph',
|
13
14
|
describe: false,
|
14
15
|
aliases: ['affected:dep-graph'],
|
15
|
-
builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0,
|
16
|
+
builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, command_object_1.withGraphOptions)(yargs)),
|
16
17
|
handler: (args) => (0, params_1.handleErrors)(false, () => {
|
17
18
|
throw new Error(affectedGraphDeprecationMessage);
|
18
19
|
}),
|
@@ -33,7 +33,19 @@ exports.examples = {
|
|
33
33
|
},
|
34
34
|
{
|
35
35
|
command: 'affected -t build --tag=$NX_TASK_TARGET_PROJECT:latest',
|
36
|
-
description: 'Use the currently executing project name in your command
|
36
|
+
description: 'Use the currently executing project name in your command',
|
37
|
+
},
|
38
|
+
{
|
39
|
+
command: 'affected -t=build --graph',
|
40
|
+
description: 'Preview the task graph that Nx would run inside a webview',
|
41
|
+
},
|
42
|
+
{
|
43
|
+
command: 'affected -t=build --graph=output.json',
|
44
|
+
description: 'Save the task graph to a file',
|
45
|
+
},
|
46
|
+
{
|
47
|
+
command: 'affected -t=build --graph=stdout',
|
48
|
+
description: 'Print the task graph to the console',
|
37
49
|
},
|
38
50
|
],
|
39
51
|
'affected:test': [
|
@@ -123,6 +135,10 @@ exports.examples = {
|
|
123
135
|
command: 'graph --file=output.html',
|
124
136
|
description: 'Generate a static website with project graph into an html file, accompanied by an asset folder called static',
|
125
137
|
},
|
138
|
+
{
|
139
|
+
command: 'graph --print',
|
140
|
+
description: 'Print the project graph as JSON to the console',
|
141
|
+
},
|
126
142
|
{
|
127
143
|
command: 'graph --focus=todos-feature-main',
|
128
144
|
description: 'Show the graph where every node is either an ancestor or a descendant of todos-feature-main',
|
@@ -191,6 +207,44 @@ exports.examples = {
|
|
191
207
|
command: 'run-many --targets=lint,test,build',
|
192
208
|
description: 'Run lint, test, and build targets for all projects. Requires Nx v15.4+',
|
193
209
|
},
|
210
|
+
{
|
211
|
+
command: 'run-many -t=build --graph',
|
212
|
+
description: 'Preview the task graph that Nx would run inside a webview',
|
213
|
+
},
|
214
|
+
{
|
215
|
+
command: 'run-many -t=build --graph=output.json',
|
216
|
+
description: 'Save the task graph to a file',
|
217
|
+
},
|
218
|
+
{
|
219
|
+
command: 'run-many -t=build --graph=stdout',
|
220
|
+
description: 'Print the task graph to the console',
|
221
|
+
},
|
222
|
+
],
|
223
|
+
run: [
|
224
|
+
{
|
225
|
+
command: 'run myapp:build',
|
226
|
+
description: 'Run the target build for the myapp project',
|
227
|
+
},
|
228
|
+
{
|
229
|
+
command: 'run myapp:build:production',
|
230
|
+
description: 'Run the target build for the myapp project, with production configuration',
|
231
|
+
},
|
232
|
+
{
|
233
|
+
command: 'run myapp:build --graph',
|
234
|
+
description: 'Preview the task graph that Nx would run inside a webview',
|
235
|
+
},
|
236
|
+
{
|
237
|
+
command: 'run myapp:build --graph=output.json',
|
238
|
+
description: 'Save the task graph to a file',
|
239
|
+
},
|
240
|
+
{
|
241
|
+
command: 'run myapp:build --graph=stdout',
|
242
|
+
description: 'Print the task graph to the console',
|
243
|
+
},
|
244
|
+
{
|
245
|
+
command: 'run myapp:"build:test"',
|
246
|
+
description: 'Run\'s a target named build:test for the myapp project. Note the quotes around the target name to prevent "test" from being considered a configuration',
|
247
|
+
},
|
194
248
|
],
|
195
249
|
migrate: [
|
196
250
|
{
|
@@ -237,7 +291,7 @@ exports.examples = {
|
|
237
291
|
},
|
238
292
|
{
|
239
293
|
command: 'show projects --projects api-*',
|
240
|
-
description: 'Show all projects with names starting with "api-". The "projects" option is useful to see which projects would be selected by run-many
|
294
|
+
description: 'Show all projects with names starting with "api-". The "projects" option is useful to see which projects would be selected by run-many',
|
241
295
|
},
|
242
296
|
{
|
243
297
|
command: 'show projects --with-target serve',
|
@@ -257,15 +311,15 @@ exports.examples = {
|
|
257
311
|
},
|
258
312
|
{
|
259
313
|
command: 'show project my-app',
|
260
|
-
description: 'If in an interactive terminal, opens the project detail view. If not in an interactive terminal, defaults to JSON
|
314
|
+
description: 'If in an interactive terminal, opens the project detail view. If not in an interactive terminal, defaults to JSON',
|
261
315
|
},
|
262
316
|
{
|
263
317
|
command: 'show project my-app --json',
|
264
|
-
description: 'Show detailed information about "my-app" in a json format
|
318
|
+
description: 'Show detailed information about "my-app" in a json format',
|
265
319
|
},
|
266
320
|
{
|
267
321
|
command: 'show project my-app --json false',
|
268
|
-
description: 'Show information about "my-app" in a human readable format
|
322
|
+
description: 'Show information about "my-app" in a human readable format',
|
269
323
|
},
|
270
324
|
{
|
271
325
|
command: 'show project my-app --web',
|
@@ -1,2 +1,25 @@
|
|
1
|
-
import { CommandModule } from 'yargs';
|
2
|
-
export declare const
|
1
|
+
import { Argv, CommandModule } from 'yargs';
|
2
|
+
export declare const yargsGraphCommand: CommandModule;
|
3
|
+
export declare function withGraphOptions(yargs: Argv): Argv<{
|
4
|
+
file: string;
|
5
|
+
} & {
|
6
|
+
print: boolean;
|
7
|
+
} & {
|
8
|
+
view: string;
|
9
|
+
} & {
|
10
|
+
targets: string;
|
11
|
+
} & {
|
12
|
+
focus: string;
|
13
|
+
} & {
|
14
|
+
exclude: string;
|
15
|
+
} & {
|
16
|
+
groupByFolder: boolean;
|
17
|
+
} & {
|
18
|
+
host: string;
|
19
|
+
} & {
|
20
|
+
port: number;
|
21
|
+
} & {
|
22
|
+
watch: boolean;
|
23
|
+
} & {
|
24
|
+
open: boolean;
|
25
|
+
}>;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.withGraphOptions = exports.yargsGraphCommand = void 0;
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
exports.
|
6
|
+
exports.yargsGraphCommand = {
|
7
7
|
command: 'graph',
|
8
8
|
describe: 'Graph dependencies within workspace',
|
9
9
|
aliases: ['dep-graph'],
|
10
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)((0, shared_options_1.withAffectedOptions)((
|
10
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)((0, shared_options_1.withAffectedOptions)(withGraphOptions(yargs))), 'dep-graph')
|
11
11
|
.option('affected', {
|
12
12
|
type: 'boolean',
|
13
13
|
description: 'Highlight affected projects',
|
@@ -19,3 +19,57 @@ exports.yargsDepGraphCommand = {
|
|
19
19
|
.implies('head', 'affected'),
|
20
20
|
handler: async (args) => await (await Promise.resolve().then(() => require('./graph'))).generateGraph(args, []),
|
21
21
|
};
|
22
|
+
function withGraphOptions(yargs) {
|
23
|
+
return yargs
|
24
|
+
.option('file', {
|
25
|
+
describe: 'Output file (e.g. --file=output.json or --file=dep-graph.html).',
|
26
|
+
type: 'string',
|
27
|
+
})
|
28
|
+
.option('print', {
|
29
|
+
describe: 'Print the project graph to stdout in the terminal.',
|
30
|
+
type: 'boolean',
|
31
|
+
})
|
32
|
+
.option('view', {
|
33
|
+
describe: 'Choose whether to view the projects or task graph',
|
34
|
+
type: 'string',
|
35
|
+
default: 'projects',
|
36
|
+
choices: ['projects', 'tasks'],
|
37
|
+
})
|
38
|
+
.option('targets', {
|
39
|
+
describe: 'The target to show tasks for in the task graph',
|
40
|
+
type: 'string',
|
41
|
+
coerce: shared_options_1.parseCSV,
|
42
|
+
})
|
43
|
+
.option('focus', {
|
44
|
+
describe: 'Use to show the project graph for a particular project and every node that is either an ancestor or a descendant.',
|
45
|
+
type: 'string',
|
46
|
+
})
|
47
|
+
.option('exclude', {
|
48
|
+
describe: 'List of projects delimited by commas to exclude from the project graph.',
|
49
|
+
type: 'string',
|
50
|
+
coerce: shared_options_1.parseCSV,
|
51
|
+
})
|
52
|
+
.option('groupByFolder', {
|
53
|
+
describe: 'Group projects by folder in the project graph',
|
54
|
+
type: 'boolean',
|
55
|
+
})
|
56
|
+
.option('host', {
|
57
|
+
describe: 'Bind the project graph server to a specific ip address.',
|
58
|
+
type: 'string',
|
59
|
+
})
|
60
|
+
.option('port', {
|
61
|
+
describe: 'Bind the project graph server to a specific port.',
|
62
|
+
type: 'number',
|
63
|
+
})
|
64
|
+
.option('watch', {
|
65
|
+
describe: 'Watch for changes to project graph and update in-browser',
|
66
|
+
type: 'boolean',
|
67
|
+
default: true,
|
68
|
+
})
|
69
|
+
.option('open', {
|
70
|
+
describe: 'Open the project graph in the browser.',
|
71
|
+
type: 'boolean',
|
72
|
+
default: true,
|
73
|
+
});
|
74
|
+
}
|
75
|
+
exports.withGraphOptions = withGraphOptions;
|
@@ -206,7 +206,7 @@ async function generateGraph(args, affectedProjects) {
|
|
206
206
|
}
|
207
207
|
}
|
208
208
|
if (args.affected) {
|
209
|
-
affectedProjects = (await (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings:
|
209
|
+
affectedProjects = (await (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: args.file !== 'stdout' }, (0, configuration_1.readNxJson)()).nxArgs, rawGraph)).map((n) => n.name);
|
210
210
|
}
|
211
211
|
if (args.exclude) {
|
212
212
|
const invalidExcludes = [];
|
@@ -229,6 +229,7 @@ async function generateGraph(args, affectedProjects) {
|
|
229
229
|
// stdout is a magical constant that doesn't actually write a file
|
230
230
|
if (args.file === 'stdout') {
|
231
231
|
console.log(JSON.stringify(await createJsonOutput(prunedGraph, rawGraph, args.projects, args.targets), null, 2));
|
232
|
+
await output_1.output.drain();
|
232
233
|
process.exit(0);
|
233
234
|
}
|
234
235
|
const workspaceFolder = workspace_root_1.workspaceRoot;
|
@@ -182,7 +182,7 @@ async function addBundler(options) {
|
|
182
182
|
addViteCommandsToPackageScripts(options.reactAppName, options.isStandalone);
|
183
183
|
(0, write_vite_config_1.writeViteConfig)(options.reactAppName, options.isStandalone, options.appIsJs);
|
184
184
|
(0, write_vite_index_html_1.writeViteIndexHtml)(options.reactAppName, options.isStandalone, options.appIsJs);
|
185
|
-
(0, rename_js_to_jsx_1.renameJsToJsx)(options.reactAppName, options.isStandalone);
|
185
|
+
await (0, rename_js_to_jsx_1.renameJsToJsx)(options.reactAppName, options.isStandalone);
|
186
186
|
}
|
187
187
|
else {
|
188
188
|
output_1.output.log({ title: '🧑🔧 Setting up craco + Webpack' });
|
@@ -1 +1 @@
|
|
1
|
-
export declare function renameJsToJsx(appName: string, isStandalone: boolean): void
|
1
|
+
export declare function renameJsToJsx(appName: string, isStandalone: boolean): Promise<void>;
|
@@ -5,8 +5,8 @@ const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const workspace_context_1 = require("../../../../utils/workspace-context");
|
6
6
|
const fileutils_1 = require("../../../../utils/fileutils");
|
7
7
|
// Vite cannot process JSX like <div> or <Header> unless the file is named .jsx or .tsx
|
8
|
-
function renameJsToJsx(appName, isStandalone) {
|
9
|
-
const files = (0, workspace_context_1.globWithWorkspaceContext)(process.cwd(), [
|
8
|
+
async function renameJsToJsx(appName, isStandalone) {
|
9
|
+
const files = await (0, workspace_context_1.globWithWorkspaceContext)(process.cwd(), [
|
10
10
|
isStandalone ? 'src/**/*.js' : `apps/${appName}/src/**/*.js`,
|
11
11
|
]);
|
12
12
|
files.forEach((file) => {
|
@@ -122,7 +122,7 @@ const npmPackageToPluginMap = {
|
|
122
122
|
'@remix-run/dev': '@nx/remix',
|
123
123
|
};
|
124
124
|
async function detectPlugins() {
|
125
|
-
let files = ['package.json'].concat((0, workspace_context_1.globWithWorkspaceContext)(process.cwd(), ['**/*/package.json']));
|
125
|
+
let files = ['package.json'].concat(await (0, workspace_context_1.globWithWorkspaceContext)(process.cwd(), ['**/*/package.json']));
|
126
126
|
const detectedPlugins = new Set();
|
127
127
|
for (const file of files) {
|
128
128
|
if (!(0, fs_1.existsSync)(file))
|
@@ -49,7 +49,7 @@ exports.commandsObject = yargs
|
|
49
49
|
.command(command_objects_1.yargsAffectedGraphCommand)
|
50
50
|
.command(command_object_2.yargsConnectCommand)
|
51
51
|
.command(command_object_3.yargsDaemonCommand)
|
52
|
-
.command(command_object_4.
|
52
|
+
.command(command_object_4.yargsGraphCommand)
|
53
53
|
.command(command_object_5.yargsExecCommand)
|
54
54
|
.command(command_object_6.yargsFormatCheckCommand)
|
55
55
|
.command(command_object_6.yargsFormatWriteCommand)
|
@@ -61,27 +61,6 @@ export type OutputStyle = typeof allOutputStyles[number];
|
|
61
61
|
export declare function withOutputStyleOption(yargs: Argv, choices?: ReadonlyArray<OutputStyle>): Argv<{
|
62
62
|
"output-style": string;
|
63
63
|
}>;
|
64
|
-
export declare function withDepGraphOptions(yargs: Argv): Argv<{
|
65
|
-
file: string;
|
66
|
-
} & {
|
67
|
-
view: string;
|
68
|
-
} & {
|
69
|
-
targets: string;
|
70
|
-
} & {
|
71
|
-
focus: string;
|
72
|
-
} & {
|
73
|
-
exclude: string;
|
74
|
-
} & {
|
75
|
-
groupByFolder: boolean;
|
76
|
-
} & {
|
77
|
-
host: string;
|
78
|
-
} & {
|
79
|
-
port: number;
|
80
|
-
} & {
|
81
|
-
watch: boolean;
|
82
|
-
} & {
|
83
|
-
open: boolean;
|
84
|
-
}>;
|
85
64
|
export declare function withRunOneOptions(yargs: Argv): Argv<{
|
86
65
|
"output-style": string;
|
87
66
|
} & RunOptions & {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parseCSV = exports.withRunOneOptions = exports.
|
3
|
+
exports.parseCSV = exports.withRunOneOptions = exports.withOutputStyleOption = exports.withOverrides = exports.withRunManyOptions = exports.withAffectedOptions = exports.withBatch = exports.withVerbose = exports.withConfiguration = exports.withTargetAndConfigurationOption = exports.withRunOptions = exports.withExcludeOption = void 0;
|
4
4
|
function withExcludeOption(yargs) {
|
5
5
|
return yargs.option('exclude', {
|
6
6
|
describe: 'Exclude certain projects from being processed',
|
@@ -31,7 +31,7 @@ function withRunOptions(yargs) {
|
|
31
31
|
})
|
32
32
|
.option('graph', {
|
33
33
|
type: 'string',
|
34
|
-
describe: 'Show the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser.',
|
34
|
+
describe: 'Show the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser. Pass "stdout" to print the results to the terminal.',
|
35
35
|
coerce: (value) =>
|
36
36
|
// when the type of an opt is "string", passing `--opt` comes through as having an empty string value.
|
37
37
|
// this coercion allows `--graph` to be passed through as a boolean directly, and also normalizes the
|
@@ -216,56 +216,6 @@ function withOutputStyleOption(yargs, choices = [
|
|
216
216
|
});
|
217
217
|
}
|
218
218
|
exports.withOutputStyleOption = withOutputStyleOption;
|
219
|
-
function withDepGraphOptions(yargs) {
|
220
|
-
return yargs
|
221
|
-
.option('file', {
|
222
|
-
describe: 'Output file (e.g. --file=output.json or --file=dep-graph.html)',
|
223
|
-
type: 'string',
|
224
|
-
})
|
225
|
-
.option('view', {
|
226
|
-
describe: 'Choose whether to view the projects or task graph',
|
227
|
-
type: 'string',
|
228
|
-
default: 'projects',
|
229
|
-
choices: ['projects', 'tasks'],
|
230
|
-
})
|
231
|
-
.option('targets', {
|
232
|
-
describe: 'The target to show tasks for in the task graph',
|
233
|
-
type: 'string',
|
234
|
-
coerce: parseCSV,
|
235
|
-
})
|
236
|
-
.option('focus', {
|
237
|
-
describe: 'Use to show the project graph for a particular project and every node that is either an ancestor or a descendant.',
|
238
|
-
type: 'string',
|
239
|
-
})
|
240
|
-
.option('exclude', {
|
241
|
-
describe: 'List of projects delimited by commas to exclude from the project graph.',
|
242
|
-
type: 'string',
|
243
|
-
coerce: parseCSV,
|
244
|
-
})
|
245
|
-
.option('groupByFolder', {
|
246
|
-
describe: 'Group projects by folder in the project graph',
|
247
|
-
type: 'boolean',
|
248
|
-
})
|
249
|
-
.option('host', {
|
250
|
-
describe: 'Bind the project graph server to a specific ip address.',
|
251
|
-
type: 'string',
|
252
|
-
})
|
253
|
-
.option('port', {
|
254
|
-
describe: 'Bind the project graph server to a specific port.',
|
255
|
-
type: 'number',
|
256
|
-
})
|
257
|
-
.option('watch', {
|
258
|
-
describe: 'Watch for changes to project graph and update in-browser',
|
259
|
-
type: 'boolean',
|
260
|
-
default: true,
|
261
|
-
})
|
262
|
-
.option('open', {
|
263
|
-
describe: 'Open the project graph in the browser.',
|
264
|
-
type: 'boolean',
|
265
|
-
default: true,
|
266
|
-
});
|
267
|
-
}
|
268
|
-
exports.withDepGraphOptions = withDepGraphOptions;
|
269
219
|
function withRunOneOptions(yargs) {
|
270
220
|
const executorShouldShowHelp = !(process.argv[2] === 'run' && process.argv[3] === '--help');
|
271
221
|
const res = withRunOptions(withOutputStyleOption(withConfiguration(yargs), allOutputStyles))
|
@@ -5,6 +5,7 @@ import { FileData, ProjectGraph } from '../../config/project-graph';
|
|
5
5
|
import { Hash } from '../../hasher/task-hasher';
|
6
6
|
import { Task, TaskGraph } from '../../config/task-graph';
|
7
7
|
import { ConfigurationSourceMaps } from '../../project-graph/utils/project-configuration-utils';
|
8
|
+
import { NxWorkspaceFiles } from '../../native';
|
8
9
|
export type UnregisterCallback = () => void;
|
9
10
|
export type ChangedFile = {
|
10
11
|
path: string;
|
@@ -45,6 +46,11 @@ export declare class DaemonClient {
|
|
45
46
|
processInBackground(requirePath: string, data: any): Promise<any>;
|
46
47
|
recordOutputsHash(outputs: string[], hash: string): Promise<any>;
|
47
48
|
outputsHashesMatch(outputs: string[], hash: string): Promise<any>;
|
49
|
+
glob(globs: string[], exclude?: string[]): Promise<string[]>;
|
50
|
+
getWorkspaceContextFileData(): Promise<FileData[]>;
|
51
|
+
getWorkspaceFiles(projectRootMap: Record<string, string>): Promise<NxWorkspaceFiles>;
|
52
|
+
getFilesInDirectory(dir: string): Promise<string[]>;
|
53
|
+
hashGlob(globs: string[], exclude?: string[]): Promise<string>;
|
48
54
|
isServerAvailable(): Promise<boolean>;
|
49
55
|
private sendToDaemonViaQueue;
|
50
56
|
private setUpConnection;
|
@@ -20,6 +20,10 @@ 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
22
|
const dotenv_1 = require("../../utils/dotenv");
|
23
|
+
const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
|
24
|
+
const get_context_file_data_1 = require("../message-types/get-context-file-data");
|
25
|
+
const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
|
26
|
+
const hash_glob_1 = require("../message-types/hash-glob");
|
23
27
|
const DAEMON_ENV_SETTINGS = {
|
24
28
|
NX_PROJECT_GLOB_CACHE: 'false',
|
25
29
|
NX_CACHE_PROJECTS_CONFIG: 'false',
|
@@ -183,6 +187,42 @@ class DaemonClient {
|
|
183
187
|
},
|
184
188
|
});
|
185
189
|
}
|
190
|
+
glob(globs, exclude) {
|
191
|
+
const message = {
|
192
|
+
type: 'GLOB',
|
193
|
+
globs,
|
194
|
+
exclude,
|
195
|
+
};
|
196
|
+
return this.sendToDaemonViaQueue(message);
|
197
|
+
}
|
198
|
+
getWorkspaceContextFileData() {
|
199
|
+
const message = {
|
200
|
+
type: get_context_file_data_1.GET_CONTEXT_FILE_DATA,
|
201
|
+
};
|
202
|
+
return this.sendToDaemonViaQueue(message);
|
203
|
+
}
|
204
|
+
getWorkspaceFiles(projectRootMap) {
|
205
|
+
const message = {
|
206
|
+
type: get_nx_workspace_files_1.GET_NX_WORKSPACE_FILES,
|
207
|
+
projectRootMap,
|
208
|
+
};
|
209
|
+
return this.sendToDaemonViaQueue(message);
|
210
|
+
}
|
211
|
+
getFilesInDirectory(dir) {
|
212
|
+
const message = {
|
213
|
+
type: get_files_in_directory_1.GET_FILES_IN_DIRECTORY,
|
214
|
+
dir,
|
215
|
+
};
|
216
|
+
return this.sendToDaemonViaQueue(message);
|
217
|
+
}
|
218
|
+
hashGlob(globs, exclude) {
|
219
|
+
const message = {
|
220
|
+
type: hash_glob_1.HASH_GLOB,
|
221
|
+
globs,
|
222
|
+
exclude,
|
223
|
+
};
|
224
|
+
return this.sendToDaemonViaQueue(message);
|
225
|
+
}
|
186
226
|
async isServerAvailable() {
|
187
227
|
return new Promise((resolve) => {
|
188
228
|
try {
|
@@ -302,13 +342,16 @@ class DaemonClient {
|
|
302
342
|
(0, fs_extra_1.ensureFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE);
|
303
343
|
this._out = await (0, promises_1.open)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
|
304
344
|
this._err = await (0, promises_1.open)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
|
305
|
-
const backgroundProcess = (0, child_process_1.spawn)(process.execPath, [(0, path_1.join)(__dirname,
|
345
|
+
const backgroundProcess = (0, child_process_1.spawn)(process.execPath, [(0, path_1.join)(__dirname, `../server/start.js`)], {
|
306
346
|
cwd: workspace_root_1.workspaceRoot,
|
307
347
|
stdio: ['ignore', this._out.fd, this._err.fd],
|
308
348
|
detached: true,
|
309
349
|
windowsHide: true,
|
310
350
|
shell: false,
|
311
|
-
env: {
|
351
|
+
env: {
|
352
|
+
...process.env,
|
353
|
+
...DAEMON_ENV_SETTINGS,
|
354
|
+
},
|
312
355
|
});
|
313
356
|
backgroundProcess.unref();
|
314
357
|
/**
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isOnDaemon(): boolean;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export declare const GET_CONTEXT_FILE_DATA: "GET_CONTEXT_FILE_DATA";
|
2
|
+
export type HandleContextFileDataMessage = {
|
3
|
+
type: typeof GET_CONTEXT_FILE_DATA;
|
4
|
+
};
|
5
|
+
export declare function isHandleContextFileDataMessage(message: unknown): message is HandleContextFileDataMessage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isHandleContextFileDataMessage = exports.GET_CONTEXT_FILE_DATA = void 0;
|
4
|
+
exports.GET_CONTEXT_FILE_DATA = 'GET_CONTEXT_FILE_DATA';
|
5
|
+
function isHandleContextFileDataMessage(message) {
|
6
|
+
return (typeof message === 'object' &&
|
7
|
+
message !== null &&
|
8
|
+
'type' in message &&
|
9
|
+
message['type'] === exports.GET_CONTEXT_FILE_DATA);
|
10
|
+
}
|
11
|
+
exports.isHandleContextFileDataMessage = isHandleContextFileDataMessage;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export declare const GET_FILES_IN_DIRECTORY: "GET_FILES_IN_DIRECTORY";
|
2
|
+
export type HandleGetFilesInDirectoryMessage = {
|
3
|
+
type: typeof GET_FILES_IN_DIRECTORY;
|
4
|
+
dir: string;
|
5
|
+
};
|
6
|
+
export declare function isHandleGetFilesInDirectoryMessage(message: unknown): message is HandleGetFilesInDirectoryMessage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isHandleGetFilesInDirectoryMessage = exports.GET_FILES_IN_DIRECTORY = void 0;
|
4
|
+
exports.GET_FILES_IN_DIRECTORY = 'GET_FILES_IN_DIRECTORY';
|
5
|
+
function isHandleGetFilesInDirectoryMessage(message) {
|
6
|
+
return (typeof message === 'object' &&
|
7
|
+
message !== null &&
|
8
|
+
'type' in message &&
|
9
|
+
message['type'] === exports.GET_FILES_IN_DIRECTORY);
|
10
|
+
}
|
11
|
+
exports.isHandleGetFilesInDirectoryMessage = isHandleGetFilesInDirectoryMessage;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export declare const GET_NX_WORKSPACE_FILES: "GET_NX_WORKSPACE_FILES";
|
2
|
+
export type HandleNxWorkspaceFilesMessage = {
|
3
|
+
type: typeof GET_NX_WORKSPACE_FILES;
|
4
|
+
projectRootMap: Record<string, string>;
|
5
|
+
};
|
6
|
+
export declare function isHandleNxWorkspaceFilesMessage(message: unknown): message is HandleNxWorkspaceFilesMessage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isHandleNxWorkspaceFilesMessage = exports.GET_NX_WORKSPACE_FILES = void 0;
|
4
|
+
exports.GET_NX_WORKSPACE_FILES = 'GET_NX_WORKSPACE_FILES';
|
5
|
+
function isHandleNxWorkspaceFilesMessage(message) {
|
6
|
+
return (typeof message === 'object' &&
|
7
|
+
message !== null &&
|
8
|
+
'type' in message &&
|
9
|
+
message['type'] === exports.GET_NX_WORKSPACE_FILES);
|
10
|
+
}
|
11
|
+
exports.isHandleNxWorkspaceFilesMessage = isHandleNxWorkspaceFilesMessage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isHandleGlobMessage = exports.GLOB = void 0;
|
4
|
+
exports.GLOB = 'GLOB';
|
5
|
+
function isHandleGlobMessage(message) {
|
6
|
+
return (typeof message === 'object' &&
|
7
|
+
message !== null &&
|
8
|
+
'type' in message &&
|
9
|
+
message['type'] === exports.GLOB);
|
10
|
+
}
|
11
|
+
exports.isHandleGlobMessage = isHandleGlobMessage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isHandleHashGlobMessage = exports.HASH_GLOB = void 0;
|
4
|
+
exports.HASH_GLOB = 'HASH_GLOB';
|
5
|
+
function isHandleHashGlobMessage(message) {
|
6
|
+
return (typeof message === 'object' &&
|
7
|
+
message !== null &&
|
8
|
+
'type' in message &&
|
9
|
+
message['type'] === exports.HASH_GLOB);
|
10
|
+
}
|
11
|
+
exports.isHandleHashGlobMessage = isHandleHashGlobMessage;
|