@shopify/shop-minis-cli 0.0.77 → 0.0.78

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.
@@ -136,9 +136,6 @@
136
136
  "type": {
137
137
  "type": "string",
138
138
  "enum": [
139
- "CONTENT_CARD",
140
- "ACTION_BUTTON",
141
- "EVENT_CARD",
142
139
  "LINK",
143
140
  "DEFAULT_CARD",
144
141
  "IMAGE_COLLECTION",
@@ -146,60 +143,9 @@
146
143
  "EVENT_CARD_V2",
147
144
  "PRODUCT_OFFER_CARD"
148
145
  ]
149
- },
150
- "primary_text": { "$ref": "/contextual-object.schema.json" },
151
- "call_to_action_text": { "$ref": "/contextual-object.schema.json" },
152
- "images": { "$ref": "/contextual-image.schema.json" },
153
- "visibility": { "$ref": "/visibility.schema.json" },
154
- "visibility_rule": { "$ref": "/visibility.schema.json" },
155
- "pre_active_images": {
156
- "$ref": "/contextual-image.schema.json",
157
- "description": "The images list used to render entry point in PRE_ACTIVE state"
158
- },
159
- "post_active_images": {
160
- "$ref": "/contextual-image.schema.json",
161
- "description": "(Optional) The images list used to render entry point in POST_ACTIVE state"
162
- },
163
- "notification_topic": {
164
- "type": "string",
165
- "description": "The notification topic handle which Shop users could subscribe to, must match one from the notification_topics manifest section"
166
- },
167
- "event_status": {
168
- "type": "object",
169
- "description": "The status of related event, affects how the user can interact with entry point",
170
- "required": ["default_value"],
171
- "properties": {
172
- "namespace": { "type": "string" },
173
- "key": { "type": "string" },
174
- "default_value": {
175
- "type": "string",
176
- "enum": ["PRE_ACTIVE", "ACTIVE", "POST_ACTIVE"]
177
- }
178
- }
179
146
  }
180
147
  },
181
148
  "allOf": [
182
- {
183
- "if": { "properties": { "type": { "const": "CONTENT_CARD" } } },
184
- "then": { "required": ["location", "type", "primary_text", "images"] }
185
- },
186
- {
187
- "if": { "properties": { "type": { "const": "ACTION_BUTTON" } } },
188
- "then": { "required": ["location", "type", "call_to_action_text"] }
189
- },
190
- {
191
- "if": { "properties": { "type": { "const": "EVENT_CARD" } } },
192
- "then": {
193
- "required": [
194
- "location",
195
- "type",
196
- "primary_text",
197
- "images",
198
- "notification_topic",
199
- "pre_active_images"
200
- ]
201
- }
202
- },
203
149
  {
204
150
  "if": { "properties": { "type": { "const": "LINK" } } },
205
151
  "then": { "required": ["location"] }
@@ -1,7 +1,5 @@
1
- import { Validator } from 'jsonschema';
2
1
  export declare const DEFAULT_MANIFEST_PATH: string;
3
2
  export declare function getMiniManifest(manifestPath?: string): any;
4
- export declare function getValidator(): Validator;
5
3
  export declare function validateManifest(manifestPath?: string): {
6
4
  valid: boolean;
7
5
  errors: string[];
@@ -1,9 +1,7 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import path from 'node:path';
3
3
  import { Validator } from 'jsonschema';
4
- import contextualImageSchema from '../schemas/contextual-image.schema.json' assert { type: 'json' };
5
- import contextualObjectSchema from '../schemas/contextual-object.schema.json' assert { type: 'json' };
6
- import visibilitySchema from '../schemas/visibility.schema.json' assert { type: 'json' };
4
+ import { AbortError } from '@shopify/cli-kit/node/error';
7
5
  import manifestSchema from '../schemas/manifest.schema.json' assert { type: 'json' };
8
6
  const manifestRequire = createRequire(import.meta.url);
9
7
  export const DEFAULT_MANIFEST_PATH = path.join('src', 'manifest.json');
@@ -40,26 +38,14 @@ export function getMiniManifest(manifestPath = DEFAULT_MANIFEST_PATH) {
40
38
  }
41
39
  return manifest;
42
40
  }
43
- export function getValidator() {
44
- const validator = new Validator();
45
- // The filenames here seem to relate to the ones inside the files themselves
46
- // rather than their exact filepath. We use `js` because at runtime they are
47
- // compiled by ts and are imported from the `build` directory
48
- validator.addSchema(contextualImageSchema, '/contextual-image.schema.json');
49
- validator.addSchema(contextualObjectSchema, '/contextual-object.schema.json');
50
- validator.addSchema(visibilitySchema, '/visibility.schema.json');
51
- return validator;
52
- }
41
+ const V1_ENTRYPOINTS = ['CONTENT_CARD', 'ACTION_BUTTON', 'EVENT_CARD'];
53
42
  export function validateManifest(manifestPath) {
54
43
  const manifest = getMiniManifest(manifestPath);
55
44
  const validator = new Validator();
56
- // The filenames here seem to relate to the ones inside the files themselves
57
- // rather than their exact filepath. We use `js` because at runtime they are
58
- // compiled by ts and are imported from the `build` directory
59
- validator.addSchema(contextualImageSchema, '/contextual-image.schema.json');
60
- validator.addSchema(contextualObjectSchema, '/contextual-object.schema.json');
61
- validator.addSchema(visibilitySchema, '/visibility.schema.json');
62
45
  const result = validator.validate(manifest, manifestSchema);
46
+ if (manifest.entry_points?.some((entry_point) => entry_point.type && V1_ENTRYPOINTS.includes(entry_point.type))) {
47
+ throw new AbortError(`${V1_ENTRYPOINTS} entry points are no longer supported and must be removed from the manifest.`);
48
+ }
63
49
  return {
64
50
  valid: result.valid,
65
51
  errors: result.errors.map(validationError => validationError.stack),
@@ -1 +1 @@
1
- {"version":3,"file":"minis-manifest.js","sourceRoot":"","sources":["../../src/utils/minis-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAA;AAEpC,OAAO,qBAAqB,MAAM,yCAAyC,CAAC,SAAQ,IAAI,EAAE,MAAM,EAAC,CAAA;AACjG,OAAO,sBAAsB,MAAM,0CAA0C,CAAC,SAAQ,IAAI,EAAE,MAAM,EAAC,CAAA;AACnG,OAAO,gBAAgB,MAAM,mCAAmC,CAAC,SAAQ,IAAI,EAAE,MAAM,EAAC,CAAA;AACtF,OAAO,cAAc,MAAM,iCAAiC,CAAC,SAAQ,IAAI,EAAE,MAAM,EAAC,CAAA;AAElF,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;AAEtE,MAAM,UAAU,eAAe,CAA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CAAC,YAAqB;IACpD,MAAM,QAAQ,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAA;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAE3D,IACE,QAAQ,CAAC,YAAY,EAAE,IAAI,CACzB,CAAC,WAA4B,EAAE,EAAE,CAC/B,WAAW,CAAC,IAAI,IAAI,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAChE,EACD;QACA,MAAM,IAAI,UAAU,CAClB,GAAG,cAAc,8EAA8E,CAChG,CAAA;KACF;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;KACpE,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "@shopify:registry": "https://registry.npmjs.org/"
6
6
  },
7
- "version": "0.0.77",
7
+ "version": "0.0.78",
8
8
  "description": "Shop Minis CLI",
9
9
  "main": "build/index.js",
10
10
  "bin": {
@@ -1,12 +0,0 @@
1
- {
2
- "$id": "/contextual-image.schema.json",
3
- "$schema": "http://json-schema.org/draft-07/schema",
4
- "type": "object",
5
- "title": "Contextual image entry-point",
6
- "required": ["default_value"],
7
- "properties": {
8
- "namespace": { "type": "string" },
9
- "key": { "type": "string" },
10
- "default_value": { "type": "array", "items": { "type": "string" } }
11
- }
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "$id": "/contextual-object.schema.json",
3
- "$schema": "http://json-schema.org/draft-07/schema",
4
- "type": "object",
5
- "title": "Contextual entry-point",
6
- "properties": {
7
- "namespace": { "type": "string" },
8
- "key": { "type": "string" },
9
- "default_value": { "type": "string" }
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "$id": "/visibility.schema.json",
3
- "$schema": "http://json-schema.org/draft-07/schema",
4
- "type": "object",
5
- "title": "Entry-point visibility schema",
6
- "properties": {
7
- "owner_type": { "type": "string" },
8
- "namespace": { "type": "string" },
9
- "key": { "type": "string" }
10
- }
11
- }