nx-lifecycle 0.2.1 → 1.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.
Files changed (57) hide show
  1. package/.npmignore +20 -0
  2. package/README.md +242 -120
  3. package/WHY-NX-LIFECYCLE.md +64 -0
  4. package/dist/bin.d.ts +1 -2
  5. package/dist/bin.js +1 -14
  6. package/dist/cli.d.ts +1 -5
  7. package/dist/cli.js +9 -22
  8. package/dist/commands/explain-command.d.ts +12 -0
  9. package/dist/commands/explain-command.js +57 -0
  10. package/dist/commands/lib/types.d.ts +0 -3
  11. package/dist/commands/lifecycle-command.d.ts +2 -12
  12. package/dist/commands/lifecycle-command.js +13 -22
  13. package/dist/executors/lifecycle/index.d.ts +1 -4
  14. package/dist/executors/lifecycle/index.js +1 -8
  15. package/dist/executors/lifecycle/lifecycle.d.ts +8 -9
  16. package/dist/executors/lifecycle/lifecycle.js +13 -20
  17. package/dist/lifecycle/explain.d.ts +68 -0
  18. package/dist/lifecycle/explain.js +160 -0
  19. package/dist/lifecycle/lifecycle-internal.d.ts +4 -12
  20. package/dist/lifecycle/lifecycle-internal.js +93 -93
  21. package/dist/lifecycle/normalizer.d.ts +14 -8
  22. package/dist/lifecycle/normalizer.js +29 -36
  23. package/dist/lifecycle/processor.d.ts +41 -5
  24. package/dist/lifecycle/processor.js +36 -35
  25. package/dist/lifecycle/schema.d.ts +468 -66
  26. package/dist/lifecycle/schema.js +30 -21
  27. package/dist/plugin/index.d.ts +7 -0
  28. package/dist/plugin/index.js +4 -0
  29. package/dist/plugin/lifecycle-plugin.d.ts +24 -0
  30. package/dist/plugin/lifecycle-plugin.js +145 -0
  31. package/dist/{executors/lifecycle/index.d.cts → plugin/schema.d.ts} +32 -55
  32. package/dist/plugin/schema.js +19 -0
  33. package/dist/schemas/configurations.d.ts +5 -5
  34. package/dist/schemas/depend-on.d.ts +39 -9
  35. package/dist/schemas/depend-on.js +4 -2
  36. package/dist/schemas/empty.d.ts +2 -2
  37. package/dist/schemas/empty.js +2 -2
  38. package/dist/schemas/nx-json.d.ts +42 -20
  39. package/dist/schemas/nx-json.js +2 -4
  40. package/dist/schemas/project-json.d.ts +42 -20
  41. package/dist/schemas/project-json.js +2 -4
  42. package/dist/schemas/target.d.ts +79 -25
  43. package/executors.json +2 -2
  44. package/out/nx-executor/schema.json +148 -0
  45. package/out/schema.json +114 -0
  46. package/package.json +43 -41
  47. package/dist/commands/index.d.ts +0 -5
  48. package/dist/commands/index.js +0 -14
  49. package/dist/commands/lib/dependencies.d.ts +0 -10
  50. package/dist/commands/lib/dependencies.js +0 -12
  51. package/dist/executors/lifecycle/index.cjs +0 -15
  52. package/dist/lifecycle/depedencies.d.ts +0 -15
  53. package/dist/lifecycle/depedencies.js +0 -14
  54. package/dist/lifecycle/index.d.ts +0 -5
  55. package/dist/lifecycle/index.js +0 -25
  56. package/dist/schemas/lib/ajv.d.ts +0 -3
  57. package/dist/schemas/lib/ajv.js +0 -9
@@ -1,10 +1,10 @@
1
1
  import { arraySchema, booleanSchema, mergeSchema, objectSchema, stringSchema } from 'juniper';
2
+ import { makeValidator } from 'juniper-validator';
2
3
  import { dependsOnSchema } from '#schemas';
