@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
|
@@ -18,12 +18,9 @@ ARGUMENTS
|
|
|
18
18
|
type-id Page type identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
--tab string Specific tab (searches all tabs if not specified)
|
|
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
|
|
@@ -42,14 +39,13 @@ const CustomTypeSchema = v.object({
|
|
|
42
39
|
|
|
43
40
|
export async function pageTypeRemoveField(): Promise<void> {
|
|
44
41
|
const {
|
|
45
|
-
values: { help, tab, types
|
|
42
|
+
values: { help, tab, types },
|
|
46
43
|
positionals: [typeId, fieldId],
|
|
47
44
|
} = parseArgs({
|
|
48
45
|
args: process.argv.slice(4), // skip: node, script, "page-type", "remove-field"
|
|
49
46
|
options: {
|
|
50
47
|
tab: { type: "string" },
|
|
51
48
|
types: { type: "string" },
|
|
52
|
-
"no-types": { type: "boolean" },
|
|
53
49
|
help: { type: "boolean", short: "h" },
|
|
54
50
|
},
|
|
55
51
|
allowPositionals: true,
|
|
@@ -166,12 +162,10 @@ export async function pageTypeRemoveField(): Promise<void> {
|
|
|
166
162
|
|
|
167
163
|
console.info(`Removed field "${fieldId}" from tab "${foundTab}" in page type "${typeId}"`);
|
|
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
|
}
|
package/src/page-type-remove.ts
CHANGED
|
@@ -16,12 +16,9 @@ USAGE
|
|
|
16
16
|
ARGUMENTS
|
|
17
17
|
type-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
|
-y Confirm removal
|
|
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
|
|
@@ -40,14 +37,13 @@ const CustomTypeSchema = v.object({
|
|
|
40
37
|
|
|
41
38
|
export async function pageTypeRemove(): Promise<void> {
|
|
42
39
|
const {
|
|
43
|
-
values: { help, y, types
|
|
40
|
+
values: { help, y, types },
|
|
44
41
|
positionals: [typeId],
|
|
45
42
|
} = parseArgs({
|
|
46
43
|
args: process.argv.slice(4), // skip: node, script, "page-type", "remove"
|
|
47
44
|
options: {
|
|
48
45
|
y: { type: "boolean", short: "y" },
|
|
49
46
|
types: { type: "string" },
|
|
50
|
-
"no-types": { type: "boolean" },
|
|
51
47
|
help: { type: "boolean", short: "h" },
|
|
52
48
|
},
|
|
53
49
|
allowPositionals: true,
|
|
@@ -133,12 +129,10 @@ export async function pageTypeRemove(): Promise<void> {
|
|
|
133
129
|
|
|
134
130
|
console.info(`Removed page type "${typeId}"`);
|
|
135
131
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
142
|
-
}
|
|
132
|
+
try {
|
|
133
|
+
await buildTypes({ output: types });
|
|
134
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
143
137
|
}
|
|
144
138
|
}
|
|
@@ -18,11 +18,8 @@ ARGUMENTS
|
|
|
18
18
|
type-id Page type identifier (required)
|
|
19
19
|
new-name New display name (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
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
|
EXAMPLES
|
|
@@ -41,13 +38,12 @@ const CustomTypeSchema = v.object({
|
|
|
41
38
|
|
|
42
39
|
export async function pageTypeSetName(): Promise<void> {
|
|
43
40
|
const {
|
|
44
|
-
values: { help, types
|
|
41
|
+
values: { help, types },
|
|
45
42
|
positionals: [typeId, newName],
|
|
46
43
|
} = parseArgs({
|
|
47
44
|
args: process.argv.slice(4), // skip: node, script, "page-type", "set-name"
|
|
48
45
|
options: {
|
|
49
46
|
types: { type: "string" },
|
|
50
|
-
"no-types": { type: "boolean" },
|
|
51
47
|
help: { type: "boolean", short: "h" },
|
|
52
48
|
},
|
|
53
49
|
allowPositionals: true,
|
|
@@ -133,12 +129,10 @@ export async function pageTypeSetName(): Promise<void> {
|
|
|
133
129
|
|
|
134
130
|
console.info(`Renamed page type "${typeId}" to "${newName}"`);
|
|
135
131
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
142
|
-
}
|
|
132
|
+
try {
|
|
133
|
+
await buildTypes({ output: types });
|
|
134
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
143
137
|
}
|
|
144
138
|
}
|
|
@@ -18,11 +18,8 @@ ARGUMENTS
|
|
|
18
18
|
type-id Page type identifier (required)
|
|
19
19
|
true|false Repeatable value (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
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
|
EXAMPLES
|
|
@@ -41,13 +38,12 @@ const CustomTypeSchema = v.object({
|
|
|
41
38
|
|
|
42
39
|
export async function pageTypeSetRepeatable(): Promise<void> {
|
|
43
40
|
const {
|
|
44
|
-
values: { help, types
|
|
41
|
+
values: { help, types },
|
|
45
42
|
positionals: [typeId, repeatableValue],
|
|
46
43
|
} = parseArgs({
|
|
47
44
|
args: process.argv.slice(4), // skip: node, script, "page-type", "set-repeatable"
|
|
48
45
|
options: {
|
|
49
46
|
types: { type: "string" },
|
|
50
|
-
"no-types": { type: "boolean" },
|
|
51
47
|
help: { type: "boolean", short: "h" },
|
|
52
48
|
},
|
|
53
49
|
allowPositionals: true,
|
|
@@ -142,12 +138,10 @@ export async function pageTypeSetRepeatable(): Promise<void> {
|
|
|
142
138
|
const typeLabel = repeatable ? "repeatable" : "singleton";
|
|
143
139
|
console.info(`Set page type "${typeId}" to ${typeLabel}`);
|
|
144
140
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
151
|
-
}
|
|
141
|
+
try {
|
|
142
|
+
await buildTypes({ output: types });
|
|
143
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
152
146
|
}
|
|
153
147
|
}
|
package/src/pull.ts
CHANGED
|
@@ -18,8 +18,6 @@ project root.
|
|
|
18
18
|
USAGE
|
|
19
19
|
prismic pull [flags]
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-r, --repo string Repository domain
|
|
25
23
|
--dry-run Show what would be pulled without writing files
|
|
@@ -27,7 +25,6 @@ FLAGS
|
|
|
27
25
|
--slices-only Only pull slices
|
|
28
26
|
--json Output as JSON
|
|
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,6 @@ export async function pull(): Promise<void> {
|
|
|
47
44
|
"slices-only": slicesOnly,
|
|
48
45
|
json,
|
|
49
46
|
types,
|
|
50
|
-
"no-types": noTypes,
|
|
51
47
|
},
|
|
52
48
|
} = parseArgs({
|
|
53
49
|
args: process.argv.slice(3), // skip: node, script, "pull"
|
|
@@ -58,7 +54,6 @@ export async function pull(): Promise<void> {
|
|
|
58
54
|
"slices-only": { type: "boolean" },
|
|
59
55
|
json: { type: "boolean" },
|
|
60
56
|
types: { type: "string" },
|
|
61
|
-
"no-types": { type: "boolean" },
|
|
62
57
|
help: { type: "boolean", short: "h" },
|
|
63
58
|
},
|
|
64
59
|
allowPositionals: false,
|
|
@@ -227,7 +222,7 @@ export async function pull(): Promise<void> {
|
|
|
227
222
|
);
|
|
228
223
|
}
|
|
229
224
|
|
|
230
|
-
if (!json
|
|
225
|
+
if (!json) {
|
|
231
226
|
try {
|
|
232
227
|
await buildTypes({ output: types });
|
|
233
228
|
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
@@ -18,8 +18,6 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
@@ -27,7 +25,6 @@ FLAGS
|
|
|
27
25
|
--true-label string Label shown when toggle is on
|
|
28
26
|
--false-label string Label shown when toggle is off
|
|
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
|
|
@@ -46,7 +43,6 @@ export async function sliceAddFieldBoolean(): Promise<void> {
|
|
|
46
43
|
"true-label": trueLabel,
|
|
47
44
|
"false-label": falseLabel,
|
|
48
45
|
types,
|
|
49
|
-
"no-types": noTypes,
|
|
50
46
|
},
|
|
51
47
|
positionals: [sliceId, fieldId],
|
|
52
48
|
} = parseArgs({
|
|
@@ -58,7 +54,6 @@ export async function sliceAddFieldBoolean(): Promise<void> {
|
|
|
58
54
|
"true-label": { type: "string" },
|
|
59
55
|
"false-label": { type: "string" },
|
|
60
56
|
types: { type: "string" },
|
|
61
|
-
"no-types": { type: "boolean" },
|
|
62
57
|
help: { type: "boolean", short: "h" },
|
|
63
58
|
},
|
|
64
59
|
allowPositionals: true,
|
|
@@ -158,13 +153,11 @@ export async function sliceAddFieldBoolean(): Promise<void> {
|
|
|
158
153
|
`Added field "${fieldId}" (Boolean) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
159
154
|
);
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
167
|
-
}
|
|
156
|
+
try {
|
|
157
|
+
await buildTypes({ output: types });
|
|
158
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
168
161
|
}
|
|
169
162
|
|
|
170
163
|
console.info();
|
|
@@ -18,14 +18,11 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
-p, --placeholder string Placeholder text
|
|
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
|
|
@@ -36,7 +33,7 @@ EXAMPLES
|
|
|
36
33
|
|
|
37
34
|
export async function sliceAddFieldColor(): Promise<void> {
|
|
38
35
|
const {
|
|
39
|
-
values: { help, variation, label, placeholder, types
|
|
36
|
+
values: { help, variation, label, placeholder, types },
|
|
40
37
|
positionals: [sliceId, fieldId],
|
|
41
38
|
} = parseArgs({
|
|
42
39
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "color"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldColor(): Promise<void> {
|
|
|
45
42
|
label: { type: "string", short: "l" },
|
|
46
43
|
placeholder: { type: "string", short: "p" },
|
|
47
44
|
types: { type: "string" },
|
|
48
|
-
"no-types": { type: "boolean" },
|
|
49
45
|
help: { type: "boolean", short: "h" },
|
|
50
46
|
},
|
|
51
47
|
allowPositionals: true,
|
|
@@ -143,13 +139,11 @@ export async function sliceAddFieldColor(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Color) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
144
140
|
);
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
152
|
-
}
|
|
142
|
+
try {
|
|
143
|
+
await buildTypes({ output: types });
|
|
144
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
console.info();
|
|
@@ -18,14 +18,11 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
-p, --placeholder string Placeholder text
|
|
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
|
|
@@ -36,7 +33,7 @@ EXAMPLES
|
|
|
36
33
|
|
|
37
34
|
export async function sliceAddFieldDate(): Promise<void> {
|
|
38
35
|
const {
|
|
39
|
-
values: { help, variation, label, placeholder, types
|
|
36
|
+
values: { help, variation, label, placeholder, types },
|
|
40
37
|
positionals: [sliceId, fieldId],
|
|
41
38
|
} = parseArgs({
|
|
42
39
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "date"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldDate(): Promise<void> {
|
|
|
45
42
|
label: { type: "string", short: "l" },
|
|
46
43
|
placeholder: { type: "string", short: "p" },
|
|
47
44
|
types: { type: "string" },
|
|
48
|
-
"no-types": { type: "boolean" },
|
|
49
45
|
help: { type: "boolean", short: "h" },
|
|
50
46
|
},
|
|
51
47
|
allowPositionals: true,
|
|
@@ -143,13 +139,11 @@ export async function sliceAddFieldDate(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Date) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
144
140
|
);
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
152
|
-
}
|
|
142
|
+
try {
|
|
143
|
+
await buildTypes({ output: types });
|
|
144
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
console.info();
|
|
@@ -18,14 +18,11 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
-p, --placeholder string Placeholder text
|
|
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
|
|
@@ -36,7 +33,7 @@ EXAMPLES
|
|
|
36
33
|
|
|
37
34
|
export async function sliceAddFieldEmbed(): Promise<void> {
|
|
38
35
|
const {
|
|
39
|
-
values: { help, variation, label, placeholder, types
|
|
36
|
+
values: { help, variation, label, placeholder, types },
|
|
40
37
|
positionals: [sliceId, fieldId],
|
|
41
38
|
} = parseArgs({
|
|
42
39
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "embed"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldEmbed(): Promise<void> {
|
|
|
45
42
|
label: { type: "string", short: "l" },
|
|
46
43
|
placeholder: { type: "string", short: "p" },
|
|
47
44
|
types: { type: "string" },
|
|
48
|
-
"no-types": { type: "boolean" },
|
|
49
45
|
help: { type: "boolean", short: "h" },
|
|
50
46
|
},
|
|
51
47
|
allowPositionals: true,
|
|
@@ -143,13 +139,11 @@ export async function sliceAddFieldEmbed(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Embed) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
144
140
|
);
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
152
|
-
}
|
|
142
|
+
try {
|
|
143
|
+
await buildTypes({ output: types });
|
|
144
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
console.info();
|
|
@@ -18,13 +18,10 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
--types string Output file for generated types (default: "prismicio-types.d.ts")
|
|
27
|
-
--no-types Skip type generation
|
|
28
25
|
-h, --help Show help for command
|
|
29
26
|
|
|
30
27
|
EXAMPLES
|
|
@@ -35,7 +32,7 @@ EXAMPLES
|
|
|
35
32
|
|
|
36
33
|
export async function sliceAddFieldGeoPoint(): Promise<void> {
|
|
37
34
|
const {
|
|
38
|
-
values: { help, variation, label, types
|
|
35
|
+
values: { help, variation, label, types },
|
|
39
36
|
positionals: [sliceId, fieldId],
|
|
40
37
|
} = parseArgs({
|
|
41
38
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "geo-point"
|
|
@@ -43,7 +40,6 @@ export async function sliceAddFieldGeoPoint(): Promise<void> {
|
|
|
43
40
|
variation: { type: "string", short: "v" },
|
|
44
41
|
label: { type: "string", short: "l" },
|
|
45
42
|
types: { type: "string" },
|
|
46
|
-
"no-types": { type: "boolean" },
|
|
47
43
|
help: { type: "boolean", short: "h" },
|
|
48
44
|
},
|
|
49
45
|
allowPositionals: true,
|
|
@@ -140,13 +136,11 @@ export async function sliceAddFieldGeoPoint(): Promise<void> {
|
|
|
140
136
|
`Added field "${fieldId}" (GeoPoint) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
141
137
|
);
|
|
142
138
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
149
|
-
}
|
|
139
|
+
try {
|
|
140
|
+
await buildTypes({ output: types });
|
|
141
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
console.info();
|
|
@@ -18,13 +18,10 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
--types string Output file for generated types (default: "prismicio-types.d.ts")
|
|
27
|
-
--no-types Skip type generation
|
|
28
25
|
-h, --help Show help for command
|
|
29
26
|
|
|
30
27
|
EXAMPLES
|
|
@@ -35,7 +32,7 @@ EXAMPLES
|
|
|
35
32
|
|
|
36
33
|
export async function sliceAddFieldImage(): Promise<void> {
|
|
37
34
|
const {
|
|
38
|
-
values: { help, variation, label, types
|
|
35
|
+
values: { help, variation, label, types },
|
|
39
36
|
positionals: [sliceId, fieldId],
|
|
40
37
|
} = parseArgs({
|
|
41
38
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "image"
|
|
@@ -43,7 +40,6 @@ export async function sliceAddFieldImage(): Promise<void> {
|
|
|
43
40
|
variation: { type: "string", short: "v" },
|
|
44
41
|
label: { type: "string", short: "l" },
|
|
45
42
|
types: { type: "string" },
|
|
46
|
-
"no-types": { type: "boolean" },
|
|
47
43
|
help: { type: "boolean", short: "h" },
|
|
48
44
|
},
|
|
49
45
|
allowPositionals: true,
|
|
@@ -140,13 +136,11 @@ export async function sliceAddFieldImage(): Promise<void> {
|
|
|
140
136
|
`Added field "${fieldId}" (Image) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
141
137
|
);
|
|
142
138
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
149
|
-
}
|
|
139
|
+
try {
|
|
140
|
+
await buildTypes({ output: types });
|
|
141
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
console.info();
|
|
@@ -18,14 +18,11 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
26
24
|
-p, --placeholder string Placeholder text
|
|
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
|
|
@@ -36,7 +33,7 @@ EXAMPLES
|
|
|
36
33
|
|
|
37
34
|
export async function sliceAddFieldKeyText(): Promise<void> {
|
|
38
35
|
const {
|
|
39
|
-
values: { help, variation, label, placeholder, types
|
|
36
|
+
values: { help, variation, label, placeholder, types },
|
|
40
37
|
positionals: [sliceId, fieldId],
|
|
41
38
|
} = parseArgs({
|
|
42
39
|
args: process.argv.slice(5), // skip: node, script, "slice", "add-field", "key-text"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldKeyText(): Promise<void> {
|
|
|
45
42
|
label: { type: "string", short: "l" },
|
|
46
43
|
placeholder: { type: "string", short: "p" },
|
|
47
44
|
types: { type: "string" },
|
|
48
|
-
"no-types": { type: "boolean" },
|
|
49
45
|
help: { type: "boolean", short: "h" },
|
|
50
46
|
},
|
|
51
47
|
allowPositionals: true,
|
|
@@ -143,13 +139,11 @@ export async function sliceAddFieldKeyText(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Text) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
144
140
|
);
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
152
|
-
}
|
|
142
|
+
try {
|
|
143
|
+
await buildTypes({ output: types });
|
|
144
|
+
console.info(`Updated types in ${types ?? "prismicio-types.d.ts"}`);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
console.info();
|
|
@@ -18,8 +18,6 @@ ARGUMENTS
|
|
|
18
18
|
slice-id Slice identifier (required)
|
|
19
19
|
field-id Field identifier (required)
|
|
20
20
|
|
|
21
|
-
Types are generated by default after changes. Use --no-types to skip.
|
|
22
|
-
|
|
23
21
|
FLAGS
|
|
24
22
|
-v, --variation string Target variation (default: first variation)
|
|
25
23
|
-l, --label string Display label for the field (inferred from field-id if omitted)
|
|
@@ -28,7 +26,6 @@ FLAGS
|
|
|
28
26
|
--allow-target-blank Allow opening link in new tab
|
|
29
27
|
--repeatable Allow multiple links
|
|
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
|
|
@@ -49,7 +46,6 @@ export async function sliceAddFieldLink(): Promise<void> {
|
|
|
49
46
|
"allow-target-blank": allowTargetBlank,
|
|
50
47
|
repeatable,
|
|
51
48
|
types,
|
|
52
|
-
"no-types": noTypes,
|
|
53
49
|
},
|
|
54
50
|
positionals: [sliceId, fieldId],
|
|
55
51
|
} = parseArgs({
|
|
@@ -62,7 +58,6 @@ export async function sliceAddFieldLink(): Promise<void> {
|
|
|
62
58
|
"allow-target-blank": { type: "boolean" },
|
|
63
59
|
repeatable: { type: "boolean" },
|
|
64
60
|
types: { type: "string" },
|
|
65
|
-
"no-types": { type: "boolean" },
|
|
66
61
|
help: { type: "boolean", short: "h" },
|
|
67
62
|
},
|
|
68
63
|
allowPositionals: true,
|
|
@@ -163,13 +158,11 @@ export async function sliceAddFieldLink(): Promise<void> {
|
|
|
163
158
|
`Added field "${fieldId}" (Link) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
164
159
|
);
|
|
165
160
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
172
|
-
}
|
|
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}`);
|
|
173
166
|
}
|
|
174
167
|
|
|
175
168
|
console.info();
|