@shopify/cli-kit 2.0.13 → 3.0.1

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.
@@ -2190,7 +2190,7 @@ class ArrayPrompt$3 extends Prompt$5 {
2190
2190
  let len = this.choices.length;
2191
2191
  let num = this.num;
2192
2192
 
2193
- let handle = (val, res) => {
2193
+ let handle = (val = false, res) => {
2194
2194
  clearTimeout(this.numberTimeout);
2195
2195
  if (val) res = number(num);
2196
2196
  this.num = '';
@@ -2810,7 +2810,7 @@ const utils$r = utils$z;
2810
2810
  * @api public
2811
2811
  */
2812
2812
 
2813
- var placeholder$2 = (prompt, options) => {
2813
+ var placeholder$2 = (prompt, options = {}) => {
2814
2814
  prompt.cursorHide();
2815
2815
 
2816
2816
  let { input = '', initial = '', pos, showCursor = true, color } = options;
@@ -4059,7 +4059,7 @@ class Item {
4059
4059
  }
4060
4060
  }
4061
4061
 
4062
- const tokenize = async(options = {}, defaults, fn = token => token) => {
4062
+ const tokenize = async(options = {}, defaults = {}, fn = token => token) => {
4063
4063
  let unique = new Set();
4064
4064
  let fields = options.fields || [];
4065
4065
  let input = options.template;
@@ -5610,7 +5610,7 @@ async function pLocate$2(
5610
5610
  {
5611
5611
  concurrency = Number.POSITIVE_INFINITY,
5612
5612
  preserveOrder = true,
5613
- },
5613
+ } = {},
5614
5614
  ) {
5615
5615
  const limit = pLimit$3(concurrency);
5616
5616
 
@@ -5677,7 +5677,7 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
5677
5677
 
5678
5678
  const findUpStop = Symbol('findUpStop');
5679
5679
 
5680
- async function findUpMultiple(name, options) {
5680
+ async function findUpMultiple(name, options = {}) {
5681
5681
  let directory = path$I.resolve(toPath(options.cwd) || '');
5682
5682
  const {root} = path$I.parse(directory);
5683
5683
  const stopAt = path$I.resolve(directory, options.stopAt || root);
@@ -6611,7 +6611,7 @@ const invalidStep = (step, options) => {
6611
6611
  return [];
6612
6612
  };
6613
6613
 
6614
- const fillNumbers = (start, end, step = 1, options) => {
6614
+ const fillNumbers = (start, end, step = 1, options = {}) => {
6615
6615
  let a = Number(start);
6616
6616
  let b = Number(end);
6617
6617
 
@@ -6663,7 +6663,7 @@ const fillNumbers = (start, end, step = 1, options) => {
6663
6663
  return range;
6664
6664
  };
6665
6665
 
6666
- const fillLetters = (start, end, step = 1, options) => {
6666
+ const fillLetters = (start, end, step = 1, options = {}) => {
6667
6667
  if ((!isNumber$3(start) && start.length > 1) || (!isNumber$3(end) && end.length > 1)) {
6668
6668
  return invalidRange(start, end, options);
6669
6669
  }
@@ -12317,7 +12317,7 @@ var path$w = /*#__PURE__*/Object.freeze({
12317
12317
  });
12318
12318
 
12319
12319
  var name = "@shopify/cli-kit";
12320
- var version$4 = "2.0.13";
12320
+ var version$4 = "3.0.1";
12321
12321
  var description$1 = "A set of utilities, interfaces, and models that are common across all the platform features";
12322
12322
  var keywords = [
12323
12323
  "shopify",
@@ -12432,11 +12432,11 @@ var cliKitPackageJson = {
12432
12432
  devDependencies: devDependencies
12433
12433
  };
12434
12434
 
12435
- var version$3 = "2.0.13";
12435
+ var version$3 = "3.0.1";
12436
12436
 
12437
- var version$2 = "2.0.13";
12437
+ var version$2 = "3.0.1";
12438
12438
 
12439
- var version$1 = "2.0.13";
12439
+ var version$1 = "3.0.1";
12440
12440
 
12441
12441
  const homedir$1 = os$8.homedir();
12442
12442
  const tmpdir$1 = os$8.tmpdir();
@@ -13225,7 +13225,7 @@ function npmRunPath(options = {}) {
13225
13225
  return [...result, path_].join(path$I.delimiter);
13226
13226
  }
13227
13227
 
13228
- function npmRunPathEnv({env = process$2.env, ...options}) {
13228
+ function npmRunPathEnv({env = process$2.env, ...options} = {}) {
13229
13229
  env = {...env};
13230
13230
 
13231
13231
  const path = pathKey({env});
@@ -14674,13 +14674,22 @@ const exec$2 = (command, args, options) => {
14674
14674
  cwd: options?.cwd,
14675
14675
  input: options?.stdin
14676
14676
  });
14677
+ debug$5(`
14678
+ Running system process:
14679
+ \xB7 Command: ${command} ${args.join(" ")}
14680
+ \xB7 Working directory: ${options?.cwd ?? process.cwd()}
14681
+ `);
14677
14682
  if (options?.stderr) {
14678
14683
  commandProcess.stderr?.pipe(options.stderr);
14679
14684
  }
14680
14685
  if (options?.stdout) {
14681
14686
  commandProcess.stdout?.pipe(options.stdout);
14682
14687
  }
14683
- return commandProcess;
14688
+ return commandProcess.catch((processError) => {
14689
+ const abortError = new Abort(processError.message);
14690
+ abortError.stack = processError.stack;
14691
+ throw abortError;
14692
+ });
14684
14693
  };
14685
14694
  const concurrentExec = async (commands) => {
14686
14695
  await concurrent(commands.map((command) => {
@@ -19029,7 +19038,7 @@ const rmkidsSync = (p, options) => {
19029
19038
  var rimraf_1 = rimraf$1;
19030
19039
  rimraf$1.sync = rimrafSync;
19031
19040
 
19032
- var indentString$3 = (string, count, options) => {
19041
+ var indentString$3 = (string, count = 1, options) => {
19033
19042
  options = {
19034
19043
  indent: ' ',
19035
19044
  includeEmptyLines: false,
@@ -19306,7 +19315,9 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19306
19315
  });
19307
19316
  }
19308
19317
 
19309
- const mapper = async (file, fileIndex) => {
19318
+ let deletedCount = 0;
19319
+
19320
+ const mapper = async file => {
19310
19321
  file = path$a.resolve(cwd, file);
19311
19322
 
19312
19323
  if (!force) {
@@ -19317,10 +19328,12 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19317
19328
  await rimrafP(file, rimrafOptions);
19318
19329
  }
19319
19330
 
19331
+ deletedCount += 1;
19332
+
19320
19333
  onProgress({
19321
19334
  totalCount: files.length,
19322
- deletedCount: fileIndex,
19323
- percent: fileIndex / files.length
19335
+ deletedCount,
19336
+ percent: deletedCount / files.length
19324
19337
  });
19325
19338
 
19326
19339
  return file;
@@ -19328,12 +19341,6 @@ del$2.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress
19328
19341
 
19329
19342
  const removedFiles = await pMap(files, mapper, options);
19330
19343
 
19331
- onProgress({
19332
- totalCount: files.length,
19333
- deletedCount: files.length,
19334
- percent: 1
19335
- });
19336
-
19337
19344
  removedFiles.sort((a, b) => a.localeCompare(b));
19338
19345
 
19339
19346
  return removedFiles;
@@ -21094,7 +21101,7 @@ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
21094
21101
  }
21095
21102
 
21096
21103
  class ContentToken {
21097
- constructor(value, metadata, type) {
21104
+ constructor(value, metadata = {}, type) {
21098
21105
  this.type = type;
21099
21106
  this.value = value;
21100
21107
  this.metadata = metadata;
@@ -21116,32 +21123,43 @@ const token = {
21116
21123
  subheading: (value) => {
21117
21124
  return new ContentToken(value, {}, 4 /* SubHeading */);
21118
21125
  },
21126
+ italic: (value) => {
21127
+ return new ContentToken(value, {}, 5 /* Italic */);
21128
+ },
21119
21129
  errorText: (value) => {
21120
- return new ContentToken(value, {}, 5 /* ErrorText */);
21130
+ return new ContentToken(value, {}, 6 /* ErrorText */);
21121
21131
  },
21122
21132
  cyan: (value) => {
21123
- return new ContentToken(value, {}, 7 /* Cyan */);
21133
+ return new ContentToken(value, {}, 8 /* Cyan */);
21124
21134
  },
21125
21135
  yellow: (value) => {
21126
- return new ContentToken(value, {}, 6 /* Yellow */);
21136
+ return new ContentToken(value, {}, 7 /* Yellow */);
21127
21137
  },
21128
21138
  magenta: (value) => {
21129
- return new ContentToken(value, {}, 8 /* Magenta */);
21139
+ return new ContentToken(value, {}, 9 /* Magenta */);
21130
21140
  },
21131
21141
  green: (value) => {
21132
- return new ContentToken(value, {}, 9 /* Green */);
21142
+ return new ContentToken(value, {}, 10 /* Green */);
21133
21143
  },
21134
- command: (dependencyManager, scriptNameAndArgs) => {
21135
- return new ContentToken(formatPackageManagerCommand(dependencyManager, scriptNameAndArgs), {}, 0 /* Command */);
21144
+ command: (dependencyManager, scriptName, ...scriptArgs) => {
21145
+ return new ContentToken(formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs), {}, 0 /* Command */);
21136
21146
  }
21137
21147
  };
21138
- function formatPackageManagerCommand(dependencyManager, scriptNameAndArgs) {
21148
+ function formatPackageManagerCommand(dependencyManager, scriptName, scriptArgs) {
21139
21149
  switch (dependencyManager) {
21140
- case "yarn":
21141
- return `yarn ${scriptNameAndArgs}`;
21150
+ case "yarn": {
21151
+ const pieces = ["yarn", scriptName, ...scriptArgs];
21152
+ return pieces.join(" ");
21153
+ }
21142
21154
  case "pnpm":
21143
- case "npm":
21144
- return `${dependencyManager} run ${scriptNameAndArgs}`;
21155
+ case "npm": {
21156
+ const pieces = [dependencyManager, "run", scriptName];
21157
+ if (scriptArgs.length > 0) {
21158
+ pieces.push("--");
21159
+ pieces.push(...scriptArgs);
21160
+ }
21161
+ return pieces.join(" ");
21162
+ }
21145
21163
  }
21146
21164
  }
21147
21165
  class TokenizedString {
@@ -21177,19 +21195,22 @@ function content(strings, ...keys) {
21177
21195
  case 4 /* SubHeading */:
21178
21196
  output += colors$9.underline(enumToken.value);
21179
21197
  break;
21180
- case 5 /* ErrorText */:
21198
+ case 5 /* Italic */:
21199
+ output += colors$9.italic(enumToken.value);
21200
+ break;
21201
+ case 6 /* ErrorText */:
21181
21202
  output += colors$9.bold.redBright(enumToken.value);
21182
21203
  break;
21183
- case 6 /* Yellow */:
21204
+ case 7 /* Yellow */:
21184
21205
  output += colors$9.yellow(enumToken.value);
21185
21206
  break;
21186
- case 7 /* Cyan */:
21207
+ case 8 /* Cyan */:
21187
21208
  output += colors$9.cyan(enumToken.value);
21188
21209
  break;
21189
- case 8 /* Magenta */:
21210
+ case 9 /* Magenta */:
21190
21211
  output += colors$9.magenta(enumToken.value);
21191
21212
  break;
21192
- case 9 /* Green */:
21213
+ case 10 /* Green */:
21193
21214
  output += colors$9.green(enumToken.value);
21194
21215
  break;
21195
21216
  }
@@ -21305,7 +21326,7 @@ function stringifyMessage(message2) {
21305
21326
  return message2;
21306
21327
  }
21307
21328
  }
21308
- const message = (content2, level) => {
21329
+ const message = (content2, level = "info") => {
21309
21330
  if (shouldOutput(level)) {
21310
21331
  consoleLog(stringifyMessage(content2));
21311
21332
  }
@@ -21315,7 +21336,8 @@ async function concurrent(processes) {
21315
21336
  const concurrentColors = [token.yellow, token.cyan, token.magenta, token.green];
21316
21337
  const prefixColumnSize = Math.max(...processes.map((process2) => process2.prefix.length));
21317
21338
  function linePrefix(prefix, index) {
21318
- const color = concurrentColors[0];
21339
+ const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length;
21340
+ const color = concurrentColors[colorIndex];
21319
21341
  return color(`${prefix}${" ".repeat(prefixColumnSize - prefix.length)} ${colors$9.bold("|")} `);
21320
21342
  }
21321
21343
  try {
@@ -21324,7 +21346,7 @@ async function concurrent(processes) {
21324
21346
  write(chunk, _encoding, next) {
21325
21347
  const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString("ascii")).split(/\n/);
21326
21348
  for (const line of lines) {
21327
- info(content`${linePrefix(process2.prefix)}${line}`);
21349
+ info(content`${linePrefix(process2.prefix, index)}${line}`);
21328
21350
  }
21329
21351
  next();
21330
21352
  }
@@ -21333,7 +21355,7 @@ async function concurrent(processes) {
21333
21355
  write(chunk, _encoding, next) {
21334
21356
  const lines = stripAnsiEraseCursorEscapeCharacters(chunk.toString("ascii")).split(/\n/);
21335
21357
  for (const line of lines) {
21336
- message(content`${linePrefix(process2.prefix)}${colors$9.bold("ERROR")} ${line}`, "error");
21358
+ message(content`${linePrefix(process2.prefix, index)}${colors$9.bold("ERROR")} ${line}`, "error");
21337
21359
  }
21338
21360
  next();
21339
21361
  }
@@ -21439,7 +21461,8 @@ var error$j = /*#__PURE__*/Object.freeze({
21439
21461
  AbortSilent: AbortSilent,
21440
21462
  Bug: Bug,
21441
21463
  handler: handler,
21442
- mapper: mapper$1
21464
+ mapper: mapper$1,
21465
+ AbortSignal: AbortSignal
21443
21466
  });
21444
21467
 
21445
21468
  /******************************************************************************
@@ -26317,14 +26340,14 @@ const prompt = async (questions) => {
26317
26340
  async function nonEmptyDirectoryPrompt(directory) {
26318
26341
  if (await exists$1(directory)) {
26319
26342
  const options = [
26320
- { name: "Yes, remove the files", value: "overwrite" },
26321
- { name: "No, abort the command", value: "abort" }
26343
+ { name: "No, don\u2019t delete the files", value: "abort" },
26344
+ { name: "Yes, delete the files", value: "overwrite" }
26322
26345
  ];
26323
26346
  const relativeDirectory = relative(process.cwd(), directory);
26324
26347
  const questions = {
26325
26348
  type: "select",
26326
26349
  name: "value",
26327
- message: `${relativeDirectory} is not an empty directory. Do you want to remove the existing files and continue?`,
26350
+ message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,
26328
26351
  choices: options
26329
26352
  };
26330
26353
  const choice = await prompt([questions]);
@@ -35593,7 +35616,7 @@ function isTaskError(result) {
35593
35616
  function getErrorMessage(result) {
35594
35617
  return Buffer.concat([...result.stdOut, ...result.stdErr]);
35595
35618
  }
35596
- function errorDetectionHandler(overwrite, isError = isTaskError, errorMessage = getErrorMessage) {
35619
+ function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
35597
35620
  return (error, result) => {
35598
35621
  if (!overwrite && error || !isError(result)) {
35599
35622
  return error;
@@ -40106,7 +40129,7 @@ try {
40106
40129
  const POOL_SIZE = 65536;
40107
40130
 
40108
40131
  /** @param {(Blob | Uint8Array)[]} parts */
40109
- async function * toIterator (parts, clone) {
40132
+ async function * toIterator (parts, clone = true) {
40110
40133
  for (const part of parts) {
40111
40134
  if ('stream' in part) {
40112
40135
  yield * (/** @type {AsyncIterableIterator<Uint8Array>} */ (part.stream()));
@@ -40648,7 +40671,7 @@ class Body$1 {
40648
40671
  return formData;
40649
40672
  }
40650
40673
 
40651
- const {toFormData} = await import('./multipart-parser-2aa3d069.js');
40674
+ const {toFormData} = await import('./multipart-parser-9b32947f.js');
40652
40675
  return toFormData(this.body, ct);
40653
40676
  }
40654
40677
 
@@ -41301,7 +41324,7 @@ class Response$3 extends Body$1 {
41301
41324
  * @param {number} status An optional status code for the response (e.g., 302.)
41302
41325
  * @returns {Response} A Response object.
41303
41326
  */
41304
- static redirect(url, status) {
41327
+ static redirect(url, status = 302) {
41305
41328
  if (!isRedirect(status)) {
41306
41329
  throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
41307
41330
  }
@@ -54567,7 +54590,8 @@ function parseRepoUrl(src) {
54567
54590
  const subDirectory = match[6]?.slice(1);
54568
54591
  const ref = match[7] || "HEAD";
54569
54592
  const ssh = `git@${normalizedSite}:${user}/${name}`;
54570
- return { site: normalizedSite, user, name, ref, subDirectory, ssh };
54593
+ const http = `https://${normalizedSite}/${user}/${name}`;
54594
+ return { site: normalizedSite, user, name, ref, subDirectory, ssh, http };
54571
54595
  }
54572
54596
 
54573
54597
  var github = /*#__PURE__*/Object.freeze({
@@ -58020,7 +58044,7 @@ var decompressResponse = response => {
58020
58044
  };
58021
58045
 
58022
58046
  class QuickLRU$2 {
58023
- constructor(options) {
58047
+ constructor(options = {}) {
58024
58048
  if (!(options.maxSize && options.maxSize > 0)) {
58025
58049
  throw new TypeError('`maxSize` must be a number greater than 0');
58026
58050
  }
@@ -65887,7 +65911,7 @@ const compare = compare_1;
65887
65911
  // - If no C has a prerelease and the LT.semver tuple, return false
65888
65912
  // - Else return true
65889
65913
 
65890
- const subset = (sub, dom, options) => {
65914
+ const subset = (sub, dom, options = {}) => {
65891
65915
  if (sub === dom) {
65892
65916
  return true
65893
65917
  }
@@ -84244,7 +84268,7 @@ var mimicFn_1 = mimicFn$1;
84244
84268
 
84245
84269
  const mimicFn = mimicFn_1;
84246
84270
 
84247
- var debounceFn = (inputFunction, options) => {
84271
+ var debounceFn = (inputFunction, options = {}) => {
84248
84272
  if (typeof inputFunction !== 'function') {
84249
84273
  throw new TypeError(`Expected the first argument to be a function, got \`${typeof inputFunction}\``);
84250
84274
  }
@@ -84816,6 +84840,7 @@ function setAppInfo(options) {
84816
84840
  apps[index] = {
84817
84841
  appId: options.appId,
84818
84842
  directory: options.directory,
84843
+ title: options.title ?? app.title,
84819
84844
  storeFqdn: options.storeFqdn ?? app.storeFqdn,
84820
84845
  orgId: options.orgId ?? app.orgId
84821
84846
  };
@@ -84860,6 +84885,18 @@ async function buildHeaders(token) {
84860
84885
  };
84861
84886
  return headers;
84862
84887
  }
84888
+ function sanitizedHeadersOutput(headers) {
84889
+ const sanitized = {};
84890
+ const keywords = ["token", "authorization"];
84891
+ Object.keys(headers).forEach((header) => {
84892
+ if (keywords.find((keyword) => header.toLocaleLowerCase().includes(keyword)) === void 0) {
84893
+ sanitized[header] = headers[header];
84894
+ }
84895
+ });
84896
+ return Object.keys(sanitized).map((header) => {
84897
+ return ` - ${header}: ${sanitized[header]}`;
84898
+ }).join("\n");
84899
+ }
84863
84900
 
84864
84901
  var dist$1 = {};
84865
84902
 
@@ -170582,7 +170619,7 @@ const printDocASTReducer = {
170582
170619
  * print all items together separated by separator if provided
170583
170620
  */
170584
170621
 
170585
- function join(maybeArray, separator) {
170622
+ function join(maybeArray, separator = '') {
170586
170623
  var _maybeArray$filter$jo;
170587
170624
 
170588
170625
  return (_maybeArray$filter$jo =
@@ -171890,17 +171927,28 @@ function HeadersInstanceToPlainObject(headers) {
171890
171927
 
171891
171928
  }(dist$1));
171892
171929
 
171930
+ const UnauthorizedAccessError = () => {
171931
+ return new Bug(`You can't use Shopify CLI with development stores if you only have Partner staff member access.
171932
+ If you want to use Shopify CLI to work on a development store, then you should be the store owner or create a staff account on the store`, `If you're the store owner, then you need to log in to the store directly using the store URL at least once (for example, using %s.myshopify.com/admin) before you log in using Shopify CLI.
171933
+ Logging in to the Shopify admin directly connects the development store with your Shopify login.`);
171934
+ };
171935
+ const UnknownError = () => {
171936
+ return new Bug(`Unknown error connecting to your store`);
171937
+ };
171893
171938
  async function request$1(query, session, variables) {
171894
- debug$5(`
171895
- Sending Admin GraphQL request:
171896
- ${query}
171897
-
171898
- With variables:
171899
- ${variables ? JSON.stringify(variables, null, 2) : ""}
171900
- `);
171901
171939
  const version = await fetchApiVersion(session);
171902
171940
  const url = adminUrl(session.storeFqdn, version);
171903
171941
  const headers = await buildHeaders(session.token);
171942
+ debug$5(`
171943
+ Sending Admin GraphQL request:
171944
+ ${query}
171945
+
171946
+ With variables:
171947
+ ${variables ? JSON.stringify(variables, null, 2) : ""}
171948
+
171949
+ And headers:
171950
+ ${sanitizedHeadersOutput(headers)}
171951
+ `);
171904
171952
  return dist$1.request(url, query, variables, headers);
171905
171953
  }
171906
171954
  async function fetchApiVersion(session) {
@@ -171911,7 +171959,9 @@ async function fetchApiVersion(session) {
171911
171959
  Sending Admin GraphQL request to URL ${url} with query:
171912
171960
  ${query}
171913
171961
  `);
171914
- const data = await dist$1.request(url, query, {}, headers);
171962
+ const data = await dist$1.request(url, query, {}, headers).catch((err) => {
171963
+ throw err.response.status === 403 ? UnauthorizedAccessError() : UnknownError();
171964
+ });
171915
171965
  return data.publicApiVersions.filter((item) => item.supported).map((item) => item.handle).sort().reverse()[0];
171916
171966
  }
171917
171967
  function adminUrl(store, version) {
@@ -171944,6 +171994,9 @@ ${query}
171944
171994
 
171945
171995
  With variables:
171946
171996
  ${variables ? JSON.stringify(variables, null, 2) : ""}
171997
+
171998
+ And headers:
171999
+ ${sanitizedHeadersOutput(headers)}
171947
172000
  `);
171948
172001
  return dist$1.request(url, query, variables, headers);
171949
172002
  }
@@ -172143,6 +172196,55 @@ const ExtensionCreateQuery = dist$1.gql`
172143
172196
  }
172144
172197
  `;
172145
172198
 
172199
+ const ExtensionSpecificationsQuery = dist$1.gql`
172200
+ query fetchSpecifications($api_key: String!) {
172201
+ extensionSpecifications(apiKey: $api_key) {
172202
+ name
172203
+ identifier
172204
+ options {
172205
+ managementExperience
172206
+ }
172207
+ features {
172208
+ argo {
172209
+ surface
172210
+ }
172211
+ }
172212
+ }
172213
+ }
172214
+ `;
172215
+
172216
+ const AllAppExtensionRegistrationsQuery = dist$1.gql`
172217
+ query allAppExtensionRegistrations($apiKey: String!) {
172218
+ app(apiKey: $apiKey) {
172219
+ extensionRegistrations {
172220
+ id
172221
+ uuid
172222
+ title
172223
+ type
172224
+ }
172225
+ }
172226
+ }
172227
+ `;
172228
+
172229
+ const FindProductVariantQuery = dist$1.gql`
172230
+ query {
172231
+ products(first: 1) {
172232
+ edges {
172233
+ node {
172234
+ id
172235
+ variants(first: 1) {
172236
+ edges {
172237
+ node {
172238
+ id
172239
+ }
172240
+ }
172241
+ }
172242
+ }
172243
+ }
172244
+ }
172245
+ }
172246
+ `;
172247
+
172146
172248
  var index = /*#__PURE__*/Object.freeze({
172147
172249
  __proto__: null,
172148
172250
  FindOrganizationQuery: FindOrganizationQuery,
@@ -172155,7 +172257,10 @@ var index = /*#__PURE__*/Object.freeze({
172155
172257
  CreateDeployment: CreateDeployment,
172156
172258
  AllStoresByOrganizationQuery: AllStoresByOrganizationQuery,
172157
172259
  ConvertDevToTestStoreQuery: ConvertDevToTestStoreQuery,
172158
- ExtensionCreateQuery: ExtensionCreateQuery
172260
+ ExtensionCreateQuery: ExtensionCreateQuery,
172261
+ ExtensionSpecificationsQuery: ExtensionSpecificationsQuery,
172262
+ AllAppExtensionRegistrationsQuery: AllAppExtensionRegistrationsQuery,
172263
+ FindProductVariantQuery: FindProductVariantQuery
172159
172264
  });
172160
172265
 
172161
172266
  var api = /*#__PURE__*/Object.freeze({
@@ -172413,9 +172518,10 @@ var semver = /*#__PURE__*/Object.freeze({
172413
172518
  });
172414
172519
 
172415
172520
  const RubyCLIVersion = "2.16.0";
172521
+ const ThemeCheckVersion = "1.10.2";
172416
172522
  const MinBundlerVersion = "2.3.8";
172417
172523
  async function execCLI(args, adminSession) {
172418
- await installDependencies();
172524
+ await installCLIDependencies();
172419
172525
  const env = {
172420
172526
  ...process.env,
172421
172527
  SHOPIFY_CLI_ADMIN_AUTH_TOKEN: adminSession?.token,
@@ -172424,21 +172530,69 @@ async function execCLI(args, adminSession) {
172424
172530
  spawn$1("bundle", ["exec", "shopify"].concat(args), {
172425
172531
  stdio: "inherit",
172426
172532
  shell: true,
172427
- cwd: rubyCLIPath(),
172533
+ cwd: shopifyCLIDirectory(),
172428
172534
  env
172429
172535
  });
172430
172536
  }
172431
- async function installDependencies() {
172432
- const exists = await exists$1(rubyCLIPath());
172433
- const renderer = isUnitTest() || exists ? "silent" : "default";
172537
+ async function execThemeCheckCLI({
172538
+ directories,
172539
+ args,
172540
+ stdout,
172541
+ stderr
172542
+ }) {
172543
+ await installThemeCheckCLIDependencies(stdout);
172544
+ const processes = directories.map(async (directory) => {
172545
+ const files = await out(join$3(directory, "/**/*"));
172546
+ const fileCount = files.filter((file2) => !file2.match(/\.toml$/)).length;
172547
+ if (fileCount === 0)
172548
+ return;
172549
+ const customStderr = new Writable$1({
172550
+ write(chunk, ...args2) {
172551
+ if (chunk.toString("ascii").match(/^Checking/)) {
172552
+ stdout.write(chunk, ...args2);
172553
+ } else {
172554
+ stderr.write(chunk, ...args2);
172555
+ }
172556
+ }
172557
+ });
172558
+ await exec$2("bundle", ["exec", "theme-check"].concat([directory, ...args || []]), {
172559
+ stdout,
172560
+ stderr: customStderr,
172561
+ cwd: themeCheckDirectory()
172562
+ });
172563
+ });
172564
+ return Promise.all(processes);
172565
+ }
172566
+ async function installThemeCheckCLIDependencies(stdout) {
172567
+ const exists = await exists$1(themeCheckDirectory());
172568
+ if (!exists)
172569
+ stdout.write("Installing theme dependencies...");
172570
+ const list = new Listr([
172571
+ {
172572
+ title: "Installing theme dependencies",
172573
+ task: async () => {
172574
+ await validateRubyEnv();
172575
+ await createThemeCheckCLIWorkingDirectory();
172576
+ await createThemeCheckGemfile();
172577
+ await bundleInstallThemeCheck();
172578
+ }
172579
+ }
172580
+ ], { renderer: "silent" });
172581
+ await list.run();
172582
+ if (!exists)
172583
+ stdout.write("Installed theme dependencies!");
172584
+ }
172585
+ async function installCLIDependencies() {
172586
+ const exists = await exists$1(shopifyCLIDirectory());
172587
+ const renderer = exists ? "silent" : "default";
172434
172588
  const list = new Listr([
172435
172589
  {
172436
172590
  title: "Installing theme dependencies",
172437
172591
  task: async () => {
172438
172592
  await validateRubyEnv();
172439
- await createWorkingDirectory();
172440
- await createGemfile();
172441
- await bundleInstall();
172593
+ await createShopifyCLIWorkingDirectory();
172594
+ await createShopifyCLIGemfile();
172595
+ await bundleInstallShopifyCLI();
172442
172596
  }
172443
172597
  }
172444
172598
  ], { renderer });
@@ -172464,25 +172618,41 @@ async function getBundlerVersion() {
172464
172618
  throw new Abort("Bundler not found", "Make sure you have Bundler installed on your system: https://bundler.io/");
172465
172619
  }
172466
172620
  }
172467
- function createWorkingDirectory() {
172468
- return mkdir(rubyCLIPath());
172621
+ function createShopifyCLIWorkingDirectory() {
172622
+ return mkdir(shopifyCLIDirectory());
172469
172623
  }
172470
- async function createGemfile() {
172471
- const gemPath = join$3(rubyCLIPath(), "Gemfile");
172624
+ function createThemeCheckCLIWorkingDirectory() {
172625
+ return mkdir(themeCheckDirectory());
172626
+ }
172627
+ async function createShopifyCLIGemfile() {
172628
+ const gemPath = join$3(shopifyCLIDirectory(), "Gemfile");
172472
172629
  await write$1(gemPath, `source 'https://rubygems.org'
172473
172630
  gem 'shopify-cli', '${RubyCLIVersion}'`);
172474
172631
  }
172475
- async function bundleInstall() {
172476
- await exec$2("bundle", ["config", "set", "--local", "path", rubyCLIPath()], { cwd: rubyCLIPath() });
172477
- await exec$2("bundle", ["install"], { cwd: rubyCLIPath() });
172632
+ async function createThemeCheckGemfile() {
172633
+ const gemPath = join$3(themeCheckDirectory(), "Gemfile");
172634
+ await write$1(gemPath, `source 'https://rubygems.org'
172635
+ gem 'theme-check', '${ThemeCheckVersion}'`);
172636
+ }
172637
+ async function bundleInstallShopifyCLI() {
172638
+ await exec$2("bundle", ["config", "set", "--local", "path", shopifyCLIDirectory()], { cwd: shopifyCLIDirectory() });
172639
+ await exec$2("bundle", ["install"], { cwd: shopifyCLIDirectory() });
172478
172640
  }
172479
- function rubyCLIPath() {
172641
+ async function bundleInstallThemeCheck() {
172642
+ await exec$2("bundle", ["config", "set", "--local", "path", themeCheckDirectory()], { cwd: themeCheckDirectory() });
172643
+ await exec$2("bundle", ["install"], { cwd: themeCheckDirectory() });
172644
+ }
172645
+ function shopifyCLIDirectory() {
172480
172646
  return join$3(constants$2.paths.directories.cache.vendor.path(), "ruby-cli", RubyCLIVersion);
172481
172647
  }
172648
+ function themeCheckDirectory() {
172649
+ return join$3(constants$2.paths.directories.cache.vendor.path(), "theme-check", ThemeCheckVersion);
172650
+ }
172482
172651
 
172483
172652
  var ruby = /*#__PURE__*/Object.freeze({
172484
172653
  __proto__: null,
172485
- execCLI: execCLI
172654
+ execCLI: execCLI,
172655
+ execThemeCheckCLI: execThemeCheckCLI
172486
172656
  });
172487
172657
 
172488
172658
  async function readPackageJSON(directory) {
@@ -172795,4 +172965,4 @@ var plugins = /*#__PURE__*/Object.freeze({
172795
172965
  });
172796
172966
 
172797
172967
  export { npm as A, port as B, cli as C, id as D, temporary as E, FormData$3 as F, dotEnv as G, constants$2 as H, plugins as I, File$1 as a, string as b, github as c, dependency as d, error$j as e, file$1 as f, git as g, os$2 as h, environment as i, session as j, schema$2 as k, toml as l, store as m, api as n, output as o, path$w as p, http$2 as q, archiver as r, system as s, template as t, ui as u, version as v, checksum as w, ruby as x, yaml as y, semver as z };
172798
- //# sourceMappingURL=index-814fd0de.js.map
172968
+ //# sourceMappingURL=index-fbaf7cec.js.map