@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,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 sliceAddFieldNumber(): 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", "number"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldNumber(): 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 sliceAddFieldNumber(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Number) 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
|
--multi string Allowed block types for multi-line (comma-separated)
|
|
29
27
|
--allow-target-blank Allow opening links in new tab
|
|
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
|
BLOCK TYPES
|
|
@@ -54,7 +51,6 @@ export async function sliceAddFieldRichText(): Promise<void> {
|
|
|
54
51
|
multi,
|
|
55
52
|
"allow-target-blank": allowTargetBlank,
|
|
56
53
|
types,
|
|
57
|
-
"no-types": noTypes,
|
|
58
54
|
},
|
|
59
55
|
positionals: [sliceId, fieldId],
|
|
60
56
|
} = parseArgs({
|
|
@@ -67,7 +63,6 @@ export async function sliceAddFieldRichText(): Promise<void> {
|
|
|
67
63
|
multi: { type: "string" },
|
|
68
64
|
"allow-target-blank": { type: "boolean" },
|
|
69
65
|
types: { type: "string" },
|
|
70
|
-
"no-types": { type: "boolean" },
|
|
71
66
|
help: { type: "boolean", short: "h" },
|
|
72
67
|
},
|
|
73
68
|
allowPositionals: true,
|
|
@@ -168,13 +163,11 @@ export async function sliceAddFieldRichText(): Promise<void> {
|
|
|
168
163
|
`Added field "${fieldId}" (StructuredText) to "${targetVariation.id}" variation in ${sliceId}`,
|
|
169
164
|
);
|
|
170
165
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
console.warn(`Could not generate types: ${error instanceof Error ? error.message : error}`);
|
|
177
|
-
}
|
|
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}`);
|
|
178
171
|
}
|
|
179
172
|
|
|
180
173
|
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)
|
|
@@ -27,7 +25,6 @@ FLAGS
|
|
|
27
25
|
--option string Add an option (can be used multiple times)
|
|
28
26
|
--default string Default selected value
|
|
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 sliceAddFieldSelect(): Promise<void> {
|
|
|
46
43
|
option,
|
|
47
44
|
default: defaultValue,
|
|
48
45
|
types,
|
|
49
|
-
"no-types": noTypes,
|
|
50
46
|
},
|
|
51
47
|
positionals: [sliceId, fieldId],
|
|
52
48
|
} = parseArgs({
|
|
@@ -58,7 +54,6 @@ export async function sliceAddFieldSelect(): Promise<void> {
|
|
|
58
54
|
option: { type: "string", multiple: true },
|
|
59
55
|
default: { 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 sliceAddFieldSelect(): Promise<void> {
|
|
|
158
153
|
`Added field "${fieldId}" (Select) 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 sliceAddFieldTimestamp(): 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", "timestamp"
|
|
@@ -45,7 +42,6 @@ export async function sliceAddFieldTimestamp(): 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 sliceAddFieldTimestamp(): Promise<void> {
|
|
|
143
139
|
`Added field "${fieldId}" (Timestamp) 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();
|
|
@@ -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
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
}
|
package/src/slice-create.ts
CHANGED
|
@@ -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
|
|
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,13 +89,11 @@ export async function sliceCreate(): Promise<void> {
|
|
|
93
89
|
|
|
94
90
|
console.info(`Created slice at ${modelPath.href}`);
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
}
|
|
104
98
|
|
|
105
99
|
console.info();
|
|
@@ -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
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
}
|
package/src/slice-remove.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
}
|
package/src/slice-rename.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
}
|