3
- import { ajv } from '../schemas/lib/ajv.js';
4
4
  const checkAndDryRunSchema = objectSchema({
5
5
  properties: {
6
6
  $schema: stringSchema({
7
- description: '',
7
+ description: 'Path or URL to the JSON schema for this file',
8
8
  format: 'uri-reference'
9
9
  }).example('https://raw.githubusercontent.com/JacobLey/leyman/refs/heads/main/apps/nx-lifecycle/src/lifecycle/schema.json'),
10
10
  check: booleanSchema({
@@ -15,29 +15,38 @@ const checkAndDryRunSchema = objectSchema({
15
15
  })
16
16
  }
17
17
  });
18
- const lifecycleOptionsSchema = checkAndDryRunSchema.title('lifecycle').description('Inject Nx targets as high level workflows').properties({
19
- stages: objectSchema({
20
- description: 'Lifecycle stages by name',
21
- properties: {},
22
- additionalProperties: objectSchema({
23
- properties: {
24
- dependsOn: dependsOnSchema,
25
- hooks: arraySchema(stringSchema())
26
- }
27
- })
28
- }),
29
- bindings: objectSchema({
30
- description: 'Bind targets to hooks',
31
- properties: {},
32
- additionalProperties: stringSchema({
33
- description: 'Name of hook in `stage:hook` format'
34
- })
18
+ export const stagesSchema = objectSchema({
19
+ description: 'Lifecycle stages by name',
20
+ properties: {},
21
+ additionalProperties: objectSchema({
22
+ properties: {
23
+ dependsOn: dependsOnSchema,
24
+ hooks: arraySchema(stringSchema())
25
+ }
26
+ })
27
+ });
28
+ export const bindingsSchema = objectSchema({
29
+ description: 'Bind targets to hooks',
30
+ properties: {},
31
+ additionalProperties: stringSchema({
32
+ description: 'Name of hook in `stage:hook` format'
35
33
  })
34
+ });
35
+ const lifecycleOptionsSchema = checkAndDryRunSchema.title('lifecycle').description('Inject Nx targets as high level workflows').properties({
36
+ stages: stagesSchema,
37
+ bindings: bindingsSchema
36
38
  }).required([
37
39
  'stages',
38
40
  'bindings'
39
41
  ]).additionalProperties(false);
40
- export const isLifecycleOptions = ajv.compile(lifecycleOptionsSchema.toJSON());
42
+ export const lifecycleOptions = lifecycleOptionsSchema.toJSON({
43
+ schema: true
44
+ });
45
+ export const isLifecycleOptions = makeValidator(lifecycleOptions, {
46
+ formats: {
47
+ 'uri-reference': true
48
+ }
49
+ }).is;
41
50
  const lifecycleOptionsOrConfigSchema = mergeSchema().oneOf([
42
51
  lifecycleOptionsSchema,
43
52
  checkAndDryRunSchema.properties({
@@ -45,7 +54,7 @@ const lifecycleOptionsOrConfigSchema = mergeSchema().oneOf([
45
54
  cwd: stringSchema()
46
55
  }).additionalProperties(false)
47
56
  ]);
48
- export default lifecycleOptionsOrConfigSchema.metadata({
57
+ export const lifecycleOptionsOrConfig = lifecycleOptionsOrConfigSchema.metadata({
49
58
  version: 1,
50
59
  outputCapture: 'direct-nodejs',
51
60
  cli: 'nx'
@@ -0,0 +1,7 @@
1
+ export type { LifecyclePluginOptions } from './schema.js';
2
+ /**
3
+ * Plugin name, as Nx can't attach one to an ES module.
4
+ */
5
+ export declare const name = "nx-lifecycle";
6
+ export { createDependencies, createNodes } from './lifecycle-plugin.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export const name = 'nx-lifecycle';
2
+ export { createDependencies, createNodes } from './lifecycle-plugin.js';
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,24 @@
1
+ import type { CreateDependenciesContext, CreateNodes } from '@nx/devkit';
2
+ import type { LifecyclePlan } from '../lifecycle/processor.js';
3
+ import type { LifecyclePluginOptions } from './schema.js';
4
+ /**
5
+ * Validates plugin options, with errors Nx prints, and plans the lifecycle from them.
6
+ *
7
+ * @param options - plugin options from `nx.json`
8
+ * @returns lifecycle targets and bindings
9
+ * @throws {Error} when options are invalid, or stages and bindings are inconsistent
10
+ */
11
+ export declare const planPluginOptions: (options: LifecyclePluginOptions | undefined) => LifecyclePlan;
12
+ export declare const createNodes: CreateNodes<LifecyclePluginOptions>;
13
+ /**
14
+ * Nx applies `nx.json` `targetDefaults` and `project.json` on top of inferred targets,
15
+ * replacing `dependsOn` rather than merging it.
16
+ * This runs on the merged configuration, and fails if a bound target lost its wiring.
17
+ *
18
+ * @param options - plugin options from `nx.json`
19
+ * @param context - merged project configurations
20
+ * @returns no extra dependencies
21
+ * @throws {Error} when options are invalid, or a bound target lost its wiring
22
+ */
23
+ export declare const createDependencies: (options: LifecyclePluginOptions | undefined, context: CreateDependenciesContext) => [];
24
+ //# sourceMappingURL=lifecycle-plugin.d.ts.map
@@ -0,0 +1,145 @@
1
+ import Path from 'node:path';
2
+ import { createNodesFromFiles, logger, readJsonFile } from '@nx/devkit';
3
+ import { deepEqual } from 'fast-equals';
4
+ import { assertProjectJson } from '#schemas';
5
+ import { NOOP_EXECUTOR } from '../lifecycle/constants.js';
6
+ import { planLifecycle } from '../lifecycle/processor.js';
7
+ import { assertLifecyclePluginOptions } from './schema.js';
8
+ const describeTarget = ({ kind, name, stage })=>{
9
+ if (kind === 'anchor') {
10
+ return `Start of the ${stage} stage. Waits for the dependencies of the stage`;
11
+ }
12
+ if (kind === 'hook') {
13
+ return `Runs the targets bound to ${name}`;
14
+ }
15
+ return `Runs the ${stage} stage`;
16
+ };
17
+ const normalizeDependency = (dependency)=>{
18
+ if (typeof dependency !== 'string') {
19
+ return dependency;
20
+ }
21
+ if (dependency.startsWith('^')) {
22
+ return {
23
+ target: dependency.slice(1),
24
+ dependencies: true
25
+ };
26
+ }
27
+ return {
28
+ target: dependency
29
+ };
30
+ };
31
+ const dependsOnIncludes = (dependsOn, expected)=>{
32
+ const normalizedExpected = normalizeDependency(expected);
33
+ return (dependsOn ?? []).some((dependency)=>deepEqual(normalizeDependency(dependency), normalizedExpected));
34
+ };
35
+ const validateProject = ({ targets = {} }, { lifecycleTargets, registeredTargets })=>{
36
+ const errors = [];
37
+ for (const [targetName, lifecycleTarget] of lifecycleTargets){
38
+ const target = targets[targetName];
39
+ if (target && (target.executor !== NOOP_EXECUTOR || !lifecycleTarget.dependsOn.every((dependency)=>dependsOnIncludes(target.dependsOn, dependency)))) {
40
+ errors.push(`${targetName} is inferred by nx-lifecycle, but project.json or nx.json targetDefaults override it. Remove it from there`);
41
+ }
42
+ }
43
+ for (const [targetName, lifecycleTarget] of registeredTargets){
44
+ const target = targets[targetName];
45
+ const hook = targets[lifecycleTarget.name];
46
+ if (!target) {
47
+ continue;
48
+ }
49
+ if (!hook) {
50
+ errors.push(`${targetName} is bound to ${lifecycleTarget.name}, but nx-lifecycle only adds lifecycle targets to projects with a project.json. Add one`);
51
+ } else if (!dependsOnIncludes(hook.dependsOn, targetName)) {
52
+ errors.push(`${targetName} is bound to ${lifecycleTarget.name}, but is not declared in project.json. Declare it there so nx-lifecycle can wire it`);
53
+ } else if (!dependsOnIncludes(target.dependsOn, lifecycleTarget.previousHook)) {
54
+ errors.push(`${targetName} is bound to ${lifecycleTarget.name}, so it must depend on ${lifecycleTarget.previousHook}. A dependsOn in project.json or nx.json targetDefaults replaces the inferred one, so add "${lifecycleTarget.previousHook}" to it`);
55
+ }
56
+ }
57
+ return errors;
58
+ };
59
+ export const planPluginOptions = (options)=>{
60
+ try {
61
+ assertLifecyclePluginOptions(options);
62
+ } catch (err) {
63
+ const issues = err.cause;
64
+ throw new Error([
65
+ 'Invalid nx-lifecycle plugin options in nx.json:',
66
+ ...issues.map(({ instancePath, message })=>`- options${instancePath} ${message}`)
67
+ ].join('\n'), {
68
+ cause: err
69
+ });
70
+ }
71
+ return planLifecycle(options);
72
+ };
73
+ const createProjectNode = (projectJsonPath, { lifecycleTargets, registeredTargets }, context)=>{
74
+ const projectJson = readJsonFile(Path.join(context.workspaceRoot, projectJsonPath));
75
+ assertProjectJson(projectJson);
76
+ const declaredTargets = projectJson.targets ?? {};
77
+ const targets = {};
78
+ for (const [targetName, lifecycleTarget] of lifecycleTargets){
79
+ targets[targetName] = {
80
+ executor: NOOP_EXECUTOR,
81
+ dependsOn: [
82
+ ...lifecycleTarget.dependsOn
83
+ ],
84
+ metadata: {
85
+ description: describeTarget(lifecycleTarget)
86
+ }
87
+ };
88
+ }
89
+ for (const [targetName, lifecycleTarget] of registeredTargets){
90
+ if (targetName in declaredTargets) {
91
+ targets[lifecycleTarget.name].dependsOn.push(targetName);
92
+ targets[targetName] = {
93
+ dependsOn: [
94
+ lifecycleTarget.previousHook
95
+ ]
96
+ };
97
+ }
98
+ }
99
+ return {
100
+ projects: {
101
+ [Path.dirname(projectJsonPath)]: {
102
+ targets
103
+ }
104
+ }
105
+ };
106
+ };
107
+ const createLifecycleNodes = async (projectJsonPaths, options, context)=>{
108
+ const lifecyclePlan = planPluginOptions(options);
109
+ return createNodesFromFiles((projectJsonPath)=>createProjectNode(projectJsonPath, lifecyclePlan, context), projectJsonPaths, options, context);
110
+ };
111
+ export const createNodes = [
112
+ '**/project.json',
113
+ createLifecycleNodes
114
+ ];
115
+ export const createDependencies = (options, context)=>{
116
+ const lifecyclePlan = planPluginOptions(options);
117
+ const errors = new Map();
118
+ const definedTargets = new Set();
119
+ for (const [projectName, project] of Object.entries(context.projects)){
120
+ for (const error of validateProject(project, lifecyclePlan)){
121
+ const projectNames = errors.get(error) ?? [];
122
+ projectNames.push(projectName);
123
+ errors.set(error, projectNames);
124
+ }
125
+ for (const targetName of Object.keys(project.targets ?? {})){
126
+ definedTargets.add(targetName);
127
+ }
128
+ }
129
+ if (errors.size > 0) {
130
+ throw new Error([
131
+ 'nx-lifecycle targets are not wired as configured:',
132
+ ...[
133
+ ...errors
134
+ ].map(([error, projectNames])=>`- ${error}\n Projects: ${projectNames.join(', ')}`)
135
+ ].join('\n'));
136
+ }
137
+ for (const targetName of lifecyclePlan.registeredTargets.keys()){
138
+ if (!definedTargets.has(targetName)) {
139
+ logger.warn(`Bound target ${targetName} is not defined in any project. Is it a typo?`);
140
+ }
141
+ }
142
+ return [];
143
+ };
144
+
145
+ //# sourceMappingURL=lifecycle-plugin.js.map
@@ -1,31 +1,20 @@
1
- declare const _default: import("nx-plugin-handler").RawHandler<(Partial<{
2
- $schema: string;
3
- check: boolean;
4
- dryRun: boolean;
5
- stages: Record<string, Partial<{
6
- dependsOn: ((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<{
1
+ import type { SchemaType } from 'juniper';
2
+ import type { JuniperValidator } from 'juniper-validator';
3
+ declare const lifecyclePluginOptionsSchema: import("juniper").ObjectSchema<{
4
+ stages: import("juniper").ObjectSchema<{}, never, import("juniper").ObjectSchema<{
5
+ dependsOn: import("juniper").ArraySchema<string | (Partial<{
17
6
  dependencies: boolean;
7
+ projects: never;
18
8
  }> & Partial<{
19
9
  target: string;
20
10
  params: string;
21
11
  }> & Required<Pick<{
22
12
  target: string;
23
13
  params: string;
24
- }, "target">>)) & (string | (Partial<{
25
- projects: string | string[];
26
- }> & Required<Pick<{
27
- projects: string | string[];
28
- }, "projects">> & Partial<{
14
+ }, "target">>) | (string & Partial<{
15
+ dependencies: boolean;
16
+ projects: never;
17
+ }> & Partial<{
29
18
  target: string;
30
19
  params: string;
31
20
  }> & Required<Pick<{
@@ -33,24 +22,18 @@ declare const _default: import("nx-plugin-handler").RawHandler<(Partial<{
33
22
  params: string;
34
23
  }, "target">>) | (Partial<{
35
24
  dependencies: boolean;
25
+ projects: never;
36
26
  }> & Partial<{
37
27
  target: string;
38
28
  params: string;
39
29
  }> & Required<Pick<{
40
30
  target: string;
41
31
  params: string;
42
- }, "target">>) | undefined))[];
43
- hooks: string[];
44
- }>>;
45
- bindings: Record<string, string>;
46
- }> & Required<Pick<{
47
- $schema: string;
48
- check: boolean;
49
- dryRun: boolean;
50
- stages: Record<string, Partial<{
51
- dependsOn: ((string | (Partial<{
32
+ }, "target">> & string) | (Partial<{
33
+ dependencies: never;
52
34
  projects: string | string[];
53
35
  }> & Required<Pick<{
36
+ dependencies: never;
54
37
  projects: string | string[];
55
38
  }, "projects">> & Partial<{
56
39
  target: string;
@@ -58,17 +41,11 @@ declare const _default: import("nx-plugin-handler").RawHandler<(Partial<{
58
41
  }> & Required<Pick<{
59
42
  target: string;
60
43
  params: string;
61
- }, "target">>) | (Partial<{
62
- dependencies: boolean;
63
- }> & Partial<{
64
- target: string;
65
- params: string;
66
- }> & Required<Pick<{
67
- target: string;
68
- params: string;
69
- }, "target">>)) & (string | (Partial<{
44
+ }, "target">>) | (string & Partial<{
45
+ dependencies: never;
70
46
  projects: string | string[];
71
47
  }> & Required<Pick<{
48
+ dependencies: never;
72
49
  projects: string | string[];
73
50
  }, "projects">> & Partial<{
74
51
  target: string;
@@ -77,23 +54,23 @@ declare const _default: import("nx-plugin-handler").RawHandler<(Partial<{
77
54
  target: string;
78
55
  params: string;
79
56
  }, "target">>) | (Partial<{
80
- dependencies: boolean;
81
- }> & Partial<{
57
+ dependencies: never;
58
+ projects: string | string[];
59
+ }> & Required<Pick<{
60
+ dependencies: never;
61
+ projects: string | string[];
62
+ }, "projects">> & Partial<{
82
63
  target: string;
83
64
  params: string;
84
65
  }> & Required<Pick<{
85
66
  target: string;
86
67
  params: string;
87
- }, "target">>) | undefined))[];
88
- hooks: string[];
89
- }>>;
90
- bindings: Record<string, string>;
91
- }, "stages" | "bindings">>) | Partial<{
92
- $schema: string;
93
- check: boolean;
94
- dryRun: boolean;
95
- configFile: string;
96
- cwd: string;
97
- }>>;
98
- export default _default;
99
- //# sourceMappingURL=index.d.cts.map
68
+ }, "target">> & string), [], never, unknown, false>;
69
+ hooks: import("juniper").ArraySchema<string, [], never, unknown, false>;
70
+ }, never, boolean, import("juniper").EmptyIndex, unknown, false>, import("juniper").EmptyIndex, unknown, false>;
71
+ bindings: import("juniper").ObjectSchema<{}, never, import("juniper").StringSchema<string, false>, import("juniper").EmptyIndex, unknown, false>;
72
+ }, "bindings" | "stages", false, import("juniper").EmptyIndex, unknown, false>;
73
+ export type LifecyclePluginOptions = SchemaType<typeof lifecyclePluginOptionsSchema>;
74
+ export declare const assertLifecyclePluginOptions: JuniperValidator<LifecyclePluginOptions>['assert'];
75
+ export {};
76
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { objectSchema } from 'juniper';
2
+ import { makeValidator } from 'juniper-validator';
3
+ import { bindingsSchema, stagesSchema } from '../lifecycle/schema.js';
4
+ const lifecyclePluginOptionsSchema = objectSchema({
5
+ title: 'nx-lifecycle plugin',
6
+ description: 'Infer Nx targets as high level workflows',
7
+ properties: {
8
+ stages: stagesSchema,
9
+ bindings: bindingsSchema
10
+ },
11
+ required: [
12
+ 'stages',
13
+ 'bindings'
14
+ ],
15
+ additionalProperties: false
16
+ });
17
+ export const assertLifecyclePluginOptions = makeValidator(lifecyclePluginOptionsSchema).assert;
18
+
19
+ //# sourceMappingURL=schema.js.map
@@ -1,10 +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<{
1
+ import type { SchemaType } from 'juniper';
2
+ export declare const configurationsSchema: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Partial<{
5
3
  __lifecycle: import("juniper").EmptyObject;
6
4
  }> & Required<Pick<{
7
5
  __lifecycle: import("juniper").EmptyObject;
8
- }, "__lifecycle">>), boolean>;
6
+ }, "__lifecycle">>) | (Record<string, unknown> & Partial<{
7
+ __lifecycle: never;
8
+ }>), boolean>;
9
9
  export type Configurations = SchemaType<typeof configurationsSchema>;
10
10
  //# sourceMappingURL=configurations.d.ts.map
@@ -1,20 +1,31 @@
1
- import { type SchemaType } from 'juniper';
1
+ import type { SchemaType } from 'juniper';
2
2
  declare const dependencyObject: import("juniper").ObjectSchema<{
3
3
  target: import("juniper").StringSchema<string, false>;
4
4
  params: import("juniper").EnumSchema<string>;
5
5
  }, "target", boolean, import("juniper").EmptyIndex, Partial<{
6
6
  dependencies: boolean;
7
+ projects: never;
7
8
  }> | (Partial<{
9
+ dependencies: never;
8
10
  projects: string | string[];
9
11
  }> & Required<Pick<{
12
+ dependencies: never;
10
13
  projects: string | string[];
11
14
  }, "projects">>), boolean>;
12
15
  export type DependencyObject = SchemaType<typeof dependencyObject>;
13
- export declare const dependsOnSchema: import("juniper").ArraySchema<(string | (Partial<{
14
- projects: string | string[];
16
+ export declare const dependsOnSchema: import("juniper").ArraySchema<string | (Partial<{
17
+ dependencies: boolean;
18
+ projects: never;
19
+ }> & Partial<{
20
+ target: string;
21
+ params: string;
15
22
  }> & Required<Pick<{
16
- projects: string | string[];
17
- }, "projects">> & Partial<{
23
+ target: string;
24
+ params: string;
25
+ }, "target">>) | (string & Partial<{
26
+ dependencies: boolean;
27
+ projects: never;
28
+ }> & Partial<{
18
29
  target: string;
19
30
  params: string;
20
31
  }> & Required<Pick<{
@@ -22,15 +33,30 @@ export declare const dependsOnSchema: import("juniper").ArraySchema<(string | (P
22
33
  params: string;
23
34
  }, "target">>) | (Partial<{
24
35
  dependencies: boolean;
36
+ projects: never;
25
37
  }> & Partial<{
26
38
  target: string;
27
39
  params: string;
28
40
  }> & Required<Pick<{
29
41
  target: string;
30
42
  params: string;
31
- }, "target">>)) & (string | (Partial<{
43
+ }, "target">> & string) | (Partial<{
44
+ dependencies: never;
45
+ projects: string | string[];
46
+ }> & Required<Pick<{
47
+ dependencies: never;
48
+ projects: string | string[];
49
+ }, "projects">> & Partial<{
50
+ target: string;
51
+ params: string;
52
+ }> & Required<Pick<{
53
+ target: string;
54
+ params: string;
55
+ }, "target">>) | (string & Partial<{
56
+ dependencies: never;
32
57
  projects: string | string[];
33
58
  }> & Required<Pick<{
59
+ dependencies: never;
34
60
  projects: string | string[];
35
61
  }, "projects">> & Partial<{
36
62
  target: string;
@@ -39,14 +65,18 @@ export declare const dependsOnSchema: import("juniper").ArraySchema<(string | (P
39
65
  target: string;
40
66
  params: string;
41
67
  }, "target">>) | (Partial<{
42
- dependencies: boolean;
43
- }> & Partial<{
68
+ dependencies: never;
69
+ projects: string | string[];
70
+ }> & Required<Pick<{
71
+ dependencies: never;
72
+ projects: string | string[];
73
+ }, "projects">> & Partial<{
44
74
  target: string;
45
75
  params: string;
46
76
  }> & Required<Pick<{
47
77
  target: string;
48
78
  params: string;
49
- }, "target">>) | undefined), [], never, unknown, false>;
79
+ }, "target">> & string), [], never, unknown, false>;
50
80
  export type DependsOn = SchemaType<typeof dependsOnSchema>;
51
81
  export {};
52
82
  //# sourceMappingURL=depend-on.d.ts.map
@@ -1,4 +1,4 @@
1
- import { arraySchema, booleanSchema, enumSchema, mergeSchema, objectSchema, stringSchema } from 'juniper';
1
+ import { arraySchema, booleanSchema, enumSchema, mergeSchema, neverSchema, objectSchema, stringSchema } from 'juniper';
2
2
  const dependencyObject = objectSchema({
3
3
  properties: {
4
4
  target: stringSchema(),
@@ -15,11 +15,13 @@ const dependencyObject = objectSchema({
15
15
  }).oneOf([
16
16
  objectSchema({
17
17
  properties: {
18
- dependencies: booleanSchema()
18
+ dependencies: booleanSchema(),
19
+ projects: neverSchema()
19
20
  }
20
21
  }),
21
22
  objectSchema({
22
23
  properties: {
24
+ dependencies: neverSchema(),
23
25
  projects: mergeSchema().oneOf([
24
26
  arraySchema(stringSchema()),
25
27
  stringSchema()
@@ -1,6 +1,6 @@
1
- import { type SchemaType } from 'juniper';
1
+ import type { SchemaType } from 'juniper';
2
2
  declare const emptySchema: import("juniper").ObjectSchema<{}, never, false, import("juniper").EmptyIndex, unknown, false>;
3
3
  export type Empty = SchemaType<typeof emptySchema>;
4
- export declare const isEmpty: import("ajv").ValidateFunction<import("juniper").EmptyObject>;
4
+ export declare const isEmpty: (x: unknown) => x is import("juniper").EmptyObject;
5
5
  export {};
6
6
  //# sourceMappingURL=empty.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { objectSchema } from 'juniper';
2
- import { ajv } from './lib/ajv.js';
2
+ import { makeValidator } from 'juniper-validator';
3
3
  const emptySchema = objectSchema({
4
4
  additionalProperties: false
5
5
  });
6
- export const isEmpty = ajv.compile(emptySchema.toJSON());
6
+ export const isEmpty = makeValidator(emptySchema).is;
7
7
 
8
8
  //# sourceMappingURL=empty.js.map
@@ -1,13 +1,21 @@
1
- import type { ErrorObject } from 'ajv';
2
- import { type SchemaType } from 'juniper';
1
+ import type { SchemaType } from 'juniper';
2
+ 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
- dependsOn: import("juniper").ArraySchema<(string | (Partial<{
7
- projects: string | string[];
6
+ dependsOn: import("juniper").ArraySchema<string | (Partial<{
7
+ dependencies: boolean;
8
+ projects: never;
9
+ }> & Partial<{
10
+ target: string;
11
+ params: string;
8
12
  }> & Required<Pick<{
9
- projects: string | string[];
10
- }, "projects">> & Partial<{
13
+ target: string;
14
+ params: string;
15
+ }, "target">>) | (string & Partial<{
16
+ dependencies: boolean;
17
+ projects: never;
18
+ }> & Partial<{
11
19
  target: string;
12
20
  params: string;
13
21
  }> & Required<Pick<{
@@ -15,15 +23,30 @@ declare const nxJsonSchema: import("juniper").ObjectSchema<{
15
23
  params: string;
16
24
  }, "target">>) | (Partial<{
17
25
  dependencies: boolean;
26
+ projects: never;
18
27
  }> & Partial<{
19
28
  target: string;
20
29
  params: string;
21
30
  }> & Required<Pick<{
22
31
  target: string;
23
32
  params: string;
24
- }, "target">>)) & (string | (Partial<{
33
+ }, "target">> & string) | (Partial<{
34
+ dependencies: never;
35
+ projects: string | string[];
36
+ }> & Required<Pick<{
37
+ dependencies: never;
38
+ projects: string | string[];
39
+ }, "projects">> & Partial<{
40
+ target: string;
41
+ params: string;
42
+ }> & Required<Pick<{
43
+ target: string;
44
+ params: string;
45
+ }, "target">>) | (string & Partial<{
46
+ dependencies: never;
25
47
  projects: string | string[];
26
48
  }> & Required<Pick<{
49
+ dependencies: never;
27
50
  projects: string | string[];
28
51
  }, "projects">> & Partial<{
29
52
  target: string;
@@ -32,29 +55,28 @@ declare const nxJsonSchema: import("juniper").ObjectSchema<{
32
55
  target: string;
33
56
  params: string;
34
57
  }, "target">>) | (Partial<{
35
- dependencies: boolean;
36
- }> & Partial<{
58
+ dependencies: never;
59
+ projects: string | string[];
60
+ }> & Required<Pick<{
61
+ dependencies: never;
62
+ projects: string | string[];
63
+ }, "projects">> & Partial<{
37
64
  target: string;
38
65
  params: string;
39
66
  }> & Required<Pick<{
40
67
  target: string;
41
68
  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<{
69
+ }, "target">> & string), [], never, unknown, false>;
70
+ configurations: import("juniper").ObjectSchema<{}, never, boolean, import("juniper").EmptyIndex, (Partial<{
46
71
  __lifecycle: import("juniper").EmptyObject;
47
72
  }> & Required<Pick<{
48
73
  __lifecycle: import("juniper").EmptyObject;
49
- }, "__lifecycle">>), boolean>;
74
+ }, "__lifecycle">>) | (Record<string, unknown> & Partial<{
75
+ __lifecycle: never;
76
+ }>), boolean>;
50
77
  }, never, boolean, import("juniper").EmptyIndex, unknown, false>, import("juniper").EmptyIndex, unknown, false>;
51
78
  }, never, true, import("juniper").EmptyIndex, unknown, false>;
52
79
  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>;
80
+ export declare const assertNxJson: JuniperValidator<NxJson>['assert'];
59
81
  export {};
60
82
  //# sourceMappingURL=nx-json.d.ts.map