nx 18.4.0-canary.20240418-e549ea2 → 19.0.0-beta.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/package.json +12 -12
- package/src/command-line/add/add.js +3 -1
- package/src/command-line/add/command-object.d.ts +1 -0
- package/src/command-line/add/command-object.js +6 -1
- package/src/core/graph/main.js +1 -1
- package/src/native/index.d.ts +1 -4
- package/src/native/index.js +5 -6
- package/src/native/native-bindings.js +111 -133
- package/src/native/transform-objects.js +1 -0
- package/src/tasks-runner/task-orchestrator.js +47 -29
- package/src/utils/params.js +20 -17
package/src/native/index.d.ts
CHANGED
@@ -29,11 +29,8 @@ export function findImports(projectFileMap: Record<string, Array<string>>): Arra
|
|
29
29
|
* This wont be needed once the project graph is created in Rust
|
30
30
|
*/
|
31
31
|
export function transferProjectGraph(projectGraph: ProjectGraph): ExternalObject<ProjectGraph>
|
32
|
-
export interface ExternalNodeData {
|
33
|
-
version: string
|
34
|
-
hash?: string
|
35
|
-
}
|
36
32
|
export interface ExternalNode {
|
33
|
+
packageName?: string
|
37
34
|
version: string
|
38
35
|
hash?: string
|
39
36
|
}
|
package/src/native/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
const { join,
|
1
|
+
const { join, basename } = require('path');
|
2
2
|
const { copyFileSync, existsSync, mkdirSync } = require('fs');
|
3
3
|
const Module = require('module');
|
4
|
-
const { nxVersion} = require(
|
5
|
-
const { cacheDir} = require(
|
4
|
+
const { nxVersion } = require('../utils/versions');
|
5
|
+
const { cacheDir } = require('../utils/cache-directory');
|
6
6
|
|
7
7
|
const nxPackages = new Set([
|
8
8
|
'@nx/nx-android-arm64',
|
@@ -40,7 +40,7 @@ const localNodeFiles = [
|
|
40
40
|
|
41
41
|
const originalLoad = Module._load;
|
42
42
|
|
43
|
-
// We override the _load function so that when a native file is required,
|
43
|
+
// We override the _load function so that when a native file is required,
|
44
44
|
// we copy it to a cache directory and require it from there.
|
45
45
|
// This prevents the file being loaded from node_modules and causing file locking issues.
|
46
46
|
// Will only be called once because the require cache takes over afterwards.
|
@@ -51,7 +51,7 @@ Module._load = function (request, parent, isMain) {
|
|
51
51
|
localNodeFiles.some((f) => modulePath.endsWith(f))
|
52
52
|
) {
|
53
53
|
const nativeLocation = require.resolve(modulePath);
|
54
|
-
const fileName = basename(nativeLocation)
|
54
|
+
const fileName = basename(nativeLocation);
|
55
55
|
// we copy the file to the cache directory (.nx/cache by default) and prefix with nxVersion to avoid stale files being loaded
|
56
56
|
const tmpFile = join(cacheDir, nxVersion + '-' + fileName);
|
57
57
|
if (existsSync(tmpFile)) {
|
@@ -72,6 +72,5 @@ const indexModulePath = require.resolve('./native-bindings.js');
|
|
72
72
|
delete require.cache[indexModulePath];
|
73
73
|
const indexModule = require('./native-bindings.js');
|
74
74
|
|
75
|
-
|
76
75
|
module.exports = indexModule;
|
77
76
|
Module._load = originalLoad;
|
@@ -1,27 +1,24 @@
|
|
1
|
-
const { existsSync, readFileSync } = require('fs')
|
2
|
-
const { join } = require('path')
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
2
|
+
const { join } = require('path')
|
3
3
|
|
4
|
-
const { platform, arch } = process
|
4
|
+
const { platform, arch } = process
|
5
5
|
|
6
|
-
let nativeBinding = null
|
7
|
-
let localFileExisted = false
|
8
|
-
let loadError = null
|
6
|
+
let nativeBinding = null
|
7
|
+
let localFileExisted = false
|
8
|
+
let loadError = null
|
9
9
|
|
10
10
|
function isMusl() {
|
11
11
|
// For Node 10
|
12
12
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
13
13
|
try {
|
14
|
-
const lddPath = require('child_process')
|
15
|
-
|
16
|
-
.toString()
|
17
|
-
.trim();
|
18
|
-
return readFileSync(lddPath, 'utf8').includes('musl');
|
14
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
|
15
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
19
16
|
} catch (e) {
|
20
|
-
return true
|
17
|
+
return true
|
21
18
|
}
|
22
19
|
} else {
|
23
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
24
|
-
return !glibcVersionRuntime
|
20
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
21
|
+
return !glibcVersionRuntime
|
25
22
|
}
|
26
23
|
}
|
27
24
|
|
@@ -29,262 +26,243 @@ switch (platform) {
|
|
29
26
|
case 'android':
|
30
27
|
switch (arch) {
|
31
28
|
case 'arm64':
|
32
|
-
localFileExisted = existsSync(join(__dirname, 'nx.android-arm64.node'))
|
29
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm64.node'))
|
33
30
|
try {
|
34
31
|
if (localFileExisted) {
|
35
|
-
nativeBinding = require('./nx.android-arm64.node')
|
32
|
+
nativeBinding = require('./nx.android-arm64.node')
|
36
33
|
} else {
|
37
|
-
nativeBinding = require('@nx/nx-android-arm64')
|
34
|
+
nativeBinding = require('@nx/nx-android-arm64')
|
38
35
|
}
|
39
36
|
} catch (e) {
|
40
|
-
loadError = e
|
37
|
+
loadError = e
|
41
38
|
}
|
42
|
-
break
|
39
|
+
break
|
43
40
|
case 'arm':
|
44
|
-
localFileExisted = existsSync(
|
45
|
-
join(__dirname, 'nx.android-arm-eabi.node')
|
46
|
-
);
|
41
|
+
localFileExisted = existsSync(join(__dirname, 'nx.android-arm-eabi.node'))
|
47
42
|
try {
|
48
43
|
if (localFileExisted) {
|
49
|
-
nativeBinding = require('./nx.android-arm-eabi.node')
|
44
|
+
nativeBinding = require('./nx.android-arm-eabi.node')
|
50
45
|
} else {
|
51
|
-
nativeBinding = require('@nx/nx-android-arm-eabi')
|
46
|
+
nativeBinding = require('@nx/nx-android-arm-eabi')
|
52
47
|
}
|
53
48
|
} catch (e) {
|
54
|
-
loadError = e
|
49
|
+
loadError = e
|
55
50
|
}
|
56
|
-
break
|
51
|
+
break
|
57
52
|
default:
|
58
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
53
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
59
54
|
}
|
60
|
-
break
|
55
|
+
break
|
61
56
|
case 'win32':
|
62
57
|
switch (arch) {
|
63
58
|
case 'x64':
|
64
59
|
localFileExisted = existsSync(
|
65
60
|
join(__dirname, 'nx.win32-x64-msvc.node')
|
66
|
-
)
|
61
|
+
)
|
67
62
|
try {
|
68
63
|
if (localFileExisted) {
|
69
|
-
nativeBinding = require('./nx.win32-x64-msvc.node')
|
64
|
+
nativeBinding = require('./nx.win32-x64-msvc.node')
|
70
65
|
} else {
|
71
|
-
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
66
|
+
nativeBinding = require('@nx/nx-win32-x64-msvc')
|
72
67
|
}
|
73
68
|
} catch (e) {
|
74
|
-
loadError = e
|
69
|
+
loadError = e
|
75
70
|
}
|
76
|
-
break
|
71
|
+
break
|
77
72
|
case 'ia32':
|
78
73
|
localFileExisted = existsSync(
|
79
74
|
join(__dirname, 'nx.win32-ia32-msvc.node')
|
80
|
-
)
|
75
|
+
)
|
81
76
|
try {
|
82
77
|
if (localFileExisted) {
|
83
|
-
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
78
|
+
nativeBinding = require('./nx.win32-ia32-msvc.node')
|
84
79
|
} else {
|
85
|
-
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
80
|
+
nativeBinding = require('@nx/nx-win32-ia32-msvc')
|
86
81
|
}
|
87
82
|
} catch (e) {
|
88
|
-
loadError = e
|
83
|
+
loadError = e
|
89
84
|
}
|
90
|
-
break
|
85
|
+
break
|
91
86
|
case 'arm64':
|
92
87
|
localFileExisted = existsSync(
|
93
88
|
join(__dirname, 'nx.win32-arm64-msvc.node')
|
94
|
-
)
|
89
|
+
)
|
95
90
|
try {
|
96
91
|
if (localFileExisted) {
|
97
|
-
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
92
|
+
nativeBinding = require('./nx.win32-arm64-msvc.node')
|
98
93
|
} else {
|
99
|
-
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
94
|
+
nativeBinding = require('@nx/nx-win32-arm64-msvc')
|
100
95
|
}
|
101
96
|
} catch (e) {
|
102
|
-
loadError = e
|
97
|
+
loadError = e
|
103
98
|
}
|
104
|
-
break
|
99
|
+
break
|
105
100
|
default:
|
106
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
101
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
107
102
|
}
|
108
|
-
break
|
103
|
+
break
|
109
104
|
case 'darwin':
|
110
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-universal.node'))
|
111
106
|
try {
|
112
107
|
if (localFileExisted) {
|
113
|
-
nativeBinding = require('./nx.darwin-universal.node')
|
108
|
+
nativeBinding = require('./nx.darwin-universal.node')
|
114
109
|
} else {
|
115
|
-
nativeBinding = require('@nx/nx-darwin-universal')
|
110
|
+
nativeBinding = require('@nx/nx-darwin-universal')
|
116
111
|
}
|
117
|
-
break
|
112
|
+
break
|
118
113
|
} catch {}
|
119
114
|
switch (arch) {
|
120
115
|
case 'x64':
|
121
|
-
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'nx.darwin-x64.node'))
|
122
117
|
try {
|
123
118
|
if (localFileExisted) {
|
124
|
-
nativeBinding = require('./nx.darwin-x64.node')
|
119
|
+
nativeBinding = require('./nx.darwin-x64.node')
|
125
120
|
} else {
|
126
|
-
nativeBinding = require('@nx/nx-darwin-x64')
|
121
|
+
nativeBinding = require('@nx/nx-darwin-x64')
|
127
122
|
}
|
128
123
|
} catch (e) {
|
129
|
-
loadError = e
|
124
|
+
loadError = e
|
130
125
|
}
|
131
|
-
break
|
126
|
+
break
|
132
127
|
case 'arm64':
|
133
|
-
localFileExisted = existsSync(
|
128
|
+
localFileExisted = existsSync(
|
129
|
+
join(__dirname, 'nx.darwin-arm64.node')
|
130
|
+
)
|
134
131
|
try {
|
135
132
|
if (localFileExisted) {
|
136
|
-
nativeBinding = require('./nx.darwin-arm64.node')
|
133
|
+
nativeBinding = require('./nx.darwin-arm64.node')
|
137
134
|
} else {
|
138
|
-
nativeBinding = require('@nx/nx-darwin-arm64')
|
135
|
+
nativeBinding = require('@nx/nx-darwin-arm64')
|
139
136
|
}
|
140
137
|
} catch (e) {
|
141
|
-
loadError = e
|
138
|
+
loadError = e
|
142
139
|
}
|
143
|
-
break
|
140
|
+
break
|
144
141
|
default:
|
145
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
142
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
146
143
|
}
|
147
|
-
break
|
144
|
+
break
|
148
145
|
case 'freebsd':
|
149
146
|
if (arch !== 'x64') {
|
150
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
147
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
151
148
|
}
|
152
|
-
localFileExisted = existsSync(join(__dirname, 'nx.freebsd-x64.node'))
|
149
|
+
localFileExisted = existsSync(join(__dirname, 'nx.freebsd-x64.node'))
|
153
150
|
try {
|
154
151
|
if (localFileExisted) {
|
155
|
-
nativeBinding = require('./nx.freebsd-x64.node')
|
152
|
+
nativeBinding = require('./nx.freebsd-x64.node')
|
156
153
|
} else {
|
157
|
-
nativeBinding = require('@nx/nx-freebsd-x64')
|
154
|
+
nativeBinding = require('@nx/nx-freebsd-x64')
|
158
155
|
}
|
159
156
|
} catch (e) {
|
160
|
-
loadError = e
|
157
|
+
loadError = e
|
161
158
|
}
|
162
|
-
break
|
159
|
+
break
|
163
160
|
case 'linux':
|
164
161
|
switch (arch) {
|
165
162
|
case 'x64':
|
166
163
|
if (isMusl()) {
|
167
164
|
localFileExisted = existsSync(
|
168
165
|
join(__dirname, 'nx.linux-x64-musl.node')
|
169
|
-
)
|
166
|
+
)
|
170
167
|
try {
|
171
168
|
if (localFileExisted) {
|
172
|
-
nativeBinding = require('./nx.linux-x64-musl.node')
|
169
|
+
nativeBinding = require('./nx.linux-x64-musl.node')
|
173
170
|
} else {
|
174
|
-
nativeBinding = require('@nx/nx-linux-x64-musl')
|
171
|
+
nativeBinding = require('@nx/nx-linux-x64-musl')
|
175
172
|
}
|
176
173
|
} catch (e) {
|
177
|
-
loadError = e
|
174
|
+
loadError = e
|
178
175
|
}
|
179
176
|
} else {
|
180
177
|
localFileExisted = existsSync(
|
181
178
|
join(__dirname, 'nx.linux-x64-gnu.node')
|
182
|
-
)
|
179
|
+
)
|
183
180
|
try {
|
184
181
|
if (localFileExisted) {
|
185
|
-
nativeBinding = require('./nx.linux-x64-gnu.node')
|
182
|
+
nativeBinding = require('./nx.linux-x64-gnu.node')
|
186
183
|
} else {
|
187
|
-
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
184
|
+
nativeBinding = require('@nx/nx-linux-x64-gnu')
|
188
185
|
}
|
189
186
|
} catch (e) {
|
190
|
-
loadError = e
|
187
|
+
loadError = e
|
191
188
|
}
|
192
189
|
}
|
193
|
-
break
|
190
|
+
break
|
194
191
|
case 'arm64':
|
195
192
|
if (isMusl()) {
|
196
193
|
localFileExisted = existsSync(
|
197
194
|
join(__dirname, 'nx.linux-arm64-musl.node')
|
198
|
-
)
|
195
|
+
)
|
199
196
|
try {
|
200
197
|
if (localFileExisted) {
|
201
|
-
nativeBinding = require('./nx.linux-arm64-musl.node')
|
198
|
+
nativeBinding = require('./nx.linux-arm64-musl.node')
|
202
199
|
} else {
|
203
|
-
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
200
|
+
nativeBinding = require('@nx/nx-linux-arm64-musl')
|
204
201
|
}
|
205
202
|
} catch (e) {
|
206
|
-
loadError = e
|
203
|
+
loadError = e
|
207
204
|
}
|
208
205
|
} else {
|
209
206
|
localFileExisted = existsSync(
|
210
207
|
join(__dirname, 'nx.linux-arm64-gnu.node')
|
211
|
-
)
|
208
|
+
)
|
212
209
|
try {
|
213
210
|
if (localFileExisted) {
|
214
|
-
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
211
|
+
nativeBinding = require('./nx.linux-arm64-gnu.node')
|
215
212
|
} else {
|
216
|
-
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
213
|
+
nativeBinding = require('@nx/nx-linux-arm64-gnu')
|
217
214
|
}
|
218
215
|
} catch (e) {
|
219
|
-
loadError = e
|
216
|
+
loadError = e
|
220
217
|
}
|
221
218
|
}
|
222
|
-
break
|
219
|
+
break
|
223
220
|
case 'arm':
|
224
221
|
localFileExisted = existsSync(
|
225
222
|
join(__dirname, 'nx.linux-arm-gnueabihf.node')
|
226
|
-
)
|
223
|
+
)
|
227
224
|
try {
|
228
225
|
if (localFileExisted) {
|
229
|
-
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
226
|
+
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
|
230
227
|
} else {
|
231
|
-
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
228
|
+
nativeBinding = require('@nx/nx-linux-arm-gnueabihf')
|
232
229
|
}
|
233
230
|
} catch (e) {
|
234
|
-
loadError = e
|
231
|
+
loadError = e
|
235
232
|
}
|
236
|
-
break
|
233
|
+
break
|
237
234
|
default:
|
238
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
235
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
239
236
|
}
|
240
|
-
break
|
237
|
+
break
|
241
238
|
default:
|
242
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
239
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
243
240
|
}
|
244
241
|
|
245
242
|
if (!nativeBinding) {
|
246
243
|
if (loadError) {
|
247
|
-
throw loadError
|
244
|
+
throw loadError
|
248
245
|
}
|
249
|
-
throw new Error(`Failed to load native binding`)
|
246
|
+
throw new Error(`Failed to load native binding`)
|
250
247
|
}
|
251
248
|
|
252
|
-
const {
|
253
|
-
expandOutputs,
|
254
|
-
getFilesForOutputs,
|
255
|
-
remove,
|
256
|
-
copy,
|
257
|
-
hashArray,
|
258
|
-
hashFile,
|
259
|
-
ImportResult,
|
260
|
-
findImports,
|
261
|
-
transferProjectGraph,
|
262
|
-
ChildProcess,
|
263
|
-
RustPseudoTerminal,
|
264
|
-
HashPlanner,
|
265
|
-
TaskHasher,
|
266
|
-
EventType,
|
267
|
-
Watcher,
|
268
|
-
WorkspaceContext,
|
269
|
-
WorkspaceErrors,
|
270
|
-
testOnlyTransferFileMap,
|
271
|
-
} = nativeBinding;
|
249
|
+
const { expandOutputs, getFilesForOutputs, remove, copy, hashArray, hashFile, ImportResult, findImports, transferProjectGraph, ChildProcess, RustPseudoTerminal, HashPlanner, TaskHasher, EventType, Watcher, WorkspaceContext, WorkspaceErrors, testOnlyTransferFileMap } = nativeBinding
|
272
250
|
|
273
|
-
module.exports.expandOutputs = expandOutputs
|
274
|
-
module.exports.getFilesForOutputs = getFilesForOutputs
|
275
|
-
module.exports.remove = remove
|
276
|
-
module.exports.copy = copy
|
277
|
-
module.exports.hashArray = hashArray
|
278
|
-
module.exports.hashFile = hashFile
|
279
|
-
module.exports.ImportResult = ImportResult
|
280
|
-
module.exports.findImports = findImports
|
281
|
-
module.exports.transferProjectGraph = transferProjectGraph
|
282
|
-
module.exports.ChildProcess = ChildProcess
|
283
|
-
module.exports.RustPseudoTerminal = RustPseudoTerminal
|
284
|
-
module.exports.HashPlanner = HashPlanner
|
285
|
-
module.exports.TaskHasher = TaskHasher
|
286
|
-
module.exports.EventType = EventType
|
287
|
-
module.exports.Watcher = Watcher
|
288
|
-
module.exports.WorkspaceContext = WorkspaceContext
|
289
|
-
module.exports.WorkspaceErrors = WorkspaceErrors
|
290
|
-
module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
|
251
|
+
module.exports.expandOutputs = expandOutputs
|
252
|
+
module.exports.getFilesForOutputs = getFilesForOutputs
|
253
|
+
module.exports.remove = remove
|
254
|
+
module.exports.copy = copy
|
255
|
+
module.exports.hashArray = hashArray
|
256
|
+
module.exports.hashFile = hashFile
|
257
|
+
module.exports.ImportResult = ImportResult
|
258
|
+
module.exports.findImports = findImports
|
259
|
+
module.exports.transferProjectGraph = transferProjectGraph
|
260
|
+
module.exports.ChildProcess = ChildProcess
|
261
|
+
module.exports.RustPseudoTerminal = RustPseudoTerminal
|
262
|
+
module.exports.HashPlanner = HashPlanner
|
263
|
+
module.exports.TaskHasher = TaskHasher
|
264
|
+
module.exports.EventType = EventType
|
265
|
+
module.exports.Watcher = Watcher
|
266
|
+
module.exports.WorkspaceContext = WorkspaceContext
|
267
|
+
module.exports.WorkspaceErrors = WorkspaceErrors
|
268
|
+
module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
|
@@ -31,6 +31,7 @@ function transformProjectGraphForRust(graph) {
|
|
31
31
|
}
|
32
32
|
for (const [projectName, externalNode] of Object.entries(graph.externalNodes ?? {})) {
|
33
33
|
externalNodes[projectName] = {
|
34
|
+
packageName: externalNode.data.packageName,
|
34
35
|
hash: externalNode.data.hash,
|
35
36
|
version: externalNode.data.version,
|
36
37
|
};
|
@@ -214,37 +214,55 @@ class TaskOrchestrator {
|
|
214
214
|
if (process.env.NX_RUN_COMMANDS_DIRECTLY !== 'false' &&
|
215
215
|
targetConfiguration.executor === 'nx:run-commands' &&
|
216
216
|
!shouldPrefix) {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
217
|
+
try {
|
218
|
+
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
219
|
+
const isRunOne = this.initiatingProject != null;
|
220
|
+
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ??
|
221
|
+
targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
222
|
+
if (combinedOptions.env) {
|
223
|
+
env = {
|
224
|
+
...env,
|
225
|
+
...combinedOptions.env,
|
226
|
+
};
|
227
|
+
}
|
228
|
+
if (streamOutput) {
|
229
|
+
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
230
|
+
output_1.output.logCommand(args.join(' '));
|
231
|
+
}
|
232
|
+
const { success, terminalOutput } = await (0, run_commands_impl_1.default)({
|
233
|
+
...combinedOptions,
|
234
|
+
env,
|
235
|
+
usePty: isRunOne && !this.tasksSchedule.hasTasks(),
|
236
|
+
streamOutput,
|
237
|
+
}, {
|
238
|
+
root: workspace_root_1.workspaceRoot, // only root is needed in runCommandsImpl
|
239
|
+
});
|
240
|
+
const status = success ? 'success' : 'failure';
|
241
|
+
if (!streamOutput) {
|
242
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, status, terminalOutput);
|
243
|
+
}
|
244
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
245
|
+
results.push({
|
246
|
+
task,
|
247
|
+
status,
|
248
|
+
terminalOutput,
|
249
|
+
});
|
229
250
|
}
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
251
|
+
catch (e) {
|
252
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
253
|
+
console.error(e);
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
console.error(e.message);
|
257
|
+
}
|
258
|
+
const terminalOutput = e.stack ?? e.message ?? '';
|
259
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
260
|
+
results.push({
|
261
|
+
task,
|
262
|
+
status: 'failure',
|
263
|
+
terminalOutput,
|
264
|
+
});
|
241
265
|
}
|
242
|
-
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
243
|
-
results.push({
|
244
|
-
task,
|
245
|
-
status,
|
246
|
-
terminalOutput,
|
247
|
-
});
|
248
266
|
}
|
249
267
|
else {
|
250
268
|
// cache prep
|
package/src/utils/params.js
CHANGED
@@ -176,26 +176,29 @@ function validateObject(opts, schema, definitions) {
|
|
176
176
|
}
|
177
177
|
}
|
178
178
|
if (schema.oneOf) {
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
catch (e) {
|
186
|
-
errors.push(e);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
if (errors.length === schema.oneOf.length) {
|
190
|
-
throw new Error(`Options did not match schema. Please fix 1 of the following errors:\n${errors
|
191
|
-
.map((e) => ' - ' + e.message)
|
192
|
-
.join('\n')}`);
|
179
|
+
const matches = [];
|
180
|
+
const errors = [];
|
181
|
+
for (const propertyDescription of schema.oneOf) {
|
182
|
+
try {
|
183
|
+
validateObject(opts, propertyDescription, definitions);
|
184
|
+
matches.push(propertyDescription);
|
193
185
|
}
|
194
|
-
|
195
|
-
|
196
|
-
throw new Error(`Options did not match schema.`);
|
186
|
+
catch (error) {
|
187
|
+
errors.push(error);
|
197
188
|
}
|
198
189
|
}
|
190
|
+
// If the options matched none of the oneOf property descriptions
|
191
|
+
if (matches.length === 0) {
|
192
|
+
throw new Error(`Options did not match schema: ${JSON.stringify(opts, null, 2)}.\nPlease fix 1 of the following errors:\n${errors
|
193
|
+
.map((e) => ' - ' + e.message)
|
194
|
+
.join('\n')}`);
|
195
|
+
}
|
196
|
+
// If the options matched none of the oneOf property descriptions
|
197
|
+
if (matches.length > 1) {
|
198
|
+
throw new Error(`Options did not match schema: ${JSON.stringify(opts, null, 2)}.\nShould only match one of \n${matches
|
199
|
+
.map((m) => ' - ' + JSON.stringify(m))
|
200
|
+
.join('\n')}`);
|
201
|
+
}
|
199
202
|
}
|
200
203
|
(schema.required ?? []).forEach((p) => {
|
201
204
|
if (opts[p] === undefined) {
|