@shopify/shop-minis-cli 0.0.38 → 0.0.39
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/.eslintrc.cjs +84 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +8 -0
- package/.vscode/shop-minis-cli.code-workspace +8 -0
- package/build/commands/cancel-submission/index.d.ts +2 -0
- package/build/commands/cancel-submission/index.js +22 -0
- package/build/commands/cancel-submission/index.js.map +1 -0
- package/build/commands/cancel-submission/types.d.ts +3 -0
- package/build/commands/cancel-submission/types.js +2 -0
- package/build/commands/cancel-submission/types.js.map +1 -0
- package/build/commands/check-submission/index.d.ts +2 -0
- package/build/commands/check-submission/index.js +22 -0
- package/build/commands/check-submission/index.js.map +1 -0
- package/build/commands/check-submission/types.d.ts +3 -0
- package/build/commands/check-submission/types.js +2 -0
- package/build/commands/check-submission/types.js.map +1 -0
- package/build/commands/config.d.ts +10 -0
- package/build/commands/config.js +34 -0
- package/build/commands/config.js.map +1 -0
- package/build/commands/create-mini/index.js +38 -40
- package/build/commands/create-mini/index.js.map +1 -1
- package/build/commands/create-mini/utils/template-app.js +20 -25
- package/build/commands/create-mini/utils/template-app.js.map +1 -1
- package/build/commands/dev/index.js +13 -20
- package/build/commands/dev/index.js.map +1 -1
- package/build/commands/dev/utils/android.js +34 -48
- package/build/commands/dev/utils/android.js.map +1 -1
- package/build/commands/dev/utils/binaries.d.ts +1 -22
- package/build/commands/dev/utils/binaries.js +19 -98
- package/build/commands/dev/utils/binaries.js.map +1 -1
- package/build/commands/dev/utils/deeplink.d.ts +1 -1
- package/build/commands/dev/utils/deeplink.js +2 -7
- package/build/commands/dev/utils/deeplink.js.map +1 -1
- package/build/commands/dev/utils/interactive-terminal.d.ts +1 -1
- package/build/commands/dev/utils/interactive-terminal.js +46 -52
- package/build/commands/dev/utils/interactive-terminal.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-config.js +19 -20
- package/build/commands/dev/utils/metro/metro-config.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-reporter.d.ts +2 -3
- package/build/commands/dev/utils/metro/metro-reporter.js +7 -12
- package/build/commands/dev/utils/metro/metro-reporter.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-server-middleware.js +5 -12
- package/build/commands/dev/utils/metro/metro-server-middleware.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-server.d.ts +1 -1
- package/build/commands/dev/utils/metro/metro-server.js +6 -13
- package/build/commands/dev/utils/metro/metro-server.js.map +1 -1
- package/build/commands/dev/utils/network.d.ts +20 -0
- package/build/commands/dev/utils/network.js +62 -0
- package/build/commands/dev/utils/network.js.map +1 -0
- package/build/commands/dev/utils/qr-code.js +3 -10
- package/build/commands/dev/utils/qr-code.js.map +1 -1
- package/build/commands/dev/utils/simulator.js +25 -35
- package/build/commands/dev/utils/simulator.js.map +1 -1
- package/build/commands/dev/utils/types.d.ts +1 -0
- package/build/commands/dev/utils/types.js +2 -0
- package/build/commands/dev/utils/types.js.map +1 -0
- package/build/commands/dev/utils/with-retries.js +1 -5
- package/build/commands/dev/utils/with-retries.js.map +1 -1
- package/build/commands/generate-graphql-types/index.js +25 -26
- package/build/commands/generate-graphql-types/index.js.map +1 -1
- package/build/commands/schemas/contextual-image.schema.d.ts +22 -0
- package/build/commands/schemas/contextual-image.schema.js +23 -0
- package/build/commands/schemas/contextual-image.schema.js.map +1 -0
- package/build/commands/schemas/contextual-object.schema.d.ts +18 -0
- package/build/commands/schemas/contextual-object.schema.js +19 -0
- package/build/commands/schemas/contextual-object.schema.js.map +1 -0
- package/build/commands/schemas/manifest.schema.d.ts +181 -0
- package/build/commands/schemas/manifest.schema.js +230 -0
- package/build/commands/schemas/manifest.schema.js.map +1 -0
- package/build/commands/schemas/visibility.schema.d.ts +18 -0
- package/build/commands/schemas/visibility.schema.js +19 -0
- package/build/commands/schemas/visibility.schema.js.map +1 -0
- package/build/commands/submit/config.d.ts +9 -0
- package/build/commands/submit/config.js +18 -0
- package/build/commands/submit/config.js.map +1 -0
- package/build/commands/submit/errors.d.ts +19 -0
- package/build/commands/submit/errors.js +87 -0
- package/build/commands/submit/errors.js.map +1 -0
- package/build/commands/submit/gcs.d.ts +6 -0
- package/build/commands/submit/gcs.js +10 -0
- package/build/commands/submit/gcs.js.map +1 -0
- package/build/commands/submit/graphql.d.ts +73 -0
- package/build/commands/submit/graphql.js +100 -0
- package/build/commands/submit/graphql.js.map +1 -0
- package/build/commands/submit/index.d.ts +2 -0
- package/build/commands/submit/index.js +21 -0
- package/build/commands/submit/index.js.map +1 -0
- package/build/commands/submit/submit.d.ts +4 -0
- package/build/commands/submit/submit.js +171 -0
- package/build/commands/submit/submit.js.map +1 -0
- package/build/commands/submit/tasks.d.ts +39 -0
- package/build/commands/submit/tasks.js +167 -0
- package/build/commands/submit/tasks.js.map +1 -0
- package/build/commands/submit/types.d.ts +14 -0
- package/build/commands/submit/types.js +2 -0
- package/build/commands/submit/types.js.map +1 -0
- package/build/commands/submit/validation.d.ts +2 -0
- package/build/commands/submit/validation.js +14 -0
- package/build/commands/submit/validation.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.d.ts +13 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.js +7 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.d.ts +54 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js +21 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.d.ts +613 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js +427 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.d.ts +2 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.js +3 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.js.map +1 -0
- package/build/commands/types/helpers.d.ts +1 -0
- package/build/commands/types/helpers.js +2 -0
- package/build/commands/types/helpers.js.map +1 -0
- package/build/commands/utils/archive.d.ts +30 -0
- package/build/commands/utils/archive.js +38 -0
- package/build/commands/utils/archive.js.map +1 -0
- package/build/commands/utils/exec-async-child-process.d.ts +1 -1
- package/build/commands/utils/exec-async-child-process.js +6 -13
- package/build/commands/utils/exec-async-child-process.js.map +1 -1
- package/build/commands/utils/file.d.ts +1 -0
- package/build/commands/utils/file.js +7 -0
- package/build/commands/utils/file.js.map +1 -0
- package/build/commands/{check/utils/manifest.d.ts → utils/minis-manifest.d.ts} +1 -0
- package/build/commands/utils/minis-manifest.js +42 -0
- package/build/commands/utils/minis-manifest.js.map +1 -0
- package/build/commands/utils/wrap-with-loading-indicator.js +3 -10
- package/build/commands/utils/wrap-with-loading-indicator.js.map +1 -1
- package/build/dev-panel/middleware.js +5 -10
- package/build/dev-panel/middleware.js.map +1 -1
- package/build/index.js +15 -13
- package/build/index.js.map +1 -1
- package/jest.config.ts +11 -0
- package/package.json +4 -7
- package/scripts/graphql-codegen.ts +23 -0
- package/templates/__template_common/.eslintrc.json +2 -119
- package/templates/__template_common/gitignore +1 -0
- package/templates/__template_common/package.json +8 -7
- package/templates/__template_common/src/manifest.json +1 -0
- package/templates/__template_hello_world/src/screens/BottomSheetScreen.tsx +6 -5
- package/templates/__template_hello_world/src/screens/QuizScreen.tsx +2 -2
- package/templates/__template_hello_world/src/screens/QuizSlideScreen.tsx +2 -2
- package/build/commands/check/index.d.ts +0 -6
- package/build/commands/check/index.js +0 -87
- package/build/commands/check/index.js.map +0 -1
- package/build/commands/check/utils/manifest.js +0 -26
- package/build/commands/check/utils/manifest.js.map +0 -1
- package/build/commands/check/utils/schemas/contextual-image.schema.json +0 -21
- package/build/commands/check/utils/schemas/contextual-object.schema.json +0 -17
- package/build/commands/check/utils/schemas/manifest.schema.json +0 -226
- package/build/commands/check/utils/schemas/visibility.schema.json +0 -17
- package/build/commands/check/utils/versions.d.ts +0 -1
- package/build/commands/check/utils/versions.js +0 -14
- package/build/commands/check/utils/versions.js.map +0 -1
- package/build/commands/dev/utils/binaries.test.d.ts +0 -1
- package/build/commands/dev/utils/binaries.test.js +0 -275
- package/build/commands/dev/utils/binaries.test.js.map +0 -1
- package/build/commands/dev/utils/minis-manifest.d.ts +0 -1
- package/build/commands/dev/utils/minis-manifest.js +0 -24
- package/build/commands/dev/utils/minis-manifest.js.map +0 -1
- package/templates/__template_hello_world/src/utils/getFlagEmoji.spec.tsx +0 -19
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
const schema = {
|
|
2
|
+
$schema: 'http://json-schema.org/draft-07/schema',
|
|
3
|
+
type: 'object',
|
|
4
|
+
title: 'Shop Mini Manifest',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
properties: {
|
|
7
|
+
name: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description: 'The name of the Mini',
|
|
10
|
+
maxLength: 20,
|
|
11
|
+
},
|
|
12
|
+
handle: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'A unique identifier for the Mini',
|
|
15
|
+
pattern: '^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$',
|
|
16
|
+
},
|
|
17
|
+
description: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The description of the Mini',
|
|
20
|
+
maxLength: 100,
|
|
21
|
+
},
|
|
22
|
+
icon_url: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
title: 'The icon of the Mini',
|
|
25
|
+
description: 'An absolute path to the image (e.g. https://example.com/icon.png)',
|
|
26
|
+
},
|
|
27
|
+
partner_name: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'The name of the Shopify partner who built the Mini',
|
|
30
|
+
maxLength: 20,
|
|
31
|
+
},
|
|
32
|
+
contact_email: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'An email address for receiving notifications.',
|
|
35
|
+
format: 'email',
|
|
36
|
+
},
|
|
37
|
+
shopify_app_ids: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
description: 'The list of Shopify app IDs associated with the Mini',
|
|
40
|
+
items: {
|
|
41
|
+
type: 'integer',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
notification_topics: {
|
|
45
|
+
type: 'array',
|
|
46
|
+
description: 'Specifies the reason for communication and the scope for messages. An example of a topic could be live streaming related notifications related to a merchant',
|
|
47
|
+
items: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
required: ['handle', 'description', 'scope'],
|
|
50
|
+
properties: {
|
|
51
|
+
handle: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Text identifier of the topic',
|
|
54
|
+
},
|
|
55
|
+
description: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Reason for the communication using the topic',
|
|
58
|
+
},
|
|
59
|
+
scope: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description:
|
|
62
|
+
// eslint-disable-next-line max-len
|
|
63
|
+
'The scope in which messages are processed for the topic. SHOP means each message will be processed in the scope of a specific merchant, PRODUCT means each message will be processed in the scope of a specific product',
|
|
64
|
+
enum: ['SHOP', 'PRODUCT'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
notification_templates: {
|
|
70
|
+
type: 'array',
|
|
71
|
+
description: 'Specify the message which will be sent to subscribers when notification is triggered by the mutation',
|
|
72
|
+
items: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
required: [
|
|
75
|
+
'handle',
|
|
76
|
+
'topic_handle',
|
|
77
|
+
'title',
|
|
78
|
+
'body',
|
|
79
|
+
'cooldown_minutes',
|
|
80
|
+
],
|
|
81
|
+
properties: {
|
|
82
|
+
handle: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Text identifier of the template',
|
|
85
|
+
},
|
|
86
|
+
topic_handle: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Reference to a notification topic',
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'Template of notification title, supports interpolation using the Liquid template language',
|
|
93
|
+
},
|
|
94
|
+
body: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
description: 'Template of notification body, supports interpolation using the Liquid template language',
|
|
97
|
+
},
|
|
98
|
+
cooldown_minutes: {
|
|
99
|
+
type: 'number',
|
|
100
|
+
description: 'How often the template allowes to send the exact same message to the same user, in minutes',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
entry_points: {
|
|
106
|
+
type: 'array',
|
|
107
|
+
description: 'A list of entry points that the Mini supports',
|
|
108
|
+
items: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
location: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
enum: ['PRODUCT_PAGE', 'STORE_PAGE'],
|
|
114
|
+
},
|
|
115
|
+
type: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
enum: ['CONTENT_CARD', 'ACTION_BUTTON', 'EVENT_CARD'],
|
|
118
|
+
},
|
|
119
|
+
primary_text: {
|
|
120
|
+
$ref: '/contextual-object.schema.js',
|
|
121
|
+
},
|
|
122
|
+
call_to_action_text: {
|
|
123
|
+
$ref: '/contextual-object.schema.js',
|
|
124
|
+
},
|
|
125
|
+
images: {
|
|
126
|
+
$ref: '/contextual-image.schema.js',
|
|
127
|
+
},
|
|
128
|
+
visibility: {
|
|
129
|
+
$ref: '/visibility.schema.js',
|
|
130
|
+
},
|
|
131
|
+
visibility_rule: {
|
|
132
|
+
$ref: '/visibility.schema.js',
|
|
133
|
+
},
|
|
134
|
+
pre_active_images: {
|
|
135
|
+
$ref: '/contextual-image.schema.js',
|
|
136
|
+
description: 'The images list used to render entry point in PRE_ACTIVE state',
|
|
137
|
+
},
|
|
138
|
+
post_active_images: {
|
|
139
|
+
$ref: '/contextual-image.schema.js',
|
|
140
|
+
description: '(Optional) The images list used to render entry point in POST_ACTIVE state',
|
|
141
|
+
},
|
|
142
|
+
notification_topic: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
description: 'The notification topic handle which Shop users could subscribe to, must match one from the notification_topics manifest section',
|
|
145
|
+
},
|
|
146
|
+
event_status: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
description: 'The status of related event, affects how the user can interact with entry point',
|
|
149
|
+
required: ['default_value'],
|
|
150
|
+
properties: {
|
|
151
|
+
namespace: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
},
|
|
154
|
+
key: {
|
|
155
|
+
type: 'string',
|
|
156
|
+
},
|
|
157
|
+
default_value: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
enum: ['PRE_ACTIVE', 'ACTIVE', 'POST_ACTIVE'],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
allOf: [
|
|
165
|
+
{
|
|
166
|
+
if: {
|
|
167
|
+
properties: {
|
|
168
|
+
type: {
|
|
169
|
+
const: 'CONTENT_CARD',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
then: {
|
|
174
|
+
required: ['location', 'type', 'primary_text', 'images'],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
if: {
|
|
179
|
+
properties: {
|
|
180
|
+
type: {
|
|
181
|
+
const: 'ACTION_BUTTON',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
then: {
|
|
186
|
+
required: ['location', 'type', 'call_to_action_text'],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
if: {
|
|
191
|
+
properties: {
|
|
192
|
+
type: {
|
|
193
|
+
const: 'EVENT_CARD',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
then: {
|
|
198
|
+
required: [
|
|
199
|
+
'location',
|
|
200
|
+
'type',
|
|
201
|
+
'primary_text',
|
|
202
|
+
'images',
|
|
203
|
+
'notification_topic',
|
|
204
|
+
'pre_active_images',
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
ios_app_store_url: {
|
|
212
|
+
type: 'string',
|
|
213
|
+
description: "The URL to the Mini's publisher's app on the iOS App Store",
|
|
214
|
+
},
|
|
215
|
+
android_play_store_url: {
|
|
216
|
+
type: 'string',
|
|
217
|
+
description: "The URL to the Mini's publisher's app on the Android Play Store",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
required: [
|
|
221
|
+
'name',
|
|
222
|
+
'handle',
|
|
223
|
+
'icon_url',
|
|
224
|
+
'partner_name',
|
|
225
|
+
'shopify_app_ids',
|
|
226
|
+
'entry_points',
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
export default schema;
|
|
230
|
+
//# sourceMappingURL=manifest.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.schema.js","sourceRoot":"","sources":["../../../src/commands/schemas/manifest.schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,wCAAwC;IACjD,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oBAAoB;IAC3B,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,sBAAsB;YACnC,SAAS,EAAE,EAAE;SACd;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kCAAkC;YAC/C,OAAO,EAAE,2DAA2D;SACrE;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6BAA6B;YAC1C,SAAS,EAAE,GAAG;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,KA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+1,18 @@
|
|
|
1
|
+
declare const schema: {
|
|
2
|
+
$id: string;
|
|
3
|
+
$schema: string;
|
|
4
|
+
type: string;
|
|
5
|
+
title: string;
|
|
6
|
+
properties: {
|
|
7
|
+
owner_type: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
namespace: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
key: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default schema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const schema = {
|
|
2
|
+
$id: '/visibility.schema.js',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema',
|
|
4
|
+
type: 'object',
|
|
5
|
+
title: 'Entry-point visibility schema',
|
|
6
|
+
properties: {
|
|
7
|
+
owner_type: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
namespace: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
key: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default schema;
|
|
19
|
+
//# sourceMappingURL=visibility.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.schema.js","sourceRoot":"","sources":["../../../src/commands/schemas/visibility.schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,GAAG,EAAE,uBAAuB;IAC5B,OAAO,EAAE,wCAAwC;IACjD,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,+BAA+B;IACtC,UAAU,EAAE;QACV,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;SACf;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;SACf;QACD,GAAG,EAAE;YACH,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const SUBMISSION_PATHS: {
|
|
2
|
+
SUBMISSION_CACHE_DIR: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const SUBMISSION_VALIDATION: {
|
|
5
|
+
SUBMISSION_DESCRIPTION_MAX_LENGTH: number;
|
|
6
|
+
SUBMISSION_FILE_SIZE_MAX_BYTES: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const generateSubmissionArchiveFilename: () => string;
|
|
9
|
+
export declare const getSubmissionArchivePath: (filename: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { PATHS } from '../config.js';
|
|
3
|
+
import { getMiniManifest } from '../utils/minis-manifest.js';
|
|
4
|
+
export const SUBMISSION_PATHS = {
|
|
5
|
+
SUBMISSION_CACHE_DIR: path.resolve(PATHS.CACHE_DIR, 'submissions'),
|
|
6
|
+
};
|
|
7
|
+
export const SUBMISSION_VALIDATION = {
|
|
8
|
+
SUBMISSION_DESCRIPTION_MAX_LENGTH: 256,
|
|
9
|
+
SUBMISSION_FILE_SIZE_MAX_BYTES: 1000000,
|
|
10
|
+
};
|
|
11
|
+
export const generateSubmissionArchiveFilename = () => {
|
|
12
|
+
const miniHandle = getMiniManifest().handle;
|
|
13
|
+
return `${miniHandle}-${String(Date.now())}.tar.gz`;
|
|
14
|
+
};
|
|
15
|
+
export const getSubmissionArchivePath = (filename) => {
|
|
16
|
+
return path.join(SUBMISSION_PATHS.SUBMISSION_CACHE_DIR, filename);
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/submit/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAA;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC;CACnE,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iCAAiC,EAAE,GAAG;IACtC,8BAA8B,EAAE,OAAO;CACxC,CAAA;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACpD,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,MAAM,CAAA;IAE3C,OAAO,GAAG,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAA;AACnE,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
2
|
+
import type { UnwrapArray } from '../types/helpers.js';
|
|
3
|
+
import { CreateSubmissionMutation, CreateUploadMutation, SubmissionsQuery } from '../types/autogenerated/shop-minis-admin-api/graphql.js';
|
|
4
|
+
import { CreateUploadParameters } from './graphql.js';
|
|
5
|
+
interface UserErrorShape {
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
field?: Array<string> | null;
|
|
9
|
+
}
|
|
10
|
+
interface WrapErrorOptions {
|
|
11
|
+
separator?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const wrapError: (error: any, message: string, userOptions?: WrapErrorOptions) => Error;
|
|
14
|
+
export declare const userErrorToErrorMessage: ({ code, message, field, }: UserErrorShape) => string;
|
|
15
|
+
export declare const handleCreateUploadErrors: (params: CreateUploadParameters, userErrors?: CreateUploadMutation['submissionUploadCreate']['userErrors']) => void;
|
|
16
|
+
export declare const generateExistingPendingSubmissionError: (pendingSubmission: UnwrapArray<SubmissionsQuery['submissions']['nodes']> | null) => Promise<AbortError>;
|
|
17
|
+
export declare const handleCreateSubmissionErrors: (userErrors?: CreateSubmissionMutation['submissionCreate']['userErrors']) => Promise<void>;
|
|
18
|
+
export declare const handleUploadFileErrors: (error: any) => never;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
2
|
+
import { formatPackageManagerCommand, outputDebug, } from '@shopify/cli-kit/node/output';
|
|
3
|
+
import { getPackageManager } from '../config.js';
|
|
4
|
+
import { getPendingSubmission } from './graphql.js';
|
|
5
|
+
const wrapErrorDefaultOptions = {
|
|
6
|
+
separator: ': ',
|
|
7
|
+
};
|
|
8
|
+
// Prefix an error with a nice message without loosing the stack
|
|
9
|
+
export const wrapError = (error, message, userOptions = {}) => {
|
|
10
|
+
const options = {
|
|
11
|
+
...wrapErrorDefaultOptions,
|
|
12
|
+
...userOptions,
|
|
13
|
+
};
|
|
14
|
+
const err = new Error(`${message}${options.separator}${error?.message ?? 'Unknown error'}`);
|
|
15
|
+
if (error && error?.stack) {
|
|
16
|
+
err.stack = error?.stack;
|
|
17
|
+
}
|
|
18
|
+
return err;
|
|
19
|
+
};
|
|
20
|
+
export const userErrorToErrorMessage = ({ code, message, field, }) => {
|
|
21
|
+
if (!field || field.length === 0)
|
|
22
|
+
return `${message}. (${code})`;
|
|
23
|
+
return `${message}. (${code} for fields ${field.join(', ')})`;
|
|
24
|
+
};
|
|
25
|
+
export const handleCreateUploadErrors = (params, userErrors) => {
|
|
26
|
+
if (!userErrors || userErrors.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const errorMessages = userErrors.map(userError => {
|
|
29
|
+
switch (userError.code) {
|
|
30
|
+
case 'INVALID_CHECKSUM':
|
|
31
|
+
return `Invalid checksum for uploaded archive: ${params.checksum}`;
|
|
32
|
+
case 'INVALID_FILE_SIZE':
|
|
33
|
+
return `Invalid file size for uploaded archive: ${params.fileSize}`;
|
|
34
|
+
case 'INVALID_MIME_TYPE':
|
|
35
|
+
return `Invalid mime type for uploaded archive: ${params.mimeType}`;
|
|
36
|
+
default:
|
|
37
|
+
return userErrorToErrorMessage(userError);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
throw new AbortError('There was a problem creating your upload', errorMessages);
|
|
41
|
+
};
|
|
42
|
+
export const generateExistingPendingSubmissionError = async (pendingSubmission) => {
|
|
43
|
+
outputDebug(`Existing pending submission found ${pendingSubmission ? JSON.stringify(pendingSubmission) : ''}`);
|
|
44
|
+
const errorMessage = pendingSubmission
|
|
45
|
+
? `The previous submission (reference: ${pendingSubmission.reference}) was submitted at ${pendingSubmission.submittedAt}.\n\n` +
|
|
46
|
+
`Status of ${pendingSubmission.reference}: ${pendingSubmission.status}`
|
|
47
|
+
: undefined;
|
|
48
|
+
return new AbortError('Already a submission under review', errorMessage, [
|
|
49
|
+
[
|
|
50
|
+
'Cancel previous submission. Run',
|
|
51
|
+
{
|
|
52
|
+
command: formatPackageManagerCommand(await getPackageManager(), 'cancel-submission'),
|
|
53
|
+
},
|
|
54
|
+
'to cancel',
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
'Cancel this submission. Do nothing else and wait for previous submission to be reviewed.',
|
|
58
|
+
],
|
|
59
|
+
]);
|
|
60
|
+
};
|
|
61
|
+
export const handleCreateSubmissionErrors = async (userErrors) => {
|
|
62
|
+
if (!userErrors || userErrors.length === 0)
|
|
63
|
+
return;
|
|
64
|
+
for (const userError of userErrors) {
|
|
65
|
+
if (userError.code === 'ALREADY_PENDING_SUBMISSION') {
|
|
66
|
+
const pendingSubmission = await getPendingSubmission();
|
|
67
|
+
throw await generateExistingPendingSubmissionError(pendingSubmission);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const errorMessages = userErrors.map(userError => {
|
|
71
|
+
switch (userError.code) {
|
|
72
|
+
case 'FILE_NOT_FOUND':
|
|
73
|
+
return `Your uploaded package could not be found`;
|
|
74
|
+
case 'UPLOAD_NOT_FOUND':
|
|
75
|
+
return `Your upload could not be found`;
|
|
76
|
+
default:
|
|
77
|
+
return userErrorToErrorMessage(userError);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
throw new AbortError('There was a problem creating your submission', errorMessages);
|
|
81
|
+
};
|
|
82
|
+
export const handleUploadFileErrors = (error) => {
|
|
83
|
+
throw wrapError(error, 'There was a problem with your upload\n\n', {
|
|
84
|
+
separator: '',
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/commands/submit/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,EACL,2BAA2B,EAC3B,WAAW,GACZ,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAA;AAQ9C,OAAO,EAAyB,oBAAoB,EAAC,MAAM,cAAc,CAAA;AAYzE,MAAM,uBAAuB,GAAqB;IAChD,SAAS,EAAE,IAAI;CAChB,CAAA;AAED,gEAAgE;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAU,EACV,OAAe,EACf,cAAgC,EAAE,EAClC,EAAE;IACF,MAAM,OAAO,GAAG;QACd,GAAG,uBAAuB;QAC1B,GAAG,WAAW;KACf,CAAA;IAED,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,GAAG,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,CACrE,CAAA;IAED,IAAI,KAAK,IAAI,KAAK,EAAE,KAAK,EAAE;QACzB,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,CAAA;KACzB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAA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
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fetch } from '@shopify/cli-kit/node/http';
|
|
3
|
+
export const uploadFile = async ({ url, headers, filepath, }) => {
|
|
4
|
+
await fetch(url, {
|
|
5
|
+
method: 'PUT',
|
|
6
|
+
headers,
|
|
7
|
+
body: readFileSync(filepath),
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=gcs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcs.js","sourceRoot":"","sources":["../../../src/commands/submit/gcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAC,KAAK,EAAC,MAAM,4BAA4B,CAAA;AAQhD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,EAC/B,GAAG,EACH,OAAO,EACP,QAAQ,GACa,EAAE,EAAE;IACzB,MAAM,KAAK,CAAC,GAAG,EAAE;QACf,MAAM,EAAE,KAAK;QACb,OAAO;QACP,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;KAC7B,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface QueryUserErrors {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
field: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface CreateUploadParameters {
|
|
7
|
+
filename: string;
|
|
8
|
+
fileSize: number;
|
|
9
|
+
checksum: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const createUpload: ({ filename, fileSize, checksum, mimeType, }: CreateUploadParameters) => Promise<{
|
|
13
|
+
__typename?: "SubmissionUploadCreatePayload" | undefined;
|
|
14
|
+
upload?: {
|
|
15
|
+
__typename?: "StagedUpload" | undefined;
|
|
16
|
+
url: any;
|
|
17
|
+
headers: string;
|
|
18
|
+
id: string;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
userErrors: {
|
|
21
|
+
__typename?: "SubmissionUploadCreateUserError" | undefined;
|
|
22
|
+
code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionUploadCreateUserErrorCode;
|
|
23
|
+
message: string;
|
|
24
|
+
field?: string[] | null | undefined;
|
|
25
|
+
}[];
|
|
26
|
+
}>;
|
|
27
|
+
export interface CreateSubmissionParameters {
|
|
28
|
+
description: string;
|
|
29
|
+
uploadId: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const createSubmission: ({ description, uploadId, }: CreateSubmissionParameters) => Promise<{
|
|
32
|
+
__typename?: "SubmissionCreatePayload" | undefined;
|
|
33
|
+
submission?: {
|
|
34
|
+
__typename?: "Submission" | undefined;
|
|
35
|
+
reference: string;
|
|
36
|
+
description: string;
|
|
37
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
38
|
+
submittedAt: any;
|
|
39
|
+
} | null | undefined;
|
|
40
|
+
userErrors: {
|
|
41
|
+
__typename?: "SubmissionCreateUserError" | undefined;
|
|
42
|
+
code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionCreateUserErrorCode;
|
|
43
|
+
message: string;
|
|
44
|
+
field?: string[] | null | undefined;
|
|
45
|
+
}[];
|
|
46
|
+
}>;
|
|
47
|
+
export interface GetSubmissionsParameters {
|
|
48
|
+
first?: number;
|
|
49
|
+
}
|
|
50
|
+
export declare const getSubmissions: ({ first, }?: GetSubmissionsParameters | undefined) => Promise<{
|
|
51
|
+
__typename?: "SubmissionConnection" | undefined;
|
|
52
|
+
nodes: {
|
|
53
|
+
__typename?: "Submission" | undefined;
|
|
54
|
+
reference: string;
|
|
55
|
+
description: string;
|
|
56
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
57
|
+
submittedAt: any;
|
|
58
|
+
}[];
|
|
59
|
+
pageInfo: {
|
|
60
|
+
__typename?: "PageInfo" | undefined;
|
|
61
|
+
hasNextPage: boolean;
|
|
62
|
+
hasPreviousPage: boolean;
|
|
63
|
+
startCursor?: string | null | undefined;
|
|
64
|
+
endCursor?: string | null | undefined;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
export declare function getPendingSubmission(): Promise<{
|
|
68
|
+
__typename?: "Submission" | undefined;
|
|
69
|
+
reference: string;
|
|
70
|
+
description: string;
|
|
71
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
72
|
+
submittedAt: any;
|
|
73
|
+
} | null>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
|
|
3
|
+
import { SHOP_MINIS_ADMIN_API, SHOP_MINIS_ADMIN_API_KEY } from '../config.js';
|
|
4
|
+
const client = new GraphQLClient(SHOP_MINIS_ADMIN_API, {
|
|
5
|
+
headers: {
|
|
6
|
+
Authorization: `Bearer ${SHOP_MINIS_ADMIN_API_KEY}`,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
const createUploadQuery = graphql(/* GraphQL */ `
|
|
10
|
+
mutation CreateUpload(
|
|
11
|
+
$filename: String!
|
|
12
|
+
$fileSize: Int!
|
|
13
|
+
$checksum: String!
|
|
14
|
+
$mimeType: String!
|
|
15
|
+
) {
|
|
16
|
+
submissionUploadCreate(
|
|
17
|
+
input: {
|
|
18
|
+
filename: $filename
|
|
19
|
+
fileSize: $fileSize
|
|
20
|
+
checksum: $checksum
|
|
21
|
+
mimeType: $mimeType
|
|
22
|
+
}
|
|
23
|
+
) {
|
|
24
|
+
upload {
|
|
25
|
+
url
|
|
26
|
+
headers
|
|
27
|
+
id
|
|
28
|
+
}
|
|
29
|
+
userErrors {
|
|
30
|
+
code
|
|
31
|
+
message
|
|
32
|
+
field
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`);
|
|
37
|
+
export const createUpload = async ({ filename, fileSize, checksum, mimeType, }) => {
|
|
38
|
+
const data = await client.request(createUploadQuery, {
|
|
39
|
+
filename,
|
|
40
|
+
fileSize,
|
|
41
|
+
checksum,
|
|
42
|
+
mimeType,
|
|
43
|
+
}, {});
|
|
44
|
+
return data.submissionUploadCreate;
|
|
45
|
+
};
|
|
46
|
+
const createSubmissionQuery = graphql(/* GraphQL */ `
|
|
47
|
+
mutation CreateSubmission($description: String!, $uploadId: ID!) {
|
|
48
|
+
submissionCreate(description: $description, uploadId: $uploadId) {
|
|
49
|
+
submission {
|
|
50
|
+
reference
|
|
51
|
+
description
|
|
52
|
+
status
|
|
53
|
+
submittedAt
|
|
54
|
+
}
|
|
55
|
+
userErrors {
|
|
56
|
+
code
|
|
57
|
+
message
|
|
58
|
+
field
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`);
|
|
63
|
+
export const createSubmission = async ({ description, uploadId, }) => {
|
|
64
|
+
const data = await client.request(createSubmissionQuery, {
|
|
65
|
+
description,
|
|
66
|
+
uploadId,
|
|
67
|
+
}, {});
|
|
68
|
+
return data.submissionCreate;
|
|
69
|
+
};
|
|
70
|
+
const getSubmissionQuery = graphql(/* GraphQL */ `
|
|
71
|
+
query Submissions($first: Int) {
|
|
72
|
+
submissions(first: $first) {
|
|
73
|
+
nodes {
|
|
74
|
+
reference
|
|
75
|
+
description
|
|
76
|
+
status
|
|
77
|
+
submittedAt
|
|
78
|
+
}
|
|
79
|
+
pageInfo {
|
|
80
|
+
hasNextPage
|
|
81
|
+
hasPreviousPage
|
|
82
|
+
startCursor
|
|
83
|
+
endCursor
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`);
|
|
88
|
+
export const getSubmissions = async ({ first = 10, } = {}) => {
|
|
89
|
+
const data = await client.request(getSubmissionQuery, { first }, {});
|
|
90
|
+
return data.submissions;
|
|
91
|
+
};
|
|
92
|
+
export async function getPendingSubmission() {
|
|
93
|
+
const submissions = await getSubmissions();
|
|
94
|
+
const pendingSubmissions = submissions.nodes.filter(submission => submission.status === 'PENDING');
|
|
95
|
+
// There should only ever be one
|
|
96
|
+
if (pendingSubmissions.length)
|
|
97
|
+
return pendingSubmissions[0];
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/commands/submit/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAC1E,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAE3E,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,oBAAoB,EAAE;IACrD,OAAO,EAAE;QACP,aAAa,EAAE,UAAU,wBAAwB,EAAE;KACpD;CACF,CAAC,CAAA;AAQF,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B/C,CAAC,CAAA;AASF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACe,EAAE,EAAE;IAC3B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,iBAAiB,EACjB;QACE,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;KACT,EACD,EAAE,CACH,CAAA;IAED,OAAO,IAAI,CAAC,sBAAsB,CAAA;AACpC,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;CAgBnD,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,WAAW,EACX,QAAQ,GACmB,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,qBAAqB,EACrB;QACE,WAAW;QACX,QAAQ;KACT,EACD,EAAE,CACH,CAAA;IAED,OAAO,IAAI,CAAC,gBAAgB,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;CAiBhD,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,KAAK,GAAG,EAAE,MAC8B,EAAE,EAAE,EAAE;IAC9C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAA;IAElE,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAA;IAC1C,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CACjD,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,CAC9C,CAAA;IAED,gCAAgC;IAChC,IAAI,kBAAkB,CAAC,MAAM;QAAE,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAA;IAE3D,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { outputDebug } from '@shopify/cli-kit/node/output';
|
|
3
|
+
import { getMiniManifest } from '../utils/minis-manifest.js';
|
|
4
|
+
import { completeConfig, doSubmit, preSubmitChecks } from './submit.js';
|
|
5
|
+
export function loadCommand(parentProgram) {
|
|
6
|
+
const command = new Command()
|
|
7
|
+
.name('submit')
|
|
8
|
+
.description('submit your mini app')
|
|
9
|
+
.option('--description [description]', 'submission description - describes the change')
|
|
10
|
+
.option('--verbose', 'print debugging messages') // compatible with cli-kit
|
|
11
|
+
.action(async (args) => {
|
|
12
|
+
const miniHandle = getMiniManifest().handle;
|
|
13
|
+
outputDebug(`Submit args ${JSON.stringify(args)}`);
|
|
14
|
+
outputDebug(`Submitting mini "${miniHandle}" at ${process.cwd()}`);
|
|
15
|
+
await preSubmitChecks();
|
|
16
|
+
const config = await completeConfig(args);
|
|
17
|
+
await doSubmit(config);
|
|
18
|
+
});
|
|
19
|
+
parentProgram.addCommand(command);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/submit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAC,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAC,MAAM,aAAa,CAAA;AAGrE,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;SAC1B,IAAI,CAAC,QAAQ,CAAC;SACd,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CACL,6BAA6B,EAC7B,+CAA+C,CAChD;SACA,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,0BAA0B;SAC1E,MAAM,CAAC,KAAK,EAAE,IAAuB,EAAE,EAAE;QACxC,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,MAAM,CAAA;QAE3C,WAAW,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAClD,WAAW,CAAC,oBAAoB,UAAU,QAAQ,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAElE,MAAM,eAAe,EAAE,CAAA;QACvB,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAA;QACzC,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;IAEJ,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
|