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.
- package/executors.json +16 -16
- package/generators.json +13 -13
- package/migrations.json +143 -143
- package/package.json +14 -11
- package/presets/npm.json +4 -4
- package/schemas/nx-schema.json +1285 -1285
- package/schemas/project-schema.json +359 -359
- package/schemas/workspace-schema.json +165 -165
- package/src/ai/set-up-ai-agents/schema.json +31 -31
- package/src/command-line/release/utils/shared.d.ts.map +1 -1
- package/src/command-line/release/utils/shared.js +5 -5
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/server.js +9 -9
- package/src/executors/noop/schema.json +8 -8
- package/src/executors/run-commands/schema.json +187 -187
- package/src/executors/run-script/schema.json +25 -25
- package/src/hasher/task-hasher.js +1 -1
- package/src/native/index.d.ts +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
- package/src/tasks-runner/task-env-paths.d.ts +2 -0
- package/src/tasks-runner/task-env-paths.d.ts.map +1 -0
- package/src/tasks-runner/task-env-paths.js +45 -0
- package/src/tasks-runner/task-env.d.ts +3 -1
- package/src/tasks-runner/task-env.d.ts.map +1 -1
- package/src/tasks-runner/task-env.js +27 -51
- package/src/tasks-runner/task-orchestrator.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-env.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/task-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"task-env.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/task-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAK5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,GACrB,MAAM,CAAC,UAAU,CAWnB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,qBAOjE;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,CAAC,UAAU,EAClC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GACpB,MAAM,CAAC,UAAU,CAwBnB;AA+DD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,CAAC,UAAU,EACvC,QAAQ,UAAQ,8CAWjB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,CAAC,UAAU,EACvC,QAAQ,UAAQ,QASjB;AAwBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAS5E"}
|
|
@@ -5,10 +5,12 @@ exports.getTaskSpecificEnv = getTaskSpecificEnv;
|
|
|
5
5
|
exports.getEnvVariablesForTask = getEnvVariablesForTask;
|
|
6
6
|
exports.loadAndExpandDotEnvFile = loadAndExpandDotEnvFile;
|
|
7
7
|
exports.unloadDotEnvFile = unloadDotEnvFile;
|
|
8
|
+
exports.getEnvFilesForTask = getEnvFilesForTask;
|
|
8
9
|
const dotenv_1 = require("dotenv");
|
|
9
10
|
const dotenv_expand_1 = require("dotenv-expand");
|
|
10
11
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
11
12
|
const node_path_1 = require("node:path");
|
|
13
|
+
const task_env_paths_1 = require("./task-env-paths");
|
|
12
14
|
function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
|
13
15
|
return {
|
|
14
16
|
// User Process Env Variables override Dotenv Variables
|
|
@@ -17,11 +19,11 @@ function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
|
|
17
19
|
...getNxEnvVariablesForForkedProcess(process.env.FORCE_COLOR === undefined ? 'true' : process.env.FORCE_COLOR, skipNxCache, captureStderr),
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
function getTaskSpecificEnv(task) {
|
|
22
|
+
function getTaskSpecificEnv(task, graph) {
|
|
21
23
|
// Unload any dot env files at the root of the workspace that were loaded on init of Nx.
|
|
22
24
|
const taskEnv = unloadDotEnvFiles({ ...process.env });
|
|
23
25
|
return process.env.NX_LOAD_DOT_ENV_FILES === 'true'
|
|
24
|
-
? loadDotEnvFilesForTask(task, taskEnv)
|
|
26
|
+
? loadDotEnvFilesForTask(task, graph, taskEnv)
|
|
25
27
|
: // If not loading dot env files, ensure env vars created by system are still loaded
|
|
26
28
|
taskEnv;
|
|
27
29
|
}
|
|
@@ -110,56 +112,30 @@ function unloadDotEnvFile(filename, environmentVariables, override = false) {
|
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`${task.projectRoot}/.env.local`,
|
|
135
|
-
`${task.projectRoot}/.local.env`,
|
|
136
|
-
`${task.projectRoot}/.env`,
|
|
137
|
-
// Load DotEnv Files for a configuration in the workspace root
|
|
138
|
-
...(task.target.configuration
|
|
139
|
-
? [
|
|
140
|
-
`.env.${task.target.target}.${task.target.configuration}.local`,
|
|
141
|
-
`.env.${task.target.target}.${task.target.configuration}`,
|
|
142
|
-
`.env.${task.target.configuration}.local`,
|
|
143
|
-
`.env.${task.target.configuration}`,
|
|
144
|
-
`.${task.target.target}.${task.target.configuration}.local.env`,
|
|
145
|
-
`.${task.target.target}.${task.target.configuration}.env`,
|
|
146
|
-
`.${task.target.configuration}.local.env`,
|
|
147
|
-
`.${task.target.configuration}.env`,
|
|
148
|
-
]
|
|
149
|
-
: []),
|
|
150
|
-
// Load DotEnv Files for a target in the workspace root
|
|
151
|
-
`.env.${task.target.target}.local`,
|
|
152
|
-
`.env.${task.target.target}`,
|
|
153
|
-
`.${task.target.target}.local.env`,
|
|
154
|
-
`.${task.target.target}.env`,
|
|
155
|
-
// Load base DotEnv Files at workspace root
|
|
156
|
-
`.local.env`,
|
|
157
|
-
`.env.local`,
|
|
158
|
-
`.env`,
|
|
159
|
-
];
|
|
115
|
+
function getOwnerTargetForTask(task, graph) {
|
|
116
|
+
const project = graph.nodes[task.target.project];
|
|
117
|
+
if (project.data.metadata?.targetGroups) {
|
|
118
|
+
for (const targets of Object.values(project.data.metadata.targetGroups)) {
|
|
119
|
+
if (targets.includes(task.target.target)) {
|
|
120
|
+
for (const target of targets) {
|
|
121
|
+
if (project.data.targets[target].metadata?.nonAtomizedTarget) {
|
|
122
|
+
return [
|
|
123
|
+
target,
|
|
124
|
+
project.data.targets[target].metadata?.nonAtomizedTarget,
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return [task.target.target];
|
|
132
|
+
}
|
|
133
|
+
function getEnvFilesForTask(task, graph) {
|
|
134
|
+
const [target, nonAtomizedTarget] = getOwnerTargetForTask(task, graph);
|
|
135
|
+
return (0, task_env_paths_1.getEnvPathsForTask)(task.projectRoot, target, task.target.configuration, nonAtomizedTarget);
|
|
160
136
|
}
|
|
161
|
-
function loadDotEnvFilesForTask(task, environmentVariables) {
|
|
162
|
-
const dotEnvFiles = getEnvFilesForTask(task);
|
|
137
|
+
function loadDotEnvFilesForTask(task, graph, environmentVariables) {
|
|
138
|
+
const dotEnvFiles = getEnvFilesForTask(task, graph);
|
|
163
139
|
for (const file of dotEnvFiles) {
|
|
164
140
|
loadAndExpandDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables);
|
|
165
141
|
}
|
|
@@ -146,7 +146,7 @@ class TaskOrchestrator {
|
|
|
146
146
|
// region Processing Scheduled Tasks
|
|
147
147
|
async processTask(taskId) {
|
|
148
148
|
const task = this.taskGraph.tasks[taskId];
|
|
149
|
-
const taskSpecificEnv = (0, task_env_1.getTaskSpecificEnv)(task);
|
|
149
|
+
const taskSpecificEnv = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
150
150
|
if (!task.hash) {
|
|
151
151
|
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.taskGraphForHashing, task, taskSpecificEnv, this.taskDetails);
|
|
152
152
|
}
|