nx 22.1.0-rc.4 → 22.1.0

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.
@@ -401,20 +401,20 @@ async function startServer() {
401
401
  if (!socket_utils_1.isWindows) {
402
402
  (0, socket_utils_1.killSocketOrPath)();
403
403
  }
404
+ setInterval(() => {
405
+ if ((0, cache_1.getDaemonProcessIdSync)() !== process.pid) {
406
+ return (0, shutdown_utils_1.handleServerProcessTermination)({
407
+ server,
408
+ reason: 'this process is no longer the current daemon (native)',
409
+ sockets: exports.openSockets,
410
+ });
411
+ }
412
+ }, 20).unref();
404
413
  return new Promise(async (resolve, reject) => {
405
414
  try {
406
415
  server.listen((0, socket_utils_1.getFullOsSocketPath)(), async () => {
407
416
  try {
408
417
  logger_1.serverLogger.log(`Started listening on: ${(0, socket_utils_1.getFullOsSocketPath)()}`);
409
- setInterval(() => {
410
- if ((0, cache_1.getDaemonProcessIdSync)() !== process.pid) {
411
- return (0, shutdown_utils_1.handleServerProcessTermination)({
412
- server,
413
- reason: 'this process is no longer the current daemon (native)',
414
- sockets: exports.openSockets,
415
- });
416
- }
417
- }, 20).unref();
418
418
  // this triggers the storage of the lock file hash
419
419
  daemonIsOutdated();
420
420
  if (!(0, shutdown_utils_1.getWatcherInstance)()) {
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": 2,
3
- "title": "Noop",
4
- "description": "An executor that does nothing.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "properties": {},
9
- "additionalProperties": true
2
+ "version": 2,
3
+ "title": "Noop",
4
+ "description": "An executor that does nothing.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "properties": {},
9
+ "additionalProperties": true
10
10
  }
@@ -1,198 +1,198 @@
1
1
  {
2
- "version": 2,
3
- "title": "Run Commands",
4
- "description": "Run any custom commands with Nx.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "presets": [
9
- {
10
- "name": "Arguments forwarding",
11
- "keys": ["commands"]
12
- },
13
- {
14
- "name": "Custom done conditions",
15
- "keys": ["commands", "readyWhen"]
16
- },
17
- {
18
- "name": "Setting the cwd",
19
- "keys": ["commands", "cwd"]
20
- }
21
- ],
22
- "properties": {
23
- "commands": {
24
- "type": "array",
25
- "description": "Commands to run in child process.",
26
- "items": {
27
- "oneOf": [
28
- {
29
- "type": "object",
30
- "properties": {
31
- "command": {
32
- "type": "string",
33
- "description": "Command to run in child process."
34
- },
35
- "forwardAllArgs": {
36
- "type": "boolean",
37
- "description": "Whether arguments should be forwarded when interpolation is not present."
38
- },
39
- "prefix": {
40
- "type": "string",
41
- "description": "Prefix in front of every line out of the output"
42
- },
43
- "prefixColor": {
44
- "type": "string",
45
- "description": "Color of the prefix",
46
- "enum": [
47
- "black",
48
- "red",
49
- "green",
50
- "yellow",
51
- "blue",
52
- "magenta",
53
- "cyan",
54
- "white"
55
- ]
56
- },
57
- "color": {
58
- "type": "string",
59
- "description": "Color of the output",
60
- "enum": [
61
- "black",
62
- "red",
63
- "green",
64
- "yellow",
65
- "blue",
66
- "magenta",
67
- "cyan",
68
- "white"
69
- ]
70
- },
71
- "bgColor": {
72
- "type": "string",
73
- "description": "Background color of the output",
74
- "enum": [
75
- "bgBlack",
76
- "bgRed",
77
- "bgGreen",
78
- "bgYellow",
79
- "bgBlue",
80
- "bgMagenta",
81
- "bgCyan",
82
- "bgWhite"
83
- ]
84
- },
85
- "description": {
86
- "type": "string",
87
- "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command."
88
- }
89
- },
90
- "additionalProperties": false,
91
- "required": ["command"]
92
- },
93
- {
94
- "type": "string"
95
- }
96
- ]
97
- },
98
- "x-priority": "important"
99
- },
100
- "command": {
101
- "oneOf": [
102
- {
103
- "type": "array",
104
- "description": "Command to run in child process, but divided into parts.",
105
- "items": {
106
- "type": "string"
107
- },
108
- "x-priority": "important"
109
- },
110
- {
111
- "type": "string",
112
- "description": "Command to run in child process."
113
- }
114
- ],
115
- "type": "string",
116
- "description": "Command to run in child process.",
117
- "x-priority": "important"
118
- },
119
- "parallel": {
120
- "type": "boolean",
121
- "description": "Run commands in parallel.",
122
- "default": true,
123
- "x-priority": "important"
124
- },
125
- "readyWhen": {
126
- "description": "String or array of strings to appear in `stdout` or `stderr` that indicate that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete.",
127
- "oneOf": [
128
- { "type": "string" },
129
- { "type": "array", "items": { "type": "string" } }
130
- ]
131
- },
132
- "args": {
133
- "oneOf": [
134
- {
135
- "type": "array",
136
- "items": {
137
- "type": "string"
138
- }
139
- },
140
- {
141
- "type": "string"
142
- }
143
- ],
144
- "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)"
145
- },
146
- "envFile": {
147
- "type": "string",
148
- "description": "You may specify a custom .env file path."
149
- },
150
- "color": {
151
- "type": "boolean",
152
- "description": "Use colors when showing output of command.",
153
- "default": false
154
- },
155
- "cwd": {
156
- "type": "string",
157
- "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path."
158
- },
159
- "env": {
2
+ "version": 2,
3
+ "title": "Run Commands",
4
+ "description": "Run any custom commands with Nx.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "presets": [
9
+ {
10
+ "name": "Arguments forwarding",
11
+ "keys": ["commands"]
12
+ },
13
+ {
14
+ "name": "Custom done conditions",
15
+ "keys": ["commands", "readyWhen"]
16
+ },
17
+ {
18
+ "name": "Setting the cwd",
19
+ "keys": ["commands", "cwd"]
20
+ }
21
+ ],
22
+ "properties": {
23
+ "commands": {
24
+ "type": "array",
25
+ "description": "Commands to run in child process.",
26
+ "items": {
27
+ "oneOf": [
28
+ {
160
29
  "type": "object",
161
- "description": "Environment variables that will be made available to the commands. This property has priority over the `.env` files.",
162
- "additionalProperties": {
163
- "type": "string"
164
- }
165
- },
166
- "__unparsed__": {
167
- "hidden": true,
168
- "type": "array",
169
- "items": {
170
- "type": "string"
171
- },
172
- "$default": {
173
- "$source": "unparsed"
30
+ "properties": {
31
+ "command": {
32
+ "type": "string",
33
+ "description": "Command to run in child process."
34
+ },
35
+ "forwardAllArgs": {
36
+ "type": "boolean",
37
+ "description": "Whether arguments should be forwarded when interpolation is not present."
38
+ },
39
+ "prefix": {
40
+ "type": "string",
41
+ "description": "Prefix in front of every line out of the output"
42
+ },
43
+ "prefixColor": {
44
+ "type": "string",
45
+ "description": "Color of the prefix",
46
+ "enum": [
47
+ "black",
48
+ "red",
49
+ "green",
50
+ "yellow",
51
+ "blue",
52
+ "magenta",
53
+ "cyan",
54
+ "white"
55
+ ]
56
+ },
57
+ "color": {
58
+ "type": "string",
59
+ "description": "Color of the output",
60
+ "enum": [
61
+ "black",
62
+ "red",
63
+ "green",
64
+ "yellow",
65
+ "blue",
66
+ "magenta",
67
+ "cyan",
68
+ "white"
69
+ ]
70
+ },
71
+ "bgColor": {
72
+ "type": "string",
73
+ "description": "Background color of the output",
74
+ "enum": [
75
+ "bgBlack",
76
+ "bgRed",
77
+ "bgGreen",
78
+ "bgYellow",
79
+ "bgBlue",
80
+ "bgMagenta",
81
+ "bgCyan",
82
+ "bgWhite"
83
+ ]
84
+ },
85
+ "description": {
86
+ "type": "string",
87
+ "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command."
88
+ }
174
89
  },
175
- "x-priority": "internal"
176
- },
177
- "forwardAllArgs": {
178
- "type": "boolean",
179
- "description": "Whether arguments should be forwarded when interpolation is not present.",
180
- "default": true
90
+ "additionalProperties": false,
91
+ "required": ["command"]
92
+ },
93
+ {
94
+ "type": "string"
95
+ }
96
+ ]
97
+ },
98
+ "x-priority": "important"
99
+ },
100
+ "command": {
101
+ "oneOf": [
102
+ {
103
+ "type": "array",
104
+ "description": "Command to run in child process, but divided into parts.",
105
+ "items": {
106
+ "type": "string"
107
+ },
108
+ "x-priority": "important"
181
109
  },
182
- "tty": {
183
- "type": "boolean",
184
- "description": "Whether commands should be run with a tty terminal",
185
- "hidden": true
110
+ {
111
+ "type": "string",
112
+ "description": "Command to run in child process."
186
113
  }
114
+ ],
115
+ "type": "string",
116
+ "description": "Command to run in child process.",
117
+ "x-priority": "important"
118
+ },
119
+ "parallel": {
120
+ "type": "boolean",
121
+ "description": "Run commands in parallel.",
122
+ "default": true,
123
+ "x-priority": "important"
124
+ },
125
+ "readyWhen": {
126
+ "description": "String or array of strings to appear in `stdout` or `stderr` that indicate that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete.",
127
+ "oneOf": [
128
+ { "type": "string" },
129
+ { "type": "array", "items": { "type": "string" } }
130
+ ]
187
131
  },
188
- "additionalProperties": true,
189
- "oneOf": [
132
+ "args": {
133
+ "oneOf": [
190
134
  {
191
- "required": ["commands"]
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ }
192
139
  },
193
140
  {
194
- "required": ["command"]
141
+ "type": "string"
195
142
  }
196
- ],
197
- "examplesFile": "../../../docs/run-commands-examples.md"
143
+ ],
144
+ "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)"
145
+ },
146
+ "envFile": {
147
+ "type": "string",
148
+ "description": "You may specify a custom .env file path."
149
+ },
150
+ "color": {
151
+ "type": "boolean",
152
+ "description": "Use colors when showing output of command.",
153
+ "default": false
154
+ },
155
+ "cwd": {
156
+ "type": "string",
157
+ "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path."
158
+ },
159
+ "env": {
160
+ "type": "object",
161
+ "description": "Environment variables that will be made available to the commands. This property has priority over the `.env` files.",
162
+ "additionalProperties": {
163
+ "type": "string"
164
+ }
165
+ },
166
+ "__unparsed__": {
167
+ "hidden": true,
168
+ "type": "array",
169
+ "items": {
170
+ "type": "string"
171
+ },
172
+ "$default": {
173
+ "$source": "unparsed"
174
+ },
175
+ "x-priority": "internal"
176
+ },
177
+ "forwardAllArgs": {
178
+ "type": "boolean",
179
+ "description": "Whether arguments should be forwarded when interpolation is not present.",
180
+ "default": true
181
+ },
182
+ "tty": {
183
+ "type": "boolean",
184
+ "description": "Whether commands should be run with a tty terminal",
185
+ "hidden": true
186
+ }
187
+ },
188
+ "additionalProperties": true,
189
+ "oneOf": [
190
+ {
191
+ "required": ["commands"]
192
+ },
193
+ {
194
+ "required": ["command"]
195
+ }
196
+ ],
197
+ "examplesFile": "../../../docs/run-commands-examples.md"
198
198
  }
@@ -1,28 +1,28 @@
1
1
  {
2
- "version": 2,
3
- "title": "Run Script",
4
- "description": "Run any NPM script of a project in the project's root directory.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "properties": {
9
- "script": {
10
- "type": "string",
11
- "description": "An npm script name in the `package.json` file of the project (e.g., `build`)."
12
- },
13
- "__unparsed__": {
14
- "hidden": true,
15
- "type": "array",
16
- "items": {
17
- "type": "string"
18
- },
19
- "$default": {
20
- "$source": "unparsed"
21
- },
22
- "x-priority": "internal"
23
- }
2
+ "version": 2,
3
+ "title": "Run Script",
4
+ "description": "Run any NPM script of a project in the project's root directory.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "properties": {
9
+ "script": {
10
+ "type": "string",
11
+ "description": "An npm script name in the `package.json` file of the project (e.g., `build`)."
24
12
  },
25
- "additionalProperties": true,
26
- "required": ["script"],
27
- "examplesFile": "../../../docs/run-script-examples.md"
13
+ "__unparsed__": {
14
+ "hidden": true,
15
+ "type": "array",
16
+ "items": {
17
+ "type": "string"
18
+ },
19
+ "$default": {
20
+ "$source": "unparsed"
21
+ },
22
+ "x-priority": "internal"
23
+ }
24
+ },
25
+ "additionalProperties": true,
26
+ "required": ["script"],
27
+ "examplesFile": "../../../docs/run-script-examples.md"
28
28
  }
@@ -75,7 +75,7 @@ class InProcessTaskHasher {
75
75
  exports.InProcessTaskHasher = InProcessTaskHasher;
76
76
  const DEFAULT_INPUTS = [
77
77
  {
78
- fileset: '{projectRoot}/**/*',
78
+ input: 'default',
79
79
  },
80
80
  {
81
81
  dependencies: true,
@@ -285,6 +285,7 @@ export declare const enum GroupType {
285
285
  MainCLI = 'MainCLI',
286
286
  MainCliSubprocesses = 'MainCliSubprocesses',
287
287
  Daemon = 'Daemon',
288
+ DaemonSubprocesses = 'DaemonSubprocesses',
288
289
  Task = 'Task',
289
290
  Batch = 'Batch'
290
291
  }
Binary file
@@ -1,41 +1,41 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
3
- "id": "NxCloudInit",
4
- "title": "Add Nx Cloud Configuration to the workspace",
5
- "description": "Connect a workspace to Nx Cloud.",
6
- "type": "object",
7
- "cli": "nx",
8
- "properties": {
9
- "analytics": {
10
- "type": "boolean",
11
- "description": "Anonymously store hashed machine ID for task runs",
12
- "default": false
13
- },
14
- "installationSource": {
15
- "type": "string",
16
- "description": "Name of Nx Cloud installation invoker (ex. user, add-nx-to-monorepo, create-nx-workspace, nx-upgrade",
17
- "default": "user"
18
- },
19
- "hideFormatLogs": {
20
- "type": "boolean",
21
- "description": "Hide formatting logs",
22
- "x-priority": "internal"
23
- },
24
- "generateToken": {
25
- "type": "boolean",
26
- "description": "Explicitly asks for a token to be created, do not override existing tokens from Nx Cloud"
27
- },
28
- "github": {
29
- "type": "boolean",
30
- "description": "If the user will be using GitHub as their git hosting provider",
31
- "default": false
32
- },
33
- "directory": {
34
- "type": "string",
35
- "description": "The directory where the workspace is located",
36
- "x-priority": "internal"
37
- }
2
+ "$schema": "https://json-schema.org/schema",
3
+ "id": "NxCloudInit",
4
+ "title": "Add Nx Cloud Configuration to the workspace",
5
+ "description": "Connect a workspace to Nx Cloud.",
6
+ "type": "object",
7
+ "cli": "nx",
8
+ "properties": {
9
+ "analytics": {
10
+ "type": "boolean",
11
+ "description": "Anonymously store hashed machine ID for task runs",
12
+ "default": false
38
13
  },
39
- "additionalProperties": false,
40
- "required": []
14
+ "installationSource": {
15
+ "type": "string",
16
+ "description": "Name of Nx Cloud installation invoker (ex. user, add-nx-to-monorepo, create-nx-workspace, nx-upgrade",
17
+ "default": "user"
18
+ },
19
+ "hideFormatLogs": {
20
+ "type": "boolean",
21
+ "description": "Hide formatting logs",
22
+ "x-priority": "internal"
23
+ },
24
+ "generateToken": {
25
+ "type": "boolean",
26
+ "description": "Explicitly asks for a token to be created, do not override existing tokens from Nx Cloud"
27
+ },
28
+ "github": {
29
+ "type": "boolean",
30
+ "description": "If the user will be using GitHub as their git hosting provider",
31
+ "default": false
32
+ },
33
+ "directory": {
34
+ "type": "string",
35
+ "description": "The directory where the workspace is located",
36
+ "x-priority": "internal"
37
+ }
38
+ },
39
+ "additionalProperties": false,
40
+ "required": []
41
41
  }
@@ -0,0 +1,2 @@
1
+ export declare function getEnvPathsForTask(projectRoot: string, target: string, configuration?: string, nonAtomizedTarget?: string): string[];
2
+ //# sourceMappingURL=task-env-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-env-paths.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/task-env-paths.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,EACtB,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,EAAE,CA6BV"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnvPathsForTask = getEnvPathsForTask;
4
+ function getEnvPathsForTask(projectRoot, target, configuration, nonAtomizedTarget) {
5
+ const identifiers = [];
6
+ // Configuration-specific identifier (like build.development, build.production)
7
+ if (configuration) {
8
+ identifiers.push(`${target}.${configuration}`);
9
+ if (nonAtomizedTarget) {
10
+ identifiers.push(`${nonAtomizedTarget}.${configuration}`);
11
+ }
12
+ identifiers.push(configuration);
13
+ }
14
+ // Non-configuration-specific identifier (like build, test, serve)
15
+ identifiers.push(target);
16
+ if (nonAtomizedTarget) {
17
+ identifiers.push(nonAtomizedTarget);
18
+ }
19
+ // Non-deterministic identifier (for files like .env.local, .local.env, .env)
20
+ identifiers.push('');
21
+ const envPaths = [];
22
+ // Add DotEnv Files in the project root folder
23
+ for (const identifier of identifiers) {
24
+ envPaths.push(...getEnvFileVariants(identifier, projectRoot));
25
+ }
26
+ // Add DotEnv Files in the workspace root folder
27
+ for (const identifier of identifiers) {
28
+ envPaths.push(...getEnvFileVariants(identifier));
29
+ }
30
+ return envPaths;
31
+ }
32
+ function getEnvFileVariants(identifier, root) {
33
+ const path = root ? root + '/' : '';
34
+ if (identifier) {
35
+ return [
36
+ `${path}.env.${identifier}.local`,
37
+ `${path}.env.${identifier}`,
38
+ `${path}.${identifier}.local.env`,
39
+ `${path}.${identifier}.env`,
40
+ ];
41
+ }
42
+ else {
43
+ return [`${path}.env.local`, `${path}.local.env`, `${path}.env`];
44
+ }
45
+ }
@@ -1,6 +1,7 @@
1
1
  import { Task } from '../config/task-graph';
2
+ import { ProjectGraph } from '../config/project-graph';
2
3
  export declare function getEnvVariablesForBatchProcess(skipNxCache: boolean, captureStderr: boolean): NodeJS.ProcessEnv;
3
- export declare function getTaskSpecificEnv(task: Task): NodeJS.ProcessEnv;
4
+ export declare function getTaskSpecificEnv(task: Task, graph: ProjectGraph): NodeJS.ProcessEnv;
4
5
  export declare function getEnvVariablesForTask(task: Task, taskSpecificEnv: NodeJS.ProcessEnv, forceColor: string, skipNxCache: boolean, captureStderr: boolean, outputPath: string, streamOutput: boolean): NodeJS.ProcessEnv;
5
6
  /**
6
7
  * This function loads a .env file and expands the variables in it.
@@ -15,4 +16,5 @@ export declare function loadAndExpandDotEnvFile(filename: string, environmentVar
15
16
  * @param environmentVariables
16
17
  */
17
18
  export declare function unloadDotEnvFile(filename: string, environmentVariables: NodeJS.ProcessEnv, override?: boolean): void;
19
+ export declare function getEnvFilesForTask(task: Task, graph: ProjectGraph): string[];
18
20
  //# sourceMappingURL=task-env.d.ts.map