@angeloashmore/prismic-cli-poc 0.0.0-canary.5fed593 → 0.0.0-canary.63deeeb

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 (65) hide show
  1. package/dist/index.mjs +274 -412
  2. package/package.json +1 -1
  3. package/src/custom-type-add-field-boolean.ts +9 -12
  4. package/src/custom-type-add-field-color.ts +10 -12
  5. package/src/custom-type-add-field-date.ts +10 -12
  6. package/src/custom-type-add-field-embed.ts +10 -12
  7. package/src/custom-type-add-field-geo-point.ts +10 -12
  8. package/src/custom-type-add-field-image.ts +10 -12
  9. package/src/custom-type-add-field-key-text.ts +10 -12
  10. package/src/custom-type-add-field-link.ts +9 -12
  11. package/src/custom-type-add-field-number.ts +10 -12
  12. package/src/custom-type-add-field-rich-text.ts +9 -12
  13. package/src/custom-type-add-field-select.ts +9 -12
  14. package/src/custom-type-add-field-timestamp.ts +10 -12
  15. package/src/custom-type-add-field-uid.ts +10 -12
  16. package/src/custom-type-connect-slice.ts +6 -12
  17. package/src/custom-type-create.ts +17 -13
  18. package/src/custom-type-disconnect-slice.ts +6 -12
  19. package/src/custom-type-remove-field.ts +6 -12
  20. package/src/custom-type-remove.ts +6 -12
  21. package/src/custom-type-set-name.ts +6 -12
  22. package/src/docs.ts +149 -0
  23. package/src/index.ts +10 -0
  24. package/src/lib/auth.ts +24 -1
  25. package/src/lib/framework.ts +143 -0
  26. package/src/page-type-add-field-boolean.ts +9 -12
  27. package/src/page-type-add-field-color.ts +10 -12
  28. package/src/page-type-add-field-date.ts +10 -12
  29. package/src/page-type-add-field-embed.ts +10 -12
  30. package/src/page-type-add-field-geo-point.ts +10 -12
  31. package/src/page-type-add-field-image.ts +10 -12
  32. package/src/page-type-add-field-key-text.ts +10 -12
  33. package/src/page-type-add-field-link.ts +9 -12
  34. package/src/page-type-add-field-number.ts +10 -12
  35. package/src/page-type-add-field-rich-text.ts +9 -12
  36. package/src/page-type-add-field-select.ts +9 -12
  37. package/src/page-type-add-field-timestamp.ts +10 -12
  38. package/src/page-type-add-field-uid.ts +10 -12
  39. package/src/page-type-connect-slice.ts +6 -12
  40. package/src/page-type-create.ts +41 -14
  41. package/src/page-type-disconnect-slice.ts +6 -12
  42. package/src/page-type-remove-field.ts +6 -12
  43. package/src/page-type-remove.ts +6 -12
  44. package/src/page-type-set-name.ts +6 -12
  45. package/src/page-type-set-repeatable.ts +6 -12
  46. package/src/pull.ts +1 -6
  47. package/src/slice-add-field-boolean.ts +9 -12
  48. package/src/slice-add-field-color.ts +10 -12
  49. package/src/slice-add-field-date.ts +10 -12
  50. package/src/slice-add-field-embed.ts +10 -12
  51. package/src/slice-add-field-geo-point.ts +10 -12
  52. package/src/slice-add-field-image.ts +10 -12
  53. package/src/slice-add-field-key-text.ts +10 -12
  54. package/src/slice-add-field-link.ts +9 -12
  55. package/src/slice-add-field-number.ts +10 -12
  56. package/src/slice-add-field-rich-text.ts +9 -12
  57. package/src/slice-add-field-select.ts +9 -12
  58. package/src/slice-add-field-timestamp.ts +10 -12
  59. package/src/slice-add-variation.ts +6 -12
  60. package/src/slice-create.ts +9 -12
  61. package/src/slice-remove-field.ts +6 -12
  62. package/src/slice-remove-variation.ts +6 -12
  63. package/src/slice-remove.ts +6 -12
  64. package/src/slice-rename.ts +6 -12
  65. package/src/status.ts +770 -0
@@ -17,13 +17,10 @@ ARGUMENTS
17
17
  slice-id Slice identifier (required)
18
18
  variation-id New variation identifier (required)
19
19
 
20
- Types are generated by default after changes. Use --no-types to skip.
21
-
22
20
  FLAGS
23
21
  --name string Display name for the variation
24
22
  --copy-from string Copy fields from an existing variation
25
23
  --types string Output file for generated types (default: "prismicio-types.d.ts")
26
- --no-types Skip type generation
27
24
  -h, --help Show help for command
28
25
 
29
26
  EXAMPLES
@@ -34,7 +31,7 @@ EXAMPLES
34
31
 
