@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
@@ -0,0 +1,143 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import * as v from "valibot";
3
+
4
+ import { exists, findUpward } from "./file";
5
+
6
+ export type Framework = "next" | "nuxt" | "sveltekit";
7
+
8
+ export type FrameworkInfo = {
9
+ framework: Framework | undefined;
10
+ hasSrcDir: boolean;
11
+ projectRoot: URL;
12
+ };
13
+
14
+ const PackageJsonSchema = v.object({
15
+ dependencies: v.optional(v.record(v.string(), v.string())),
16
+ devDependencies: v.optional(v.record(v.string(), v.string())),
17
+ });
18
+
19
+ export async function detectFrameworkInfo(): Promise<FrameworkInfo | undefined> {
20
+ const packageJsonPath = await findUpward("package.json");
21
+ if (!packageJsonPath) return undefined;
22
+
23
+ const projectRoot = new URL(".", packageJsonPath);
24
+
25
+ let framework: Framework | undefined;
26
+ try {
27
+ const contents = await readFile(packageJsonPath, "utf8");
28
+ const { dependencies = {}, devDependencies = {} } = v.parse(
29
+ PackageJsonSchema,
30
+ JSON.parse(contents),
31
+ );
32
+ const allDeps = { ...dependencies, ...devDependencies };
33
+ if ("next" in allDeps) framework = "next";
34
+ else if ("nuxt" in allDeps) framework = "nuxt";
35
+ else if ("@sveltejs/kit" in allDeps) framework = "sveltekit";
36
+ } catch {
37
+ // Continue with undefined framework
38
+ }
39
+
40
+ let hasSrcDir = false;
41
+ if (framework === "next" || framework === "sveltekit") {
42
+ hasSrcDir = await exists(new URL("src/", projectRoot));
43
+ } else if (framework === "nuxt") {
44
+ hasSrcDir = await exists(new URL("app/", projectRoot));
45
+ }
46
+
47
+ return { framework, hasSrcDir, projectRoot };
48
+ }
49
+
50
+ export function getRequiredDependencies(framework: Framework | undefined): string[] {
51
+ switch (framework) {
52
+ case "next":
53
+ return ["@prismicio/client", "@prismicio/react", "@prismicio/next"];
54
+ case "nuxt":
55
+ return ["@nuxtjs/prismic"];
56
+ case "sveltekit":
57
+ return ["@prismicio/client", "@prismicio/svelte"];
58
+ default:
59
+ return ["@prismicio/client"];
60
+ }
61
+ }
62
+
63
+ export function getClientFilePath(info: FrameworkInfo): string | null {
64
+ switch (info.framework) {
65
+ case "next":
66
+ return info.hasSrcDir ? "src/prismicio.ts" : "prismicio.ts";
67
+ case "nuxt":
68
+ return null; // Nuxt uses nuxt.config.ts instead
69
+ case "sveltekit":
70
+ return "src/lib/prismicio.ts";
71
+ default:
72
+ return "prismicio.ts";
73
+ }
74
+ }
75
+
76
+ export function getSlicesDirectory(info: FrameworkInfo): string {
77
+ switch (info.framework) {
78
+ case "next":
79
+ return info.hasSrcDir ? "src/slices/" : "slices/";
80
+ case "nuxt":
81
+ return info.hasSrcDir ? "app/slices/" : "slices/";
82
+ case "sveltekit":
83
+ return "src/lib/slices/";
84
+ default:
85
+ return "slices/";
86
+ }
87
+ }
88
+
89
+ export function getSliceComponentExtensions(framework: Framework | undefined): string[] {
90
+ switch (framework) {
91
+ case "next":
92
+ return [".tsx", ".ts", ".jsx", ".js"];
93
+ case "nuxt":
94
+ return [".vue"];
95
+ case "sveltekit":
96
+ return [".svelte"];
97
+ default:
98
+ return [".tsx", ".ts", ".jsx", ".js"];
99
+ }
100
+ }
101
+
102
+ export function getRoutePath(
103
+ info: FrameworkInfo,
104
+ route: string,
105
+ ): { path: string; extensions: string[] } | null {
106
+ switch (info.framework) {
107
+ case "next": {
108
+ const base = info.hasSrcDir ? "src/app" : "app";
109
+ if (route === "/slice-simulator") {
110
+ return { path: `${base}/slice-simulator/page`, extensions: [".tsx", ".ts", ".jsx", ".js"] };
111
+ }
112
+ if (route === "/api/preview") {
113
+ return { path: `${base}/api/preview/route`, extensions: [".ts", ".js"] };
114
+ }
115
+ if (route === "/api/exit-preview") {
116
+ return { path: `${base}/api/exit-preview/route`, extensions: [".ts", ".js"] };
117
+ }
118
+ if (route === "/api/revalidate") {
119
+ return { path: `${base}/api/revalidate/route`, extensions: [".ts", ".js"] };
120
+ }
121
+ return null;
122
+ }
123
+ case "nuxt": {
124
+ if (route === "/slice-simulator") {
125
+ return { path: "pages/slice-simulator", extensions: [".vue"] };
126
+ }
127
+ // Preview endpoints are built-in for Nuxt
128
+ return null;
129
+ }
130
+ case "sveltekit": {
131
+ if (route === "/slice-simulator") {
132
+ return { path: "src/routes/slice-simulator/+page", extensions: [".svelte"] };
133
+ }
134
+ if (route === "/api/preview") {
135
+ return { path: "src/routes/api/preview/+server", extensions: [".ts", ".js"] };
136
+ }
137
+ // exit-preview not required for SvelteKit
138
+ return null;
139
+ }
140
+ default:
141
+ return null;
142
+ }
143
+ }
@@ -19,8 +19,6 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -28,7 +26,6 @@ FLAGS
28
26
  --true-label string Label shown when toggle is on
