nx-lifecycle 0.0.2
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/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +196 -0
- package/dist/executors/lifecycle/constants.d.ts +2 -0
- package/dist/executors/lifecycle/constants.js +2 -0
- package/dist/executors/lifecycle/depedencies.d.ts +13 -0
- package/dist/executors/lifecycle/depedencies.js +11 -0
- package/dist/executors/lifecycle/index.cjs +13 -0
- package/dist/executors/lifecycle/index.d.cts +49 -0
- package/dist/executors/lifecycle/index.d.ts +47 -0
- package/dist/executors/lifecycle/index.js +22 -0
- package/dist/executors/lifecycle/lifecycle.d.ts +23 -0
- package/dist/executors/lifecycle/lifecycle.js +102 -0
- package/dist/executors/lifecycle/normalizer.d.ts +23 -0
- package/dist/executors/lifecycle/normalizer.js +21 -0
- package/dist/executors/lifecycle/processor.d.ts +15 -0
- package/dist/executors/lifecycle/processor.js +239 -0
- package/dist/executors/lifecycle/types.d.ts +3 -0
- package/dist/executors/lifecycle/types.js +2 -0
- package/dist/schemas/configurations.d.ts +10 -0
- package/dist/schemas/configurations.js +21 -0
- package/dist/schemas/depend-on.d.ts +52 -0
- package/dist/schemas/depend-on.js +37 -0
- package/dist/schemas/empty.d.ts +6 -0
- package/dist/schemas/empty.js +7 -0
- package/dist/schemas/index.d.ts +7 -0
- package/dist/schemas/index.js +7 -0
- package/dist/schemas/lib/ajv.d.ts +3 -0
- package/dist/schemas/lib/ajv.js +7 -0
- package/dist/schemas/nx-json.d.ts +60 -0
- package/dist/schemas/nx-json.js +13 -0
- package/dist/schemas/project-json.d.ts +60 -0
- package/dist/schemas/project-json.js +13 -0
- package/dist/schemas/target.d.ts +99 -0
- package/dist/schemas/target.js +14 -0
- package/executors.json +9 -0
- package/package.json +72 -0
- package/src/executors/lifecycle/schema.json +98 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { identifier } from 'haywire';
|
|
2
|
+
import { isEmpty } from '#schemas';
|
|
3
|
+
import { NOOP_EXECUTOR } from './constants.js';
|
|
4
|
+
const calculateTargets = ({ stages })=>{
|
|
5
|
+
const lifecycleTargets = new Map();
|
|
6
|
+
for (const [stageName, stage] of Object.entries(stages)){
|
|
7
|
+
const prefixHook = `${stageName}:_`;
|
|
8
|
+
lifecycleTargets.set(prefixHook, {
|
|
9
|
+
name: prefixHook,
|
|
10
|
+
kind: 'anchor',
|
|
11
|
+
dependsOn: stage.dependsOn ?? []
|
|
12
|
+
});
|
|
13
|
+
let previousHook = prefixHook;
|
|
14
|
+
const hooks = stage.hooks ?? [];
|
|
15
|
+
for (const hook of hooks){
|
|
16
|
+
const hookName = `${stageName}:${hook}`;
|
|
17
|
+
lifecycleTargets.set(hookName, {
|
|
18
|
+
name: hookName,
|
|
19
|
+
kind: 'hook',
|
|
20
|
+
dependsOn: [
|
|
21
|
+
previousHook
|
|
22
|
+
],
|
|
23
|
+
previousHook
|
|
24
|
+
});
|
|
25
|
+
previousHook = hookName;
|
|
26
|
+
}
|
|
27
|
+
lifecycleTargets.set(stageName, {
|
|
28
|
+
name: stageName,
|
|
29
|
+
kind: 'base',
|
|
30
|
+
dependsOn: [
|
|
31
|
+
previousHook
|
|
32
|
+
],
|
|
33
|
+
previousHook,
|
|
34
|
+
hasHooks: hooks.length > 0
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return lifecycleTargets;
|
|
38
|
+
};
|
|
39
|
+
const registerTargets = ({ lifecycleTargets, options })=>{
|
|
40
|
+
const registeredTargets = new Map();
|
|
41
|
+
for (const [targetName, hookName] of Object.entries(options.bindings)){
|
|
42
|
+
if (lifecycleTargets.has(targetName)) {
|
|
43
|
+
throw new Error(`Overlap in lifecycle hook and target: ${targetName}`);
|
|
44
|
+
}
|
|
45
|
+
const hook = lifecycleTargets.get(hookName);
|
|
46
|
+
if (!hook) {
|
|
47
|
+
throw new Error(`Hook for target ${targetName} not found: ${hookName}`);
|
|
48
|
+
}
|
|
49
|
+
if (hook.kind === 'anchor') {
|
|
50
|
+
throw new Error(`Target ${targetName} cannot be part of anchor hook ${hook.name}`);
|
|
51
|
+
}
|
|
52
|
+
if (hook.kind === 'base' && hook.hasHooks) {
|
|
53
|
+
throw new Error(`Target ${targetName} cannot be part of base hook ${hook.name}. Use format ${hook.name}:<hook>`);
|
|
54
|
+
}
|
|
55
|
+
registeredTargets.set(targetName, hook);
|
|
56
|
+
}
|
|
57
|
+
return registeredTargets;
|
|
58
|
+
};
|
|
59
|
+
const calculateTargetsToRemove = ({ lifecycleTargets, nxJson })=>{
|
|
60
|
+
const targetsToRemove = new Set();
|
|
61
|
+
for (const [targetName, target] of lifecycleTargets.entries()){
|
|
62
|
+
if (target.kind !== 'base') {
|
|
63
|
+
targetsToRemove.add(targetName);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const [targetName, target] of Object.entries(nxJson.targetDefaults ?? {})){
|
|
67
|
+
if (!lifecycleTargets.has(targetName) && '__lifecycle' in (target.configurations ?? {})) {
|
|
68
|
+
targetsToRemove.add(targetName);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return targetsToRemove;
|
|
72
|
+
};
|
|
73
|
+
const removeDependencyTargets = ({ target, lifecycleTargets, targetsToRemove })=>{
|
|
74
|
+
if (target.dependsOn) {
|
|
75
|
+
return target.dependsOn.filter((dependency)=>{
|
|
76
|
+
const dependencyTarget = typeof dependency === 'string' ? dependency : dependency.target;
|
|
77
|
+
const normalized = dependencyTarget.replace(/^\^/u, '');
|
|
78
|
+
if (targetsToRemove.has(normalized)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const lifecycleTarget = lifecycleTargets.get(normalized);
|
|
82
|
+
if (lifecycleTarget) {
|
|
83
|
+
return lifecycleTarget.kind === 'base';
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
};
|
|
90
|
+
const validateLifecycleDependencies = ({ lifecycleTargets, options, targetsToRemove })=>{
|
|
91
|
+
for (const [stageName, { dependsOn }] of Object.entries(options.stages)){
|
|
92
|
+
if (dependsOn) {
|
|
93
|
+
const filtered = removeDependencyTargets({
|
|
94
|
+
target: {
|
|
95
|
+
dependsOn
|
|
96
|
+
},
|
|
97
|
+
lifecycleTargets,
|
|
98
|
+
targetsToRemove
|
|
99
|
+
});
|
|
100
|
+
if (filtered.length !== dependsOn.length) {
|
|
101
|
+
throw new Error(`Invalid dependency detected on lifecycle stage ${stageName}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const processNxJson = ({ nxJson, lifecycleTargets, registeredTargets, targetsToRemove })=>{
|
|
107
|
+
const originalTargets = nxJson.targetDefaults ?? {};
|
|
108
|
+
const targetDefaults = {
|
|
109
|
+
...originalTargets
|
|
110
|
+
};
|
|
111
|
+
const lifecycles = {};
|
|
112
|
+
for (const [targetName, target] of lifecycleTargets.entries()){
|
|
113
|
+
lifecycles[targetName] = {
|
|
114
|
+
executor: NOOP_EXECUTOR,
|
|
115
|
+
dependsOn: [
|
|
116
|
+
...target.dependsOn
|
|
117
|
+
],
|
|
118
|
+
configurations: {
|
|
119
|
+
__lifecycle: {}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
for (const [targetName, originalTarget] of Object.entries(targetDefaults)){
|
|
124
|
+
if (targetsToRemove.has(targetName) || lifecycleTargets.has(targetName)) {
|
|
125
|
+
if ('__lifecycle' in (originalTarget.configurations ?? {})) {
|
|
126
|
+
delete targetDefaults[targetName];
|
|
127
|
+
} else {
|
|
128
|
+
throw new Error(`Overlap in lifecycle hook and target: ${targetName}`);
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
targetDefaults[targetName] = {
|
|
132
|
+
...originalTarget,
|
|
133
|
+
dependsOn: removeDependencyTargets({
|
|
134
|
+
target: originalTarget,
|
|
135
|
+
lifecycleTargets,
|
|
136
|
+
targetsToRemove
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
for (const [targetName, lifecycleTarget] of registeredTargets.entries()){
|
|
142
|
+
const registeredTarget = targetDefaults[targetName] ?? {};
|
|
143
|
+
registeredTarget.dependsOn ??= [];
|
|
144
|
+
registeredTarget.dependsOn.push(lifecycleTarget.previousHook);
|
|
145
|
+
lifecycles[lifecycleTarget.name].dependsOn?.push(targetName);
|
|
146
|
+
targetDefaults[targetName] = registeredTarget;
|
|
147
|
+
}
|
|
148
|
+
Object.assign(targetDefaults, lifecycles);
|
|
149
|
+
for (const [targetName, target] of Object.entries(targetDefaults)){
|
|
150
|
+
if (target.dependsOn.length === 0) {
|
|
151
|
+
const originalTarget = originalTargets[targetName] ?? {};
|
|
152
|
+
if (!originalTarget.dependsOn) {
|
|
153
|
+
delete target.dependsOn;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
...nxJson,
|
|
159
|
+
targetDefaults
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
const processProjectJson = ({ projectJson, lifecycleTargets, registeredTargets, targetsToRemove })=>{
|
|
163
|
+
const originalTargets = projectJson.targets ?? {};
|
|
164
|
+
const targets = {
|
|
165
|
+
...originalTargets
|
|
166
|
+
};
|
|
167
|
+
const lifecycles = {};
|
|
168
|
+
for (const targetName of lifecycleTargets.keys()){
|
|
169
|
+
lifecycles[targetName] = {};
|
|
170
|
+
}
|
|
171
|
+
for (const [targetName, target] of Object.entries(targets)){
|
|
172
|
+
if (targetsToRemove.has(targetName) || lifecycleTargets.has(targetName)) {
|
|
173
|
+
delete targets[targetName];
|
|
174
|
+
} else if (target.dependsOn) {
|
|
175
|
+
const processedTarget = {
|
|
176
|
+
...target
|
|
177
|
+
};
|
|
178
|
+
targets[targetName] = processedTarget;
|
|
179
|
+
processedTarget.dependsOn = removeDependencyTargets({
|
|
180
|
+
target,
|
|
181
|
+
lifecycleTargets,
|
|
182
|
+
targetsToRemove
|
|
183
|
+
});
|
|
184
|
+
const lifecycleTarget = registeredTargets.get(targetName);
|
|
185
|
+
if (lifecycleTarget) {
|
|
186
|
+
processedTarget.dependsOn.push(lifecycleTarget.previousHook);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const processedTargets = {
|
|
191
|
+
...targets,
|
|
192
|
+
...lifecycles
|
|
193
|
+
};
|
|
194
|
+
if (!('targets' in projectJson) && isEmpty(processedTargets)) {
|
|
195
|
+
return projectJson;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
...projectJson,
|
|
199
|
+
targets: processedTargets
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
export const nxAndProjectJsonProcessorIdentifier = identifier();
|
|
203
|
+
export const processNxAndProjectJsons = ({ nxJson, projectJsons, options })=>{
|
|
204
|
+
const lifecycleTargets = calculateTargets(options);
|
|
205
|
+
const targetsToRemove = calculateTargetsToRemove({
|
|
206
|
+
lifecycleTargets,
|
|
207
|
+
nxJson
|
|
208
|
+
});
|
|
209
|
+
validateLifecycleDependencies({
|
|
210
|
+
lifecycleTargets,
|
|
211
|
+
options,
|
|
212
|
+
targetsToRemove
|
|
213
|
+
});
|
|
214
|
+
const registeredTargets = registerTargets({
|
|
215
|
+
options,
|
|
216
|
+
lifecycleTargets
|
|
217
|
+
});
|
|
218
|
+
const processedNxJson = processNxJson({
|
|
219
|
+
nxJson,
|
|
220
|
+
lifecycleTargets,
|
|
221
|
+
registeredTargets,
|
|
222
|
+
targetsToRemove
|
|
223
|
+
});
|
|
224
|
+
const processedProjectJsons = projectJsons.map((projectJson)=>processProjectJson({
|
|
225
|
+
projectJson,
|
|
226
|
+
lifecycleTargets,
|
|
227
|
+
targetsToRemove,
|
|
228
|
+
registeredTargets
|
|
229
|
+
}));
|
|
230
|
+
const response = {
|
|
231
|
+
processedNxJson,
|
|
232
|
+
processedProjectJsons
|
|
233
|
+
};
|
|
234
|
+
if (!('targetDefaults' in nxJson) && isEmpty(processedNxJson.targetDefaults)) {
|
|
235
|
+
delete response.processedNxJson.targetDefaults;
|
|
236
|
+
}
|
|
237
|
+
return response;
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=processor.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SchemaType } from 'juniper';
|
|
2
|
+
export declare const configurationsSchema: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Record<string, unknown> & Partial<{
|
|
3
|
+
__lifecycle: never;
|
|
4
|
+
}>) | (Partial<{
|
|
5
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
6
|
+
}> & Required<Pick<{
|
|
7
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
8
|
+
}, "__lifecycle">>), boolean>;
|
|
9
|
+
export type Configurations = SchemaType<typeof configurationsSchema>;
|
|
10
|
+
//# sourceMappingURL=configurations.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { objectSchema } from 'juniper';
|
|
2
|
+
export const configurationsSchema = objectSchema().oneOf([
|
|
3
|
+
objectSchema({
|
|
4
|
+
properties: {
|
|
5
|
+
__lifecycle: false
|
|
6
|
+
},
|
|
7
|
+
additionalProperties: true
|
|
8
|
+
}),
|
|
9
|
+
objectSchema({
|
|
10
|
+
properties: {
|
|
11
|
+
__lifecycle: objectSchema({
|
|
12
|
+
additionalProperties: false
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
required: [
|
|
16
|
+
'__lifecycle'
|
|
17
|
+
],
|
|
18
|
+
additionalProperties: false
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
//# sourceMappingURL=configurations.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type SchemaType } from 'juniper';
|
|
2
|
+
declare const dependencyObject: import("juniper").ObjectSchema<{
|
|
3
|
+
target: import("juniper").StringSchema<string, false>;
|
|
4
|
+
params: import("juniper").EnumSchema<string>;
|
|
5
|
+
}, "target", boolean, import("juniper").EmptyIndex, Partial<{
|
|
6
|
+
dependencies: boolean;
|
|
7
|
+
}> | (Partial<{
|
|
8
|
+
projects: string | string[];
|
|
9
|
+
}> & Required<Pick<{
|
|
10
|
+
projects: string | string[];
|
|
11
|
+
}, "projects">>), boolean>;
|
|
12
|
+
export type DependencyObject = SchemaType<typeof dependencyObject>;
|
|
13
|
+
export declare const dependsOnSchema: import("juniper").ArraySchema<(string | (Partial<{
|
|
14
|
+
projects: string | string[];
|
|
15
|
+
}> & Required<Pick<{
|
|
16
|
+
projects: string | string[];
|
|
17
|
+
}, "projects">> & Partial<{
|
|
18
|
+
target: string;
|
|
19
|
+
params: string;
|
|
20
|
+
}> & Required<Pick<{
|
|
21
|
+
target: string;
|
|
22
|
+
params: string;
|
|
23
|
+
}, "target">>) | (Partial<{
|
|
24
|
+
dependencies: boolean;
|
|
25
|
+
}> & Partial<{
|
|
26
|
+
target: string;
|
|
27
|
+
params: string;
|
|
28
|
+
}> & Required<Pick<{
|
|
29
|
+
target: string;
|
|
30
|
+
params: string;
|
|
31
|
+
}, "target">>)) & (string | (Partial<{
|
|
32
|
+
projects: string | string[];
|
|
33
|
+
}> & Required<Pick<{
|
|
34
|
+
projects: string | string[];
|
|
35
|
+
}, "projects">> & Partial<{
|
|
36
|
+
target: string;
|
|
37
|
+
params: string;
|
|
38
|
+
}> & Required<Pick<{
|
|
39
|
+
target: string;
|
|
40
|
+
params: string;
|
|
41
|
+
}, "target">>) | (Partial<{
|
|
42
|
+
dependencies: boolean;
|
|
43
|
+
}> & Partial<{
|
|
44
|
+
target: string;
|
|
45
|
+
params: string;
|
|
46
|
+
}> & Required<Pick<{
|
|
47
|
+
target: string;
|
|
48
|
+
params: string;
|
|
49
|
+
}, "target">>) | undefined), [], never, unknown, false>;
|
|
50
|
+
export type DependsOn = SchemaType<typeof dependsOnSchema>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=depend-on.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { arraySchema, booleanSchema, enumSchema, mergeSchema, objectSchema, stringSchema } from 'juniper';
|
|
2
|
+
const dependencyObject = objectSchema({
|
|
3
|
+
properties: {
|
|
4
|
+
target: stringSchema(),
|
|
5
|
+
params: enumSchema({
|
|
6
|
+
enum: [
|
|
7
|
+
'forward',
|
|
8
|
+
'ignore'
|
|
9
|
+
]
|
|
10
|
+
})
|
|
11
|
+
},
|
|
12
|
+
required: [
|
|
13
|
+
'target'
|
|
14
|
+
]
|
|
15
|
+
}).oneOf([
|
|
16
|
+
objectSchema({
|
|
17
|
+
properties: {
|
|
18
|
+
dependencies: booleanSchema()
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
objectSchema({
|
|
22
|
+
properties: {
|
|
23
|
+
projects: mergeSchema().oneOf([
|
|
24
|
+
arraySchema(stringSchema()),
|
|
25
|
+
stringSchema()
|
|
26
|
+
])
|
|
27
|
+
},
|
|
28
|
+
required: [
|
|
29
|
+
'projects'
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
export const dependsOnSchema = arraySchema(mergeSchema().oneOf([
|
|
34
|
+
stringSchema(),
|
|
35
|
+
dependencyObject
|
|
36
|
+
]));
|
|
37
|
+
//# sourceMappingURL=depend-on.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SchemaType } from 'juniper';
|
|
2
|
+
declare const emptySchema: import("juniper").ObjectSchema<{}, never, false, import("juniper").EmptyIndex, unknown, false>;
|
|
3
|
+
export type Empty = SchemaType<typeof emptySchema>;
|
|
4
|
+
export declare const isEmpty: import("ajv").ValidateFunction<import("juniper").EmptyObject>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
import { type SchemaType } from 'juniper';
|
|
3
|
+
declare const nxJsonSchema: import("juniper").ObjectSchema<{
|
|
4
|
+
targetDefaults: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
5
|
+
executor: import("juniper").StringSchema<string, false>;
|
|
6
|
+
dependsOn: import("juniper").ArraySchema<(string | (Partial<{
|
|
7
|
+
projects: string | string[];
|
|
8
|
+
}> & Required<Pick<{
|
|
9
|
+
projects: string | string[];
|
|
10
|
+
}, "projects">> & Partial<{
|
|
11
|
+
target: string;
|
|
12
|
+
params: string;
|
|
13
|
+
}> & Required<Pick<{
|
|
14
|
+
target: string;
|
|
15
|
+
params: string;
|
|
16
|
+
}, "target">>) | (Partial<{
|
|
17
|
+
dependencies: boolean;
|
|
18
|
+
}> & Partial<{
|
|
19
|
+
target: string;
|
|
20
|
+
params: string;
|
|
21
|
+
}> & Required<Pick<{
|
|
22
|
+
target: string;
|
|
23
|
+
params: string;
|
|
24
|
+
}, "target">>)) & (string | (Partial<{
|
|
25
|
+
projects: string | string[];
|
|
26
|
+
}> & Required<Pick<{
|
|
27
|
+
projects: string | string[];
|
|
28
|
+
}, "projects">> & Partial<{
|
|
29
|
+
target: string;
|
|
30
|
+
params: string;
|
|
31
|
+
}> & Required<Pick<{
|
|
32
|
+
target: string;
|
|
33
|
+
params: string;
|
|
34
|
+
}, "target">>) | (Partial<{
|
|
35
|
+
dependencies: boolean;
|
|
36
|
+
}> & Partial<{
|
|
37
|
+
target: string;
|
|
38
|
+
params: string;
|
|
39
|
+
}> & Required<Pick<{
|
|
40
|
+
target: string;
|
|
41
|
+
params: string;
|
|
42
|
+
}, "target">>) | undefined), [], never, unknown, false>;
|
|
43
|
+
configurations: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Record<string, unknown> & Partial<{
|
|
44
|
+
__lifecycle: never;
|
|
45
|
+
}>) | (Partial<{
|
|
46
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
47
|
+
}> & Required<Pick<{
|
|
48
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
49
|
+
}, "__lifecycle">>), boolean>;
|
|
50
|
+
}, never, boolean, import("juniper").EmptyIndex, unknown, false>, import("juniper").EmptyIndex, unknown, false>;
|
|
51
|
+
}, never, true, import("juniper").EmptyIndex, unknown, false>;
|
|
52
|
+
export type NxJson = SchemaType<typeof nxJsonSchema>;
|
|
53
|
+
export interface IsNxJson {
|
|
54
|
+
(val: unknown): val is NxJson;
|
|
55
|
+
errors?: ErrorObject[] | null;
|
|
56
|
+
}
|
|
57
|
+
export declare const isNxJson: IsNxJson;
|
|
58
|
+
export declare const isNxJsonIdentifier: import("haywire").HaywireId<IsNxJson, null, "nxJson", false, false, false, false>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=nx-json.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { identifier } from 'haywire';
|
|
2
|
+
import { objectSchema } from 'juniper';
|
|
3
|
+
import { ajv } from './lib/ajv.js';
|
|
4
|
+
import { allTargetsSchema } from './target.js';
|
|
5
|
+
const nxJsonSchema = objectSchema({
|
|
6
|
+
properties: {
|
|
7
|
+
targetDefaults: allTargetsSchema
|
|
8
|
+
},
|
|
9
|
+
additionalProperties: true
|
|
10
|
+
});
|
|
11
|
+
export const isNxJson = ajv.compile(nxJsonSchema.toJSON());
|
|
12
|
+
export const isNxJsonIdentifier = identifier().named('nxJson');
|
|
13
|
+
//# sourceMappingURL=nx-json.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
import { type SchemaType } from 'juniper';
|
|
3
|
+
declare const projectJsonSchema: import("juniper").ObjectSchema<{
|
|
4
|
+
targets: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
5
|
+
executor: import("juniper").StringSchema<string, false>;
|
|
6
|
+
dependsOn: import("juniper").ArraySchema<(string | (Partial<{
|
|
7
|
+
projects: string | string[];
|
|
8
|
+
}> & Required<Pick<{
|
|
9
|
+
projects: string | string[];
|
|
10
|
+
}, "projects">> & Partial<{
|
|
11
|
+
target: string;
|
|
12
|
+
params: string;
|
|
13
|
+
}> & Required<Pick<{
|
|
14
|
+
target: string;
|
|
15
|
+
params: string;
|
|
16
|
+
}, "target">>) | (Partial<{
|
|
17
|
+
dependencies: boolean;
|
|
18
|
+
}> & Partial<{
|
|
19
|
+
target: string;
|
|
20
|
+
params: string;
|
|
21
|
+
}> & Required<Pick<{
|
|
22
|
+
target: string;
|
|
23
|
+
params: string;
|
|
24
|
+
}, "target">>)) & (string | (Partial<{
|
|
25
|
+
projects: string | string[];
|
|
26
|
+
}> & Required<Pick<{
|
|
27
|
+
projects: string | string[];
|
|
28
|
+
}, "projects">> & Partial<{
|
|
29
|
+
target: string;
|
|
30
|
+
params: string;
|
|
31
|
+
}> & Required<Pick<{
|
|
32
|
+
target: string;
|
|
33
|
+
params: string;
|
|
34
|
+
}, "target">>) | (Partial<{
|
|
35
|
+
dependencies: boolean;
|
|
36
|
+
}> & Partial<{
|
|
37
|
+
target: string;
|
|
38
|
+
params: string;
|
|
39
|
+
}> & Required<Pick<{
|
|
40
|
+
target: string;
|
|
41
|
+
params: string;
|
|
42
|
+
}, "target">>) | undefined), [], never, unknown, false>;
|
|
43
|
+
configurations: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Record<string, unknown> & Partial<{
|
|
44
|
+
__lifecycle: never;
|
|
45
|
+
}>) | (Partial<{
|
|
46
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
47
|
+
}> & Required<Pick<{
|
|
48
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
49
|
+
}, "__lifecycle">>), boolean>;
|
|
50
|
+
}, never, boolean, import("juniper").EmptyIndex, unknown, false>, import("juniper").EmptyIndex, unknown, false>;
|
|
51
|
+
}, never, true, import("juniper").EmptyIndex, unknown, false>;
|
|
52
|
+
export type ProjectJson = SchemaType<typeof projectJsonSchema>;
|
|
53
|
+
export interface IsProjectJson {
|
|
54
|
+
(val: unknown): val is ProjectJson;
|
|
55
|
+
errors?: ErrorObject[] | null;
|
|
56
|
+
}
|
|
57
|
+
export declare const isProjectJson: IsProjectJson;
|
|
58
|
+
export declare const isProjectJsonIdentifier: import("haywire").HaywireId<IsProjectJson, null, "projectJson", false, false, false, false>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=project-json.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { identifier } from 'haywire';
|
|
2
|
+
import { objectSchema } from 'juniper';
|
|
3
|
+
import { ajv } from './lib/ajv.js';
|
|
4
|
+
import { allTargetsSchema } from './target.js';
|
|
5
|
+
const projectJsonSchema = objectSchema({
|
|
6
|
+
properties: {
|
|
7
|
+
targets: allTargetsSchema
|
|
8
|
+
},
|
|
9
|
+
additionalProperties: true
|
|
10
|
+
});
|
|
11
|
+
export const isProjectJson = ajv.compile(projectJsonSchema.toJSON());
|
|
12
|
+
export const isProjectJsonIdentifier = identifier().named('projectJson');
|
|
13
|
+
//# sourceMappingURL=project-json.js.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type SchemaType } from 'juniper';
|
|
2
|
+
declare const targetSchema: import("juniper").ObjectSchema<{
|
|
3
|
+
executor: import("juniper").StringSchema<string, false>;
|
|
4
|
+
dependsOn: import("juniper").ArraySchema<(string | (Partial<{
|
|
5
|
+
projects: string | string[];
|
|
6
|
+
}> & Required<Pick<{
|
|
7
|
+
projects: string | string[];
|
|
8
|
+
}, "projects">> & Partial<{
|
|
9
|
+
target: string;
|
|
10
|
+
params: string;
|
|
11
|
+
}> & Required<Pick<{
|
|
12
|
+
target: string;
|
|
13
|
+
params: string;
|
|
14
|
+
}, "target">>) | (Partial<{
|
|
15
|
+
dependencies: boolean;
|
|
16
|
+
}> & Partial<{
|
|
17
|
+
target: string;
|
|
18
|
+
params: string;
|
|
19
|
+
}> & Required<Pick<{
|
|
20
|
+
target: string;
|
|
21
|
+
params: string;
|
|
22
|
+
}, "target">>)) & (string | (Partial<{
|
|
23
|
+
projects: string | string[];
|
|
24
|
+
}> & Required<Pick<{
|
|
25
|
+
projects: string | string[];
|
|
26
|
+
}, "projects">> & Partial<{
|
|
27
|
+
target: string;
|
|
28
|
+
params: string;
|
|
29
|
+
}> & Required<Pick<{
|
|
30
|
+
target: string;
|
|
31
|
+
params: string;
|
|
32
|
+
}, "target">>) | (Partial<{
|
|
33
|
+
dependencies: boolean;
|
|
34
|
+
}> & Partial<{
|
|
35
|
+
target: string;
|
|
36
|
+
params: string;
|
|
37
|
+
}> & Required<Pick<{
|
|
38
|
+
target: string;
|
|
39
|
+
params: string;
|
|
40
|
+
}, "target">>) | undefined), [], never, unknown, false>;
|
|
41
|
+
configurations: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Record<string, unknown> & Partial<{
|
|
42
|
+
__lifecycle: never;
|
|
43
|
+
}>) | (Partial<{
|
|
44
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
45
|
+
}> & Required<Pick<{
|
|
46
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
47
|
+
}, "__lifecycle">>), boolean>;
|
|
48
|
+
}, never, boolean, import("juniper").EmptyIndex, unknown, false>;
|
|
49
|
+
export type Target = SchemaType<typeof targetSchema>;
|
|
50
|
+
export declare const allTargetsSchema: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
|
|
51
|
+
executor: import("juniper").StringSchema<string, false>;
|
|
52
|
+
dependsOn: import("juniper").ArraySchema<(string | (Partial<{
|
|
53
|
+
projects: string | string[];
|
|
54
|
+
}> & Required<Pick<{
|
|
55
|
+
projects: string | string[];
|
|
56
|
+
}, "projects">> & Partial<{
|
|
57
|
+
target: string;
|
|
58
|
+
params: string;
|
|
59
|
+
}> & Required<Pick<{
|
|
60
|
+
target: string;
|
|
61
|
+
params: string;
|
|
62
|
+
}, "target">>) | (Partial<{
|
|
63
|
+
dependencies: boolean;
|
|
64
|
+
}> & Partial<{
|
|
65
|
+
target: string;
|
|
66
|
+
params: string;
|
|
67
|
+
}> & Required<Pick<{
|
|
68
|
+
target: string;
|
|
69
|
+
params: string;
|
|
70
|
+
}, "target">>)) & (string | (Partial<{
|
|
71
|
+
projects: string | string[];
|
|
72
|
+
}> & Required<Pick<{
|
|
73
|
+
projects: string | string[];
|
|
74
|
+
}, "projects">> & Partial<{
|
|
75
|
+
target: string;
|
|
76
|
+
params: string;
|
|
77
|
+
}> & Required<Pick<{
|
|
78
|
+
target: string;
|
|
79
|
+
params: string;
|
|
80
|
+
}, "target">>) | (Partial<{
|
|
81
|
+
dependencies: boolean;
|
|
82
|
+
}> & Partial<{
|
|
83
|
+
target: string;
|
|
84
|
+
params: string;
|
|
85
|
+
}> & Required<Pick<{
|
|
86
|
+
target: string;
|
|
87
|
+
params: string;
|
|
88
|
+
}, "target">>) | undefined), [], never, unknown, false>;
|
|
89
|
+
configurations: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Record<string, unknown> & Partial<{
|
|
90
|
+
__lifecycle: never;
|
|
91
|
+
}>) | (Partial<{
|
|
92
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
93
|
+
}> & Required<Pick<{
|
|
94
|
+
__lifecycle: import("juniper").EmptyObject;
|
|
95
|
+
}, "__lifecycle">>), boolean>;
|
|
96
|
+
}, never, boolean, import("juniper").EmptyIndex, unknown, false>, import("juniper").EmptyIndex, unknown, false>;
|
|
97
|
+
export type AllTargets = SchemaType<typeof allTargetsSchema>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=target.d.ts.map
|