nx-lifecycle 1.1.3 → 1.1.4
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/dist/commands/lifecycle-command.js +1 -1
- package/dist/lifecycle/lifecycle-internal.js +20 -8
- package/dist/lifecycle/processor.js +3 -0
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/nx-json.d.ts +1 -0
- package/dist/schemas/project-json.d.ts +1 -0
- package/dist/schemas/target.d.ts +2 -0
- package/dist/schemas/target.js +1 -0
- package/package.json +9 -8
|
@@ -11,7 +11,7 @@ export const lifecycleCommand = {
|
|
|
11
11
|
describe: 'Inject Nx targets as high level workflows',
|
|
12
12
|
builder: (yargs)=>yargs.options({
|
|
13
13
|
configFile: {
|
|
14
|
-
describe: '
|
|
14
|
+
describe: 'Config file with `stages` and `bindings`',
|
|
15
15
|
type: 'string',
|
|
16
16
|
default: 'lifecycle.json'
|
|
17
17
|
},
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { deepEqual } from 'fast-equals';
|
|
3
3
|
import { formatFiles } from 'format-file';
|
|
4
|
+
import { hasCode } from 'unknown-error';
|
|
4
5
|
import { assertNxJson, assertProjectJson } from '#schemas';
|
|
5
6
|
import { normalizeOptions } from './normalizer.js';
|
|
6
7
|
import { processNxAndProjectJsons } from './processor.js';
|
|
7
8
|
const loadJsonConfigs = async ({ nxJsonPath, packageJsonPaths })=>{
|
|
8
9
|
const [rawNxJson, ...rawProjectJsons] = await Promise.all([
|
|
9
10
|
readFile(nxJsonPath, 'utf8'),
|
|
10
|
-
...packageJsonPaths.map(async ({ name, path })=>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
...packageJsonPaths.map(async ({ name, path })=>{
|
|
12
|
+
try {
|
|
13
|
+
return {
|
|
14
|
+
name,
|
|
15
|
+
path,
|
|
16
|
+
rawData: await readFile(path, 'utf8')
|
|
17
|
+
};
|
|
18
|
+
} catch (err) {
|
|
19
|
+
if (hasCode(err, 'ENOENT')) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
})
|
|
15
25
|
]);
|
|
16
|
-
|
|
26
|
+
let parsedNxJson;
|
|
17
27
|
try {
|
|
28
|
+
parsedNxJson = JSON.parse(rawNxJson);
|
|
18
29
|
assertNxJson(parsedNxJson);
|
|
19
30
|
} catch (err) {
|
|
20
31
|
throw new Error('Failed to parse nx.json', {
|
|
@@ -27,9 +38,10 @@ const loadJsonConfigs = async ({ nxJsonPath, packageJsonPaths })=>{
|
|
|
27
38
|
path: nxJsonPath,
|
|
28
39
|
data: parsedNxJson
|
|
29
40
|
},
|
|
30
|
-
projectJsons: rawProjectJsons.map(({ name, path, rawData })=>{
|
|
31
|
-
|
|
41
|
+
projectJsons: rawProjectJsons.filter((rawProjectJson)=>rawProjectJson !== null).map(({ name, path, rawData })=>{
|
|
42
|
+
let data;
|
|
32
43
|
try {
|
|
44
|
+
data = JSON.parse(rawData);
|
|
33
45
|
assertProjectJson(data);
|
|
34
46
|
} catch (err) {
|
|
35
47
|
throw new Error(`Failed to parse ${path}`, {
|
|
@@ -188,6 +188,9 @@ const processProjectJson = ({ projectJson, lifecycleTargets, registeredTargets,
|
|
|
188
188
|
}
|
|
189
189
|
for (const [targetName, target] of Object.entries(targets)){
|
|
190
190
|
if (targetsToRemove.has(targetName) || lifecycleTargets.has(targetName)) {
|
|
191
|
+
if ('executor' in target || 'command' in target) {
|
|
192
|
+
throw new Error(`Overlap in lifecycle hook and project.json target: ${targetName}`);
|
|
193
|
+
}
|
|
191
194
|
delete targets[targetName];
|
|
192
195
|
} else if (target.dependsOn) {
|
|
193
196
|
const processedTarget = {
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from './configurations.js';
|
|
2
|
+
export * from './depend-on.js';
|
|
1
3
|
export * from './empty.js';
|
|
2
4
|
export * from './nx-json.js';
|
|
3
5
|
export * from './project-json.js';
|
|
4
|
-
export * from './configurations.js';
|
|
5
|
-
export * from './depend-on.js';
|
|
6
6
|
export * from './target.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from './configurations.js';
|
|
2
|
+
export * from './depend-on.js';
|
|
1
3
|
export * from './empty.js';
|
|
2
4
|
export * from './nx-json.js';
|
|
3
5
|
export * from './project-json.js';
|
|
4
|
-
export * from './configurations.js';
|
|
5
|
-
export * from './depend-on.js';
|
|
6
6
|
export * from './target.js';
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,6 +3,7 @@ import type { JuniperValidator } from 'juniper-validator';
|
|
|
3
3
|
declare const nxJsonSchema: import("juniper").ObjectSchema<{
|
|
4
4
|
targetDefaults: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
5
5
|
executor: import("juniper").StringSchema<string, false>;
|
|
6
|
+
command: import("juniper").StringSchema<string, false>;
|
|
6
7
|
dependsOn: import("juniper").ArraySchema<string | {
|
|
7
8
|
target: string;
|
|
8
9
|
params?: string;
|
|
@@ -3,6 +3,7 @@ import type { JuniperValidator } from 'juniper-validator';
|
|
|
3
3
|
declare const projectJsonSchema: import("juniper").ObjectSchema<{
|
|
4
4
|
targets: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
5
5
|
executor: import("juniper").StringSchema<string, false>;
|
|
6
|
+
command: import("juniper").StringSchema<string, false>;
|
|
6
7
|
dependsOn: import("juniper").ArraySchema<string | {
|
|
7
8
|
target: string;
|
|
8
9
|
params?: string;
|
package/dist/schemas/target.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SchemaType } from 'juniper';
|
|
2
2
|
declare const targetSchema: import("juniper").ObjectSchema<{
|
|
3
3
|
executor: import("juniper").StringSchema<string, false>;
|
|
4
|
+
command: import("juniper").StringSchema<string, false>;
|
|
4
5
|
dependsOn: import("juniper").ArraySchema<string | {
|
|
5
6
|
target: string;
|
|
6
7
|
params?: string;
|
|
@@ -42,6 +43,7 @@ declare const targetSchema: import("juniper").ObjectSchema<{
|
|
|
42
43
|
export type Target = SchemaType<typeof targetSchema>;
|
|
43
44
|
export declare const allTargetsSchema: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
44
45
|
executor: import("juniper").StringSchema<string, false>;
|
|
46
|
+
command: import("juniper").StringSchema<string, false>;
|
|
45
47
|
dependsOn: import("juniper").ArraySchema<string | {
|
|
46
48
|
target: string;
|
|
47
49
|
params?: string;
|
package/dist/schemas/target.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx-lifecycle",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Nx plugin that derives every dependsOn from declared lifecycle stages (build, test, …) and the targets bound to them.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@nx/devkit": "^23.3.0",
|
|
63
63
|
"ci-info": "^4.4.0",
|
|
64
|
-
"entry-script": "^4.1.
|
|
64
|
+
"entry-script": "^4.1.1",
|
|
65
65
|
"fast-equals": "^6.0.4",
|
|
66
|
-
"format-file": "^1.0.
|
|
67
|
-
"haywire": "^2.0.
|
|
68
|
-
"haywire-launcher": "^1.0
|
|
69
|
-
"juniper": "^2.4.
|
|
70
|
-
"juniper-validator": "^0.
|
|
66
|
+
"format-file": "^1.0.3",
|
|
67
|
+
"haywire": "^2.0.2",
|
|
68
|
+
"haywire-launcher": "^1.1.0",
|
|
69
|
+
"juniper": "^2.4.1",
|
|
70
|
+
"juniper-validator": "^0.5.0",
|
|
71
71
|
"nx": "^23.3.0",
|
|
72
72
|
"parse-cwd": "^2.0.2",
|
|
73
73
|
"unknown-error": "^0.1.0",
|
|
@@ -84,10 +84,11 @@
|
|
|
84
84
|
"@types/sinon": "^22.0.0",
|
|
85
85
|
"@types/yargs": "^17.0.35",
|
|
86
86
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
87
|
+
"barrelify": "^2.2.1",
|
|
87
88
|
"c8": "^12.0.0",
|
|
88
89
|
"eslint": "^10.12.0",
|
|
89
90
|
"expect-type": "^1.4.0",
|
|
90
|
-
"load-populate-files": "^1.1.
|
|
91
|
+
"load-populate-files": "^1.1.2",
|
|
91
92
|
"mocha": "^12.0.2",
|
|
92
93
|
"mocha-chain": "^1.0.1",
|
|
93
94
|
"sinon": "^22.1.0",
|