35
32
  export async function sliceAddVariation(): Promise<void> {
36
33
  const {
37
- values: { help, name, "copy-from": copyFrom, types, "no-types": noTypes },
34
+ values: { help, name, "copy-from": copyFrom, types },
38
35
  positionals: [sliceId, variationId],
39
36
  } = parseArgs({
40
37
  args: process.argv.slice(4), // skip: node, script, "slice", "add-variation"
@@ -42,7 +39,6 @@ export async function sliceAddVariation(): Promise<void> {
42
39
  name: { type: "string" },
43
40
  "copy-from": { type: "string" },
44
41
  types: { type: "string" },
45
- "no-types": { type: "boolean" },
46
42
  help: { type: "boolean", short: "h" },
47
43
  },
48
44
  allowPositionals: true,
@@ -134,12 +130,10 @@ export async function sliceAddVariation(): Promise<void> {
134
130
 
135
131
  console.info(`Added variation "${variationId}" to slice "${sliceId}"`);
136
132
 
137
- if (!noTypes) {
138
- try {
139
- await buildTypes({ output: types });
140
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
141
- } catch (error) {
142
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
143
- }
133
+ try {
134
+ await buildTypes({ output: types });
135
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
136
+ } catch (error) {
137
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
144
138
  }
145
139
  }
@@ -17,12 +17,9 @@ USAGE
17
17
  ARGUMENTS
18
18
  id Slice identifier (required)
19
19
 
20
- Types are generated by default after changes. Use --no-types to skip.
21
-
22
20
  FLAGS
23
21
  -n, --name string Display name for the slice
24
22
  --types string Output file for generated types (default: "prismicio-types.d.ts")
25
- --no-types Skip type generation
26
23
  -h, --help Show help for command
27
24
 
28
25
  LEARN MORE
@@ -31,14 +28,13 @@ LEARN MORE
31
28
 
32
29
  export async function sliceCreate(): Promise<void> {
33
30
  const {
34
- values: { help, name, types, "no-types": noTypes },
31
+ values: { help, name, types },
35
32
  positionals: [id],
36
33
  } = parseArgs({
37
34
  args: process.argv.slice(4), // skip: node, script, "slice", "create"
38
35
  options: {
39
36
  name: { type: "string", short: "n" },
40
37
  types: { type: "string" },
41
- "no-types": { type: "boolean" },
42
38
  help: { type: "boolean", short: "h" },
43
39
  },
44
40
  allowPositionals: true,
@@ -93,14 +89,15 @@ export async function sliceCreate(): Promise<void> {
93
89
 
94
90
  console.info(`Created slice at ${modelPath.href}`);
95
91
 
96
- if (!noTypes) {
97
- try {
98
- await buildTypes({ output: types });
99
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
100
- } catch (error) {
101
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
102
- }
92
+ try {
93
+ await buildTypes({ output: types });
94
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
95
+ } catch (error) {
96
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
103
97
  }
98
+
99
+ console.info();
100
+ console.info("Next: Add fields with `prismic slice add-field`");
104
101
  }
105
102
 
106
103
  async function getSlicesDirectory(): Promise<URL> {
@@ -15,13 +15,10 @@ ARGUMENTS
15
15
  slice-id Slice identifier (required)
16
16
  field-id Field identifier (required)
17
17
 
18
- Types are generated by default after changes. Use --no-types to skip.
19
-
20
18
  FLAGS
21
19
  --variation string Target variation (default: "default")
22
20
  --zone string Field zone: "primary" or "items" (default: "primary")
23
21
  --types string Output file for generated types (default: "prismicio-types.d.ts")
24
- --no-types Skip type generation
25
22
  -h, --help Show help for command
26
23
 
27
24
  EXAMPLES
@@ -32,7 +29,7 @@ EXAMPLES
32
29
 
33
30
  export async function sliceRemoveField(): Promise<void> {
34
31
  const {
35
- values: { help, variation, zone, types, "no-types": noTypes },
32
+ values: { help, variation, zone, types },
36
33
  positionals: [sliceId, fieldId],
37
34
  } = parseArgs({
38
35
  args: process.argv.slice(4), // skip: node, script, "slice", "remove-field"
@@ -40,7 +37,6 @@ export async function sliceRemoveField(): Promise<void> {
40
37
  variation: { type: "string", default: "default" },
41
38
  zone: { type: "string", default: "primary" },
42
39
  types: { type: "string" },
43
- "no-types": { type: "boolean" },
44
40
  help: { type: "boolean", short: "h" },
45
41
  },
46
42
  allowPositionals: true,
@@ -117,12 +113,10 @@ export async function sliceRemoveField(): Promise<void> {
117
113
  `Removed field "${fieldId}" from ${zone} zone in variation "${variation}" of slice "${sliceId}"`,
118
114
  );
119
115
 
120
- if (!noTypes) {
121
- try {
122
- await buildTypes({ output: types });
123
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
124
- } catch (error) {
125
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
126
- }
116
+ try {
117
+ await buildTypes({ output: types });
118
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
119
+ } catch (error) {
120
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
127
121
  }
128
122
  }
@@ -17,11 +17,8 @@ ARGUMENTS
17
17
  slice-id Slice identifier (required)
18
18
  variation-id Variation to remove (required)
19
19
 
20
- Types are generated by default after changes. Use --no-types to skip.
21
-
22
20
  FLAGS
23
21
  --types string Output file for generated types (default: "prismicio-types.d.ts")
24
- --no-types Skip type generation
25
22
  -h, --help Show help for command
26
23
 
27
24
  EXAMPLES
@@ -30,13 +27,12 @@ EXAMPLES
30
27
 
31
28
  export async function sliceRemoveVariation(): Promise<void> {
32
29
  const {
33
- values: { help, types, "no-types": noTypes },
30
+ values: { help, types },
34
31
  positionals: [sliceId, variationId],
35
32
  } = parseArgs({
36
33
  args: process.argv.slice(4), // skip: node, script, "slice", "remove-variation"
37
34
  options: {
38
35
  types: { type: "string" },
39
- "no-types": { type: "boolean" },
40
36
  help: { type: "boolean", short: "h" },
41
37
  },
42
38
  allowPositionals: true,
@@ -107,12 +103,10 @@ export async function sliceRemoveVariation(): Promise<void> {
107
103
 
108
104
  console.info(`Removed variation "${variationId}" from slice "${sliceId}"`);
109
105
 
110
- if (!noTypes) {
111
- try {
112
- await buildTypes({ output: types });
113
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
114
- } catch (error) {
115
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
116
- }
106
+ try {
107
+ await buildTypes({ output: types });
108
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
109
+ } catch (error) {
110
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
117
111
  }
118
112
  }
@@ -13,12 +13,9 @@ USAGE
13
13
  ARGUMENTS
14
14
  slice-id Slice identifier (required)
15
15
 
16
- Types are generated by default after changes. Use --no-types to skip.
17
-
18
16
  FLAGS
19
17
  -y Confirm removal
20
18
  --types string Output file for generated types (default: "prismicio-types.d.ts")
21
- --no-types Skip type generation
22
19
  -h, --help Show help for command
23
20
 
24
21
  EXAMPLES
@@ -28,14 +25,13 @@ EXAMPLES
28
25
 
29
26
  export async function sliceRemove(): Promise<void> {
30
27
  const {
31
- values: { help, y, types, "no-types": noTypes },
28
+ values: { help, y, types },
32
29
  positionals: [sliceId],
33
30
  } = parseArgs({
34
31
  args: process.argv.slice(4), // skip: node, script, "slice", "remove"
35
32
  options: {
36
33
  y: { type: "boolean", short: "y" },
37
34
  types: { type: "string" },
38
- "no-types": { type: "boolean" },
39
35
  help: { type: "boolean", short: "h" },
40
36
  },
41
37
  allowPositionals: true,
@@ -86,12 +82,10 @@ export async function sliceRemove(): Promise<void> {
86
82
 
87
83
  console.info(`Removed slice "${sliceId}"`);
88
84
 
89
- if (!noTypes) {
90
- try {
91
- await buildTypes({ output: types });
92
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
93
- } catch (error) {
94
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
95
- }
85
+ try {
86
+ await buildTypes({ output: types });
87
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
88
+ } catch (error) {
89
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
96
90
  }
97
91
  }
@@ -15,12 +15,9 @@ ARGUMENTS
15
15
  slice-id Current slice identifier (required)
16
16
  new-name New display name (required)
17
17
 
18
- Types are generated by default after changes. Use --no-types to skip.
19
-
20
18
  FLAGS
21
19
  --id string Also change the slice ID (renames directory)
22
20
  --types string Output file for generated types (default: "prismicio-types.d.ts")
23
- --no-types Skip type generation
24
21
  -h, --help Show help for command
25
22
 
26
23
  EXAMPLES
@@ -30,14 +27,13 @@ EXAMPLES
30
27
 
31
28
  export async function sliceRename(): Promise<void> {
32
29
  const {
33
- values: { help, id: newId, types, "no-types": noTypes },
30
+ values: { help, id: newId, types },
34
31
  positionals: [sliceId, newName],
35
32
  } = parseArgs({
36
33
  args: process.argv.slice(4), // skip: node, script, "slice", "rename"
37
34
  options: {
38
35
  id: { type: "string" },
39
36
  types: { type: "string" },
40
- "no-types": { type: "boolean" },
41
37
  help: { type: "boolean", short: "h" },
42
38
  },
43
39
  allowPositionals: true,
@@ -117,12 +113,10 @@ export async function sliceRename(): Promise<void> {
117
113
  console.info(`Renamed slice "${sliceId}" to "${newName}"`);
118
114
  }
119
115
 
120
- if (!noTypes) {
121
- try {
122
- await buildTypes({ output: types });
123
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
124
- } catch (error) {
125
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
126
- }
116
+ try {
117
+ await buildTypes({ output: types });
118
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
119
+ } catch (error) {
120
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
127
121
  }
128
122
  }