29
27
  --false-label string Label shown when toggle is off
30
28
  --types string Output file for generated types (default: "prismicio-types.d.ts")
31
- --no-types Skip type generation
32
29
  -h, --help Show help for command
33
30
 
34
31
  EXAMPLES
@@ -56,7 +53,6 @@ export async function pageTypeAddFieldBoolean(): Promise<void> {
56
53
  "true-label": trueLabel,
57
54
  "false-label": falseLabel,
58
55
  types,
59
- "no-types": noTypes,
60
56
  },
61
57
  positionals: [typeId, fieldId],
62
58
  } = parseArgs({
@@ -68,7 +64,6 @@ export async function pageTypeAddFieldBoolean(): Promise<void> {
68
64
  "true-label": { type: "string" },
69
65
  "false-label": { type: "string" },
70
66
  types: { type: "string" },
71
- "no-types": { type: "boolean" },
72
67
  help: { type: "boolean", short: "h" },
73
68
  },
74
69
  allowPositionals: true,
@@ -177,12 +172,14 @@ export async function pageTypeAddFieldBoolean(): Promise<void> {
177
172
 
178
173
  console.info(`Added field "${fieldId}" (Boolean) to "${targetTab}" tab in ${typeId}`);
179
174
 
180
- if (!noTypes) {
181
- try {
182
- await buildTypes({ output: types });
183
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
184
- } catch (error) {
185
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
186
- }
175
+ try {
176
+ await buildTypes({ output: types });
177
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
178
+ } catch (error) {
179
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
187
180
  }
181
+
182
+ console.info();
183
+ console.info("Next: Add more fields with `prismic page-type add-field`");
184
+ console.info(" Run `prismic status` when done to find next steps");
188
185
  }
@@ -19,14 +19,11 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  -p, --placeholder string Placeholder text
28
26
  --types string Output file for generated types (default: "prismicio-types.d.ts")
29
- --no-types Skip type generation
30
27
  -h, --help Show help for command
31
28
 
32
29
  EXAMPLES
@@ -46,7 +43,7 @@ const CustomTypeSchema = v.object({
46
43
 
47
44
  export async function pageTypeAddFieldColor(): Promise<void> {
48
45
  const {
49
- values: { help, tab, label, placeholder, types, "no-types": noTypes },
46
+ values: { help, tab, label, placeholder, types },
50
47
  positionals: [typeId, fieldId],
51
48
  } = parseArgs({
52
49
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "color"
@@ -55,7 +52,6 @@ export async function pageTypeAddFieldColor(): Promise<void> {
55
52
  label: { type: "string", short: "l" },
56
53
  placeholder: { type: "string", short: "p" },
57
54
  types: { type: "string" },
58
- "no-types": { type: "boolean" },
59
55
  help: { type: "boolean", short: "h" },
60
56
  },
61
57
  allowPositionals: true,
@@ -162,12 +158,14 @@ export async function pageTypeAddFieldColor(): Promise<void> {
162
158
 
163
159
  console.info(`Added field "${fieldId}" (Color) to "${targetTab}" tab in ${typeId}`);
164
160
 
165
- if (!noTypes) {
166
- try {
167
- await buildTypes({ output: types });
168
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
169
- } catch (error) {
170
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
171
- }
161
+ try {
162
+ await buildTypes({ output: types });
163
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
164
+ } catch (error) {
165
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
172
166
  }
167
+
168
+ console.info();
169
+ console.info("Next: Add more fields with `prismic page-type add-field`");
170
+ console.info(" Run `prismic status` when done to find next steps");
173
171
  }
@@ -19,15 +19,12 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  -p, --placeholder string Placeholder text
28
26
  --default string Default date value (YYYY-MM-DD format)
29
27
  --types string Output file for generated types (default: "prismicio-types.d.ts")
30
- --no-types Skip type generation
31
28
  -h, --help Show help for command
32
29
 
33
30
  EXAMPLES
@@ -47,7 +44,7 @@ const CustomTypeSchema = v.object({
47
44
 
48
45
  export async function pageTypeAddFieldDate(): Promise<void> {
49
46
  const {
50
- values: { help, tab, label, placeholder, default: defaultValue, types, "no-types": noTypes },
47
+ values: { help, tab, label, placeholder, default: defaultValue, types },
51
48
  positionals: [typeId, fieldId],
52
49
  } = parseArgs({
53
50
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "date"
@@ -57,7 +54,6 @@ export async function pageTypeAddFieldDate(): Promise<void> {
57
54
  placeholder: { type: "string", short: "p" },
58
55
  default: { type: "string" },
59
56
  types: { type: "string" },
60
- "no-types": { type: "boolean" },
61
57
  help: { type: "boolean", short: "h" },
62
58
  },
63
59
  allowPositionals: true,
@@ -165,12 +161,14 @@ export async function pageTypeAddFieldDate(): Promise<void> {
165
161
 
166
162
  console.info(`Added field "${fieldId}" (Date) to "${targetTab}" tab in ${typeId}`);
167
163
 
168
- if (!noTypes) {
169
- try {
170
- await buildTypes({ output: types });
171
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
172
- } catch (error) {
173
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
174
- }
164
+ try {
165
+ await buildTypes({ output: types });
166
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
167
+ } catch (error) {
168
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
175
169
  }
170
+
171
+ console.info();
172
+ console.info("Next: Add more fields with `prismic page-type add-field`");
173
+ console.info(" Run `prismic status` when done to find next steps");
176
174
  }
@@ -19,14 +19,11 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  -p, --placeholder string Placeholder text
28
26
  --types string Output file for generated types (default: "prismicio-types.d.ts")
29
- --no-types Skip type generation
30
27
  -h, --help Show help for command
31
28
 
32
29
  EXAMPLES
@@ -46,7 +43,7 @@ const CustomTypeSchema = v.object({
46
43
 
47
44
  export async function pageTypeAddFieldEmbed(): Promise<void> {
48
45
  const {
49
- values: { help, tab, label, placeholder, types, "no-types": noTypes },
46
+ values: { help, tab, label, placeholder, types },
50
47
  positionals: [typeId, fieldId],
51
48
  } = parseArgs({
52
49
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "embed"
@@ -55,7 +52,6 @@ export async function pageTypeAddFieldEmbed(): Promise<void> {
55
52
  label: { type: "string", short: "l" },
56
53
  placeholder: { type: "string", short: "p" },
57
54
  types: { type: "string" },
58
- "no-types": { type: "boolean" },
59
55
  help: { type: "boolean", short: "h" },
60
56
  },
61
57
  allowPositionals: true,
@@ -162,12 +158,14 @@ export async function pageTypeAddFieldEmbed(): Promise<void> {
162
158
 
163
159
  console.info(`Added field "${fieldId}" (Embed) to "${targetTab}" tab in ${typeId}`);
164
160
 
165
- if (!noTypes) {
166
- try {
167
- await buildTypes({ output: types });
168
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
169
- } catch (error) {
170
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
171
- }
161
+ try {
162
+ await buildTypes({ output: types });
163
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
164
+ } catch (error) {
165
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
172
166
  }
167
+
168
+ console.info();
169
+ console.info("Next: Add more fields with `prismic page-type add-field`");
170
+ console.info(" Run `prismic status` when done to find next steps");
173
171
  }
@@ -19,13 +19,10 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  --types string Output file for generated types (default: "prismicio-types.d.ts")
28
- --no-types Skip type generation
29
26
  -h, --help Show help for command
30
27
 
31
28
  EXAMPLES
@@ -45,7 +42,7 @@ const CustomTypeSchema = v.object({
45
42
 
46
43
  export async function pageTypeAddFieldGeoPoint(): Promise<void> {
47
44
  const {
48
- values: { help, tab, label, types, "no-types": noTypes },
45
+ values: { help, tab, label, types },
49
46
  positionals: [typeId, fieldId],
50
47
  } = parseArgs({
51
48
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "geo-point"
@@ -53,7 +50,6 @@ export async function pageTypeAddFieldGeoPoint(): Promise<void> {
53
50
  tab: { type: "string", short: "t" },
54
51
  label: { type: "string", short: "l" },
55
52
  types: { type: "string" },
56
- "no-types": { type: "boolean" },
57
53
  help: { type: "boolean", short: "h" },
58
54
  },
59
55
  allowPositionals: true,
@@ -159,12 +155,14 @@ export async function pageTypeAddFieldGeoPoint(): Promise<void> {
159
155
 
160
156
  console.info(`Added field "${fieldId}" (GeoPoint) to "${targetTab}" tab in ${typeId}`);
161
157
 
162
- if (!noTypes) {
163
- try {
164
- await buildTypes({ output: types });
165
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
166
- } catch (error) {
167
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
168
- }
158
+ try {
159
+ await buildTypes({ output: types });
160
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
161
+ } catch (error) {
162
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
169
163
  }
164
+
165
+ console.info();
166
+ console.info("Next: Add more fields with `prismic page-type add-field`");
167
+ console.info(" Run `prismic status` when done to find next steps");
170
168
  }
@@ -19,14 +19,11 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  -p, --placeholder string Placeholder text
28
26
  --types string Output file for generated types (default: "prismicio-types.d.ts")
29
- --no-types Skip type generation
30
27
  -h, --help Show help for command
31
28
 
32
29
  EXAMPLES
@@ -46,7 +43,7 @@ const CustomTypeSchema = v.object({
46
43
 
47
44
  export async function pageTypeAddFieldImage(): Promise<void> {
48
45
  const {
49
- values: { help, tab, label, placeholder, types, "no-types": noTypes },
46
+ values: { help, tab, label, placeholder, types },
50
47
  positionals: [typeId, fieldId],
51
48
  } = parseArgs({
52
49
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "image"
@@ -55,7 +52,6 @@ export async function pageTypeAddFieldImage(): Promise<void> {
55
52
  label: { type: "string", short: "l" },
56
53
  placeholder: { type: "string", short: "p" },
57
54
  types: { type: "string" },
58
- "no-types": { type: "boolean" },
59
55
  help: { type: "boolean", short: "h" },
60
56
  },
61
57
  allowPositionals: true,
@@ -162,12 +158,14 @@ export async function pageTypeAddFieldImage(): Promise<void> {
162
158
 
163
159
  console.info(`Added field "${fieldId}" (Image) to "${targetTab}" tab in ${typeId}`);
164
160
 
165
- if (!noTypes) {
166
- try {
167
- await buildTypes({ output: types });
168
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
169
- } catch (error) {
170
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
171
- }
161
+ try {
162
+ await buildTypes({ output: types });
163
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
164
+ } catch (error) {
165
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
172
166
  }
167
+
168
+ console.info();
169
+ console.info("Next: Add more fields with `prismic page-type add-field`");
170
+ console.info(" Run `prismic status` when done to find next steps");
173
171
  }
@@ -19,14 +19,11 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
27
25
  -p, --placeholder string Placeholder text
28
26
  --types string Output file for generated types (default: "prismicio-types.d.ts")
29
- --no-types Skip type generation
30
27
  -h, --help Show help for command
31
28
 
32
29
  EXAMPLES
@@ -46,7 +43,7 @@ const CustomTypeSchema = v.object({
46
43
 
47
44
  export async function pageTypeAddFieldKeyText(): Promise<void> {
48
45
  const {
49
- values: { help, tab, label, placeholder, types, "no-types": noTypes },
46
+ values: { help, tab, label, placeholder, types },
50
47
  positionals: [typeId, fieldId],
51
48
  } = parseArgs({
52
49
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "key-text"
@@ -55,7 +52,6 @@ export async function pageTypeAddFieldKeyText(): Promise<void> {
55
52
  label: { type: "string", short: "l" },
56
53
  placeholder: { type: "string", short: "p" },
57
54
  types: { type: "string" },
58
- "no-types": { type: "boolean" },
59
55
  help: { type: "boolean", short: "h" },
60
56
  },
61
57
  allowPositionals: true,
@@ -162,12 +158,14 @@ export async function pageTypeAddFieldKeyText(): Promise<void> {
162
158
 
163
159
  console.info(`Added field "${fieldId}" (Text) to "${targetTab}" tab in ${typeId}`);
164
160
 
165
- if (!noTypes) {
166
- try {
167
- await buildTypes({ output: types });
168
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
169
- } catch (error) {
170
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
171
- }
161
+ try {
162
+ await buildTypes({ output: types });
163
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
164
+ } catch (error) {
165
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
172
166
  }
167
+
168
+ console.info();
169
+ console.info("Next: Add more fields with `prismic page-type add-field`");
170
+ console.info(" Run `prismic status` when done to find next steps");
173
171
  }
@@ -19,8 +19,6 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -30,7 +28,6 @@ FLAGS
30
28
  --allow-target-blank Allow opening link in new tab
31
29
  --repeatable Allow multiple links
32
30
  --types string Output file for generated types (default: "prismicio-types.d.ts")
33
- --no-types Skip type generation
34
31
  -h, --help Show help for command
35
32
 
36
33
  EXAMPLES
@@ -61,7 +58,6 @@ export async function pageTypeAddFieldLink(): Promise<void> {
61
58
  "allow-target-blank": allowTargetBlank,
62
59
  repeatable,
63
60
  types,
64
- "no-types": noTypes,
65
61
  },
66
62
  positionals: [typeId, fieldId],
67
63
  } = parseArgs({
@@ -75,7 +71,6 @@ export async function pageTypeAddFieldLink(): Promise<void> {
75
71
  "allow-target-blank": { type: "boolean" },
76
72
  repeatable: { type: "boolean" },
77
73
  types: { type: "string" },
78
- "no-types": { type: "boolean" },
79
74
  help: { type: "boolean", short: "h" },
80
75
  },
81
76
  allowPositionals: true,
@@ -186,12 +181,14 @@ export async function pageTypeAddFieldLink(): Promise<void> {
186
181
 
187
182
  console.info(`Added field "${fieldId}" (Link) to "${targetTab}" tab in ${typeId}`);
188
183
 
189
- if (!noTypes) {
190
- try {
191
- await buildTypes({ output: types });
192
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
193
- } catch (error) {
194
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
195
- }
184
+ try {
185
+ await buildTypes({ output: types });
186
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
187
+ } catch (error) {
188
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
196
189
  }
190
+
191
+ console.info();
192
+ console.info("Next: Add more fields with `prismic page-type add-field`");
193
+ console.info(" Run `prismic status` when done to find next steps");
197
194
  }
@@ -19,8 +19,6 @@ ARGUMENTS
19
19
  type-id Page type identifier (required)
20
20
  field-id Field identifier (required)
21
21
 
22
- Types are generated by default after changes. Use --no-types to skip.
23
-
24
22
  FLAGS
25
23
  -t, --tab string Target tab (default: first existing tab, or "Main")
26
24
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -29,7 +27,6 @@ FLAGS
29
27
  --max number Maximum value
30
28
  --step number Step increment
31
29
  --types string Output file for generated types (default: "prismicio-types.d.ts")
32
- --no-types Skip type generation
33
30
  -h, --help Show help for command
34
31
 
35
32
  EXAMPLES
@@ -49,7 +46,7 @@ const CustomTypeSchema = v.object({
49
46
 
50
47
  export async function pageTypeAddFieldNumber(): Promise<void> {
51
48
  const {
52
- values: { help, tab, label, placeholder, min, max, step, types, "no-types": noTypes },
49
+ values: { help, tab, label, placeholder, min, max, step, types },
53
50
  positionals: [typeId, fieldId],
54
51
  } = parseArgs({
55
52
  args: process.argv.slice(5), // skip: node, script, "page-type", "add-field", "number"
@@ -61,7 +58,6 @@ export async function pageTypeAddFieldNumber(): Promise<void> {
61
58
  max: { type: "string" },
62
59
  step: { type: "string" },
63
60
  types: { type: "string" },
64
- "no-types": { type: "boolean" },
65
61
  help: { type: "boolean", short: "h" },
66
62
  },
67
63
  allowPositionals: true,
@@ -194,12 +190,14 @@ export async function pageTypeAddFieldNumber(): Promise<void> {
194
190
 
195
191
  console.info(`Added field "${fieldId}" (Number) to "${targetTab}" tab in ${typeId}`);
196
192
 
197
- if (!noTypes) {
198
- try {
199
- await buildTypes({ output: types });
200
- console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
201
- } catch (error) {
202
- console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
203
- }
193
+ try {
194
+ await buildTypes({ output: types });
195
+ console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
196
+ } catch (error) {
197
+ console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
204
198
  }
199
+
200
+ console.info();
201
+ console.info("Next: Add more fields with `prismic page-type add-field`");
202
+ console.info(" Run `prismic status` when done to find next steps");
205
203
  }