@angeloashmore/prismic-cli-poc 0.0.0-pr.6.9baab87 → 0.0.0-pr.8.b80fefa
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/dist/index.mjs +277 -432
- package/package.json +1 -1
- package/src/custom-type-add-field-boolean.ts +5 -12
- package/src/custom-type-add-field-color.ts +6 -12
- package/src/custom-type-add-field-date.ts +6 -12
- package/src/custom-type-add-field-embed.ts +6 -12
- package/src/custom-type-add-field-geo-point.ts +6 -12
- package/src/custom-type-add-field-image.ts +6 -12
- package/src/custom-type-add-field-key-text.ts +6 -12
- package/src/custom-type-add-field-link.ts +5 -12
- package/src/custom-type-add-field-number.ts +6 -12
- package/src/custom-type-add-field-rich-text.ts +5 -12
- package/src/custom-type-add-field-select.ts +5 -12
- package/src/custom-type-add-field-timestamp.ts +6 -12
- package/src/custom-type-add-field-uid.ts +6 -12
- package/src/custom-type-connect-slice.ts +6 -12
- package/src/custom-type-create.ts +6 -12
- package/src/custom-type-disconnect-slice.ts +6 -12
- package/src/custom-type-remove-field.ts +6 -12
- package/src/custom-type-remove.ts +6 -12
- package/src/custom-type-set-name.ts +6 -12
- package/src/docs.ts +149 -0
- package/src/index.ts +5 -0
- package/src/page-type-add-field-boolean.ts +5 -12
- package/src/page-type-add-field-color.ts +6 -12
- package/src/page-type-add-field-date.ts +6 -12
- package/src/page-type-add-field-embed.ts +6 -12
- package/src/page-type-add-field-geo-point.ts +6 -12
- package/src/page-type-add-field-image.ts +6 -12
- package/src/page-type-add-field-key-text.ts +6 -12
- package/src/page-type-add-field-link.ts +5 -12
- package/src/page-type-add-field-number.ts +6 -12
- package/src/page-type-add-field-rich-text.ts +5 -12
- package/src/page-type-add-field-select.ts +5 -12
- package/src/page-type-add-field-timestamp.ts +6 -12
- package/src/page-type-add-field-uid.ts +6 -12
- package/src/page-type-connect-slice.ts +6 -12
- package/src/page-type-create.ts +6 -12
- package/src/page-type-disconnect-slice.ts +6 -12
- package/src/page-type-remove-field.ts +6 -12
- package/src/page-type-remove.ts +6 -12
- package/src/page-type-set-name.ts +6 -12
- package/src/page-type-set-repeatable.ts +6 -12
- package/src/pull.ts +1 -6
- package/src/slice-add-field-boolean.ts +5 -12
- package/src/slice-add-field-color.ts +6 -12
- package/src/slice-add-field-date.ts +6 -12
- package/src/slice-add-field-embed.ts +6 -12
- package/src/slice-add-field-geo-point.ts +6 -12
- package/src/slice-add-field-image.ts +6 -12
- package/src/slice-add-field-key-text.ts +6 -12
- package/src/slice-add-field-link.ts +5 -12
- package/src/slice-add-field-number.ts +6 -12
- package/src/slice-add-field-rich-text.ts +5 -12
- package/src/slice-add-field-select.ts +5 -12
- package/src/slice-add-field-timestamp.ts +6 -12
- package/src/slice-add-variation.ts +6 -12
- package/src/slice-create.ts +6 -12
- package/src/slice-remove-field.ts +6 -12
- package/src/slice-remove-variation.ts +6 -12
- package/src/slice-remove.ts +6 -12
- package/src/slice-rename.ts +6 -12
- package/src/status.ts +113 -13
|
@@ -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
|
|
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,13 +158,11 @@ export async function pageTypeAddFieldEmbed(): Promise<void> {
|
|
|
162
158
|
|
|
163
159
|
console.info(`Added field "${fieldId}" (Embed) to "${targetTab}" tab in ${typeId}`);
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|
|
173
167
|
|
|
174
168
|
console.info();
|
|
@@ -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
|
|
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,13 +155,11 @@ export async function pageTypeAddFieldGeoPoint(): Promise<void> {
|
|
|
159
155
|
|
|
160
156
|
console.info(`Added field "${fieldId}" (GeoPoint) to "${targetTab}" tab in ${typeId}`);
|
|
161
157
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
}
|
|
170
164
|
|
|
171
165
|
console.info();
|
|
@@ -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
|
|
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,13 +158,11 @@ export async function pageTypeAddFieldImage(): Promise<void> {
|
|
|
162
158
|
|
|
163
159
|
console.info(`Added field "${fieldId}" (Image) to "${targetTab}" tab in ${typeId}`);
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|
|
173
167
|
|
|
174
168
|
console.info();
|
|
@@ -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
|
|
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,13 +158,11 @@ export async function pageTypeAddFieldKeyText(): Promise<void> {
|
|
|
162
158
|
|
|
163
159
|
console.info(`Added field "${fieldId}" (Text) to "${targetTab}" tab in ${typeId}`);
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|
|
173
167
|
|
|
174
168
|
console.info();
|
|
@@ -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,13 +181,11 @@ export async function pageTypeAddFieldLink(): Promise<void> {
|
|
|
186
181
|
|
|
187
182
|
console.info(`Added field "${fieldId}" (Link) to "${targetTab}" tab in ${typeId}`);
|
|
188
183
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
}
|
|
197
190
|
|
|
198
191
|
console.info();
|
|
@@ -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
|
|
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,13 +190,11 @@ export async function pageTypeAddFieldNumber(): Promise<void> {
|
|
|
194
190
|
|
|
195
191
|
console.info(`Added field "${fieldId}" (Number) to "${targetTab}" tab in ${typeId}`);
|
|
196
192
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
}
|
|
205
199
|
|
|
206
200
|
console.info();
|
|
@@ -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
|
--multi string Allowed block types for multi-line (comma-separated)
|
|
30
28
|
--allow-target-blank Allow opening links in new tab
|
|
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
|
BLOCK TYPES
|
|
@@ -64,7 +61,6 @@ export async function pageTypeAddFieldRichText(): Promise<void> {
|
|
|
64
61
|
multi,
|
|
65
62
|
"allow-target-blank": allowTargetBlank,
|
|
66
63
|
types,
|
|
67
|
-
"no-types": noTypes,
|
|
68
64
|
},
|
|
69
65
|
positionals: [typeId, fieldId],
|
|
70
66
|
} = parseArgs({
|
|
@@ -77,7 +73,6 @@ export async function pageTypeAddFieldRichText(): Promise<void> {
|
|
|
77
73
|
multi: { type: "string" },
|
|
78
74
|
"allow-target-blank": { type: "boolean" },
|
|
79
75
|
types: { type: "string" },
|
|
80
|
-
"no-types": { type: "boolean" },
|
|
81
76
|
help: { type: "boolean", short: "h" },
|
|
82
77
|
},
|
|
83
78
|
allowPositionals: true,
|
|
@@ -187,13 +182,11 @@ export async function pageTypeAddFieldRichText(): Promise<void> {
|
|
|
187
182
|
|
|
188
183
|
console.info(`Added field "${fieldId}" (StructuredText) to "${targetTab}" tab in ${typeId}`);
|
|
189
184
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
196
|
-
}
|
|
185
|
+
try {
|
|
186
|
+
await buildTypes({ output: types });
|
|
187
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
197
190
|
}
|
|
198
191
|
|
|
199
192
|
console.info();
|
|
@@ -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
|
--option string Add an option (can be used multiple times)
|
|
29
27
|
--default string Default selected value
|
|
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 pageTypeAddFieldSelect(): Promise<void> {
|
|
|
56
53
|
option,
|
|
57
54
|
default: defaultValue,
|
|
58
55
|
types,
|
|
59
|
-
"no-types": noTypes,
|
|
60
56
|
},
|
|
61
57
|
positionals: [typeId, fieldId],
|
|
62
58
|
} = parseArgs({
|
|
@@ -68,7 +64,6 @@ export async function pageTypeAddFieldSelect(): Promise<void> {
|
|
|
68
64
|
option: { type: "string", multiple: true },
|
|
69
65
|
default: { 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,13 +172,11 @@ export async function pageTypeAddFieldSelect(): Promise<void> {
|
|
|
177
172
|
|
|
178
173
|
console.info(`Added field "${fieldId}" (Select) to "${targetTab}" tab in ${typeId}`);
|
|
179
174
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
}
|
|
188
181
|
|
|
189
182
|
console.info();
|
|
@@ -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 timestamp value (ISO 8601 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 pageTypeAddFieldTimestamp(): Promise<void> {
|
|
49
46
|
const {
|
|
50
|
-
values: { help, tab, label, placeholder, default: defaultValue, types
|
|
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", "timestamp"
|
|
@@ -57,7 +54,6 @@ export async function pageTypeAddFieldTimestamp(): 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,13 +161,11 @@ export async function pageTypeAddFieldTimestamp(): Promise<void> {
|
|
|
165
161
|
|
|
166
162
|
console.info(`Added field "${fieldId}" (Timestamp) to "${targetTab}" tab in ${typeId}`);
|
|
167
163
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
}
|
|
176
170
|
|
|
177
171
|
console.info();
|
|
@@ -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 pageTypeAddFieldUid(): Promise<void> {
|
|
48
45
|
const {
|
|
49
|
-
values: { help, tab, label, placeholder, types
|
|
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", "uid"
|
|
@@ -55,7 +52,6 @@ export async function pageTypeAddFieldUid(): 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,13 +158,11 @@ export async function pageTypeAddFieldUid(): Promise<void> {
|
|
|
162
158
|
|
|
163
159
|
console.info(`Added field "${fieldId}" (UID) to "${targetTab}" tab in ${typeId}`);
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|
|
173
167
|
|
|
174
168
|
console.info();
|
|
@@ -23,12 +23,9 @@ ARGUMENTS
|
|
|
23
23
|
type-id Page type identifier (required)
|
|
24
24
|
slice-id Slice identifier (required)
|
|
25
25
|
|
|
26
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
27
|
-
|
|
28
26
|
FLAGS
|
|
29
27
|
-z, --slice-zone string Target slice zone field ID (default: "slices")
|
|
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
|
|
@@ -48,14 +45,13 @@ const CustomTypeSchema = v.object({
|
|
|
48
45
|
|
|
49
46
|
export async function pageTypeConnectSlice(): Promise<void> {
|
|
50
47
|
const {
|
|
51
|
-
values: { help, "slice-zone": sliceZoneId, types
|
|
48
|
+
values: { help, "slice-zone": sliceZoneId, types },
|
|
52
49
|
positionals: [typeId, sliceId],
|
|
53
50
|
} = parseArgs({
|
|
54
51
|
args: process.argv.slice(4), // skip: node, script, "page-type", "connect-slice"
|
|
55
52
|
options: {
|
|
56
53
|
"slice-zone": { type: "string", short: "z" },
|
|
57
54
|
types: { type: "string" },
|
|
58
|
-
"no-types": { type: "boolean" },
|
|
59
55
|
help: { type: "boolean", short: "h" },
|
|
60
56
|
},
|
|
61
57
|
allowPositionals: true,
|
|
@@ -209,12 +205,10 @@ export async function pageTypeConnectSlice(): Promise<void> {
|
|
|
209
205
|
|
|
210
206
|
console.info(`Connected slice "${sliceId}" to slice zone "${sliceZoneFieldId}" in ${typeId}`);
|
|
211
207
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
218
|
-
}
|
|
208
|
+
try {
|
|
209
|
+
await buildTypes({ output: types });
|
|
210
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
219
213
|
}
|
|
220
214
|
}
|
package/src/page-type-create.ts
CHANGED
|
@@ -16,13 +16,10 @@ USAGE
|
|
|
16
16
|
ARGUMENTS
|
|
17
17
|
id Page type identifier (required)
|
|
18
18
|
|
|
19
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
20
|
-
|
|
21
19
|
FLAGS
|
|
22
20
|
-n, --name string Display name for the page type
|
|
23
21
|
--single Create as a singleton (non-repeatable) type
|
|
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,7 +28,7 @@ LEARN MORE
|
|
|
31
28
|
|
|
32
29
|
export async function pageTypeCreate(): Promise<void> {
|
|
33
30
|
const {
|
|
34
|
-
values: { help, name, single, types
|
|
31
|
+
values: { help, name, single, types },
|
|
35
32
|
positionals: [id],
|
|
36
33
|
} = parseArgs({
|
|
37
34
|
args: process.argv.slice(4), // skip: node, script, "page-type", "create"
|
|
@@ -39,7 +36,6 @@ export async function pageTypeCreate(): Promise<void> {
|
|
|
39
36
|
name: { type: "string", short: "n" },
|
|
40
37
|
single: { type: "boolean" },
|
|
41
38
|
types: { type: "string" },
|
|
42
|
-
"no-types": { type: "boolean" },
|
|
43
39
|
help: { type: "boolean", short: "h" },
|
|
44
40
|
},
|
|
45
41
|
allowPositionals: true,
|
|
@@ -124,13 +120,11 @@ export async function pageTypeCreate(): Promise<void> {
|
|
|
124
120
|
|
|
125
121
|
console.info(`Created page type at ${modelPath.href}`);
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
133
|
-
}
|
|
123
|
+
try {
|
|
124
|
+
await buildTypes({ output: types });
|
|
125
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
134
128
|
}
|
|
135
129
|
|
|
136
130
|
console.info();
|
|
@@ -18,12 +18,9 @@ ARGUMENTS
|
|
|
18
18
|
type-id Page type identifier (required)
|
|
19
19
|
slice-id Slice identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-z, --slice-zone string Target slice zone field ID (default: "slices")
|
|
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
|
|
@@ -43,14 +40,13 @@ const CustomTypeSchema = v.object({
|
|
|
43
40
|
|
|
44
41
|
export async function pageTypeDisconnectSlice(): Promise<void> {
|
|
45
42
|
const {
|
|
46
|
-
values: { help, "slice-zone": sliceZoneId, types
|
|
43
|
+
values: { help, "slice-zone": sliceZoneId, types },
|
|
47
44
|
positionals: [typeId, sliceId],
|
|
48
45
|
} = parseArgs({
|
|
49
46
|
args: process.argv.slice(4), // skip: node, script, "page-type", "disconnect-slice"
|
|
50
47
|
options: {
|
|
51
48
|
"slice-zone": { type: "string", short: "z" },
|
|
52
49
|
types: { type: "string" },
|
|
53
|
-
"no-types": { type: "boolean" },
|
|
54
50
|
help: { type: "boolean", short: "h" },
|
|
55
51
|
},
|
|
56
52
|
allowPositionals: true,
|
|
@@ -166,12 +162,10 @@ export async function pageTypeDisconnectSlice(): Promise<void> {
|
|
|
166
162
|
`Disconnected slice "${sliceId}" from slice zone "${sliceZoneFieldId}" in ${typeId}`,
|
|
167
163
|
);
|
|
168
164
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
175
|
-
}
|
|
165
|
+
try {
|
|
166
|
+
await buildTypes({ output: types });
|
|
167
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
176
170
|
}
|
|
177
171
|
}
|