nx-lifecycle 0.2.0 → 1.0.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 (53) hide show
  1. package/.npmignore +20 -0
  2. package/README.md +203 -119
  3. package/WHY-NX-LIFECYCLE.md +64 -0
  4. package/dist/bin.d.ts +603 -0
  5. package/dist/bin.js +3 -2
  6. package/dist/cli.d.ts +1 -1
  7. package/dist/commands/index.d.ts +752 -2
  8. package/dist/commands/lib/dependencies.d.ts +7 -7
  9. package/dist/commands/lib/dependencies.js +1 -1
  10. package/dist/commands/lifecycle-command.d.ts +1 -1
  11. package/dist/executors/lifecycle/container.d.ts +603 -0
  12. package/dist/executors/lifecycle/container.js +8 -0
  13. package/dist/executors/lifecycle/index.js +2 -6
  14. package/dist/lifecycle/dependencies.d.ts +16 -0
  15. package/dist/lifecycle/{depedencies.js → dependencies.js} +1 -1
  16. package/dist/lifecycle/index.d.ts +754 -3
  17. package/dist/lifecycle/index.js +5 -5
  18. package/dist/lifecycle/lifecycle-internal.d.ts +3 -3
  19. package/dist/lifecycle/lifecycle-internal.js +26 -9
  20. package/dist/lifecycle/normalizer.d.ts +1 -1
  21. package/dist/lifecycle/processor.d.ts +41 -3
  22. package/dist/lifecycle/processor.js +36 -33
  23. package/dist/lifecycle/schema.d.ts +468 -66
  24. package/dist/lifecycle/schema.js +31 -22
  25. package/dist/plugin/container.d.ts +855 -0
  26. package/dist/plugin/container.js +13 -0
  27. package/dist/plugin/dependencies.d.ts +860 -0
  28. package/dist/plugin/dependencies.js +9 -0
  29. package/dist/plugin/index.d.ts +283 -0
  30. package/dist/plugin/index.js +6 -0
  31. package/dist/plugin/lifecycle-plugin.d.ts +21 -0
  32. package/dist/plugin/lifecycle-plugin.js +158 -0
  33. package/dist/plugin/schema.d.ts +353 -0
  34. package/dist/plugin/schema.js +21 -0
  35. package/dist/schemas/configurations.d.ts +5 -5
  36. package/dist/schemas/depend-on.d.ts +39 -9
  37. package/dist/schemas/depend-on.js +4 -2
  38. package/dist/schemas/empty.d.ts +2 -2
  39. package/dist/schemas/empty.js +2 -2
  40. package/dist/schemas/nx-json.d.ts +191 -18
  41. package/dist/schemas/nx-json.js +3 -3
  42. package/dist/schemas/project-json.d.ts +191 -18
  43. package/dist/schemas/project-json.js +3 -3
  44. package/dist/schemas/target.d.ts +79 -25
  45. package/executors.json +2 -2
  46. package/out/nx-executor/schema.json +148 -0
  47. package/out/schema.json +114 -0
  48. package/package.json +39 -40
  49. package/dist/executors/lifecycle/index.cjs +0 -15
  50. package/dist/executors/lifecycle/index.d.cts +0 -99
  51. package/dist/lifecycle/depedencies.d.ts +0 -15
  52. package/dist/schemas/lib/ajv.d.ts +0 -3
  53. package/dist/schemas/lib/ajv.js +0 -11
@@ -1,11 +1,11 @@
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: '',
8
- format: 'uri'
7
+ description: 'Path or URL to the JSON schema for this file',
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({
11
11
  description: 'Fails if references are not already updated, will not overwrite. Defaults to true during CI, false otherwise.'
@@ -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'