@shopify/cli 3.0.13 → 3.0.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @shopify/cli
2
2
 
3
+ ## 3.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - eb915dee: Loose version requirements to help dependency managers dedupe dependencies
8
+ - a750e67c: Improve dependency upgrade messages to leverage new shopify upgrade command
9
+ - Updated dependencies [eb915dee]
10
+ - Updated dependencies [85ee088d]
11
+ - Updated dependencies [2ecbff43]
12
+ - Updated dependencies [a750e67c]
13
+ - @shopify/cli-kit@3.0.16
14
+
15
+ ## 3.0.15
16
+
17
+ ### Patch Changes
18
+
19
+ - 99378ca0: Push dependency manager detection into cli-kit
20
+ - 99378ca0: Add command to upgrade all project types
21
+ - Updated dependencies [c3b711ec]
22
+ - Updated dependencies [99378ca0]
23
+ - @shopify/cli-kit@3.0.15
24
+
25
+ ## 3.0.14
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [8f82bd36]
30
+ - Updated dependencies [ae3823c8]
31
+ - Updated dependencies [8f82bd36]
32
+ - Updated dependencies [c383ed42]
33
+ - @shopify/cli-kit@3.0.14
34
+
3
35
  ## 3.0.13
4
36
 
5
37
  ### Patch Changes
@@ -0,0 +1,70 @@
1
+ import { Flags, Command } from '@oclif/core';
2
+ import { path, error, output, file, dependency } from '@shopify/cli-kit';
3
+
4
+ const _Upgrade = class extends Command {
5
+ async run() {
6
+ const { flags } = await this.parse(_Upgrade);
7
+ const directory = flags.path ? path.resolve(flags.path) : process.cwd();
8
+ const projectDir = await this.getProjectDir(directory);
9
+ if (!projectDir) {
10
+ throw new error.Abort(output.content`Couldn't find the configuration file for ${output.token.path(directory)}, are you in a Shopify project directory?`);
11
+ }
12
+ const packageJson = JSON.parse(await file.read(path.join(projectDir, "package.json")));
13
+ const packageJsonDependencies = packageJson.dependencies || {};
14
+ const packageJsonDevDependencies = packageJson.devDependencies || {};
15
+ const cliDependency = "@shopify/cli";
16
+ let currentVersion = { ...packageJsonDependencies, ...packageJsonDevDependencies }[cliDependency];
17
+ if (currentVersion.slice(0, 1).match(/[\^~]/))
18
+ currentVersion = this.config.version;
19
+ const newestVersion = await dependency.checkForNewVersion(cliDependency, currentVersion);
20
+ if (!newestVersion) {
21
+ output.info(output.content`You're on the latest version, ${output.token.yellow(currentVersion)}, no need to upgrade!`);
22
+ return;
23
+ }
24
+ output.info(output.content`Upgrading CLI from ${output.token.yellow(currentVersion)} to ${output.token.yellow(newestVersion)}...`);
25
+ await this.installJsonDependencies("prod", packageJsonDependencies, projectDir);
26
+ await this.installJsonDependencies("dev", packageJsonDevDependencies, projectDir);
27
+ output.success(`Upgraded Shopify CLI to version ${newestVersion}`);
28
+ }
29
+ async getProjectDir(directory) {
30
+ return path.findUp(async (dir) => {
31
+ const configFilesExist = await Promise.all(["shopify.app.toml", "hydrogen.config.js", "hydrogen.config.ts"].map(async (configFile) => {
32
+ return file.exists(path.join(dir, configFile));
33
+ }));
34
+ if (configFilesExist.some((bool) => bool))
35
+ return dir;
36
+ }, {
37
+ cwd: directory,
38
+ type: "directory"
39
+ });
40
+ }
41
+ async installJsonDependencies(depsEnv, deps, directory) {
42
+ const packages = ["@shopify/cli", "@shopify/app", "@shopify/cli-hydrogen"];
43
+ const packagesToUpdate = packages.filter((pkg) => {
44
+ const pkgRequirement = deps[pkg];
45
+ return Boolean(pkgRequirement);
46
+ });
47
+ if (packagesToUpdate.length > 0) {
48
+ await dependency.addLatestNPMDependencies(packagesToUpdate, {
49
+ dependencyManager: await dependency.getDependencyManager(directory),
50
+ type: depsEnv,
51
+ directory,
52
+ stdout: process.stdout,
53
+ stderr: process.stderr
54
+ });
55
+ }
56
+ }
57
+ };
58
+ let Upgrade = _Upgrade;
59
+ Upgrade.description = "Upgrade the Shopify CLI";
60
+ Upgrade.flags = {
61
+ path: Flags.string({
62
+ hidden: false,
63
+ description: "The path to your project directory.",
64
+ parse: (input, _) => Promise.resolve(path.resolve(input)),
65
+ env: "SHOPIFY_FLAG_PATH"
66
+ })
67
+ };
68
+
69
+ export { Upgrade as default };
70
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sources":["../../src/cli/commands/upgrade.ts"],"sourcesContent":["import {Command, Flags} from '@oclif/core'\nimport {dependency, error, file, output, path} from '@shopify/cli-kit'\n\nexport default class Upgrade extends Command {\n static description = 'Upgrade the Shopify CLI'\n\n static flags = {\n path: Flags.string({\n hidden: false,\n description: 'The path to your project directory.',\n parse: (input, _) => Promise.resolve(path.resolve(input)),\n env: 'SHOPIFY_FLAG_PATH',\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Upgrade)\n const directory = flags.path ? path.resolve(flags.path) : process.cwd()\n\n const projectDir = await this.getProjectDir(directory)\n if (!projectDir) {\n throw new error.Abort(\n output.content`Couldn't find the configuration file for ${output.token.path(\n directory,\n )}, are you in a Shopify project directory?`,\n )\n }\n const packageJson = JSON.parse(await file.read(path.join(projectDir, 'package.json')))\n const packageJsonDependencies: {[key: string]: string} = packageJson.dependencies || {}\n const packageJsonDevDependencies: {[key: string]: string} = packageJson.devDependencies || {}\n\n const cliDependency = '@shopify/cli'\n let currentVersion: string = {...packageJsonDependencies, ...packageJsonDevDependencies}[cliDependency]\n if (currentVersion.slice(0, 1).match(/[\\^~]/)) currentVersion = this.config.version\n const newestVersion = await dependency.checkForNewVersion(cliDependency, currentVersion)\n\n if (!newestVersion) {\n output.info(\n output.content`You're on the latest version, ${output.token.yellow(currentVersion)}, no need to upgrade!`,\n )\n return\n }\n\n output.info(\n output.content`Upgrading CLI from ${output.token.yellow(currentVersion)} to ${output.token.yellow(\n newestVersion,\n )}...`,\n )\n\n await this.installJsonDependencies('prod', packageJsonDependencies, projectDir)\n await this.installJsonDependencies('dev', packageJsonDevDependencies, projectDir)\n\n output.success(`Upgraded Shopify CLI to version ${newestVersion}`)\n }\n\n async getProjectDir(directory: string) {\n return path.findUp(\n async (dir: string) => {\n const configFilesExist = await Promise.all(\n ['shopify.app.toml', 'hydrogen.config.js', 'hydrogen.config.ts'].map(async (configFile) => {\n return file.exists(path.join(dir, configFile))\n }),\n )\n if (configFilesExist.some((bool) => bool)) return dir\n },\n {\n cwd: directory,\n type: 'directory',\n },\n )\n }\n\n async installJsonDependencies(\n depsEnv: dependency.DependencyType,\n deps: {[key: string]: string},\n directory: string,\n ): Promise<void> {\n const packages = ['@shopify/cli', '@shopify/app', '@shopify/cli-hydrogen']\n const packagesToUpdate = packages.filter((pkg: string): boolean => {\n const pkgRequirement: string | undefined = deps[pkg]\n return Boolean(pkgRequirement)\n })\n\n if (packagesToUpdate.length > 0) {\n await dependency.addLatestNPMDependencies(packagesToUpdate, {\n dependencyManager: await dependency.getDependencyManager(directory),\n type: depsEnv,\n directory,\n stdout: process.stdout,\n stderr: process.stderr,\n })\n }\n }\n}\n"],"names":[],"mappings":";;;AAGA,MAAqB,QAAA,GAArB,cAAqC,OAAQ,CAAA;AAAA,EAY3C,MAAM,GAAqB,GAAA;AACzB,IAAA,MAAM,EAAC,KAAA,EAAA,GAAS,MAAM,IAAA,CAAK,MAAM,QAAO,CAAA,CAAA;AACxC,IAAM,MAAA,SAAA,GAAY,MAAM,IAAO,GAAA,IAAA,CAAK,QAAQ,KAAM,CAAA,IAAI,CAAI,GAAA,OAAA,CAAQ,GAAI,EAAA,CAAA;AAEtE,IAAA,MAAM,UAAa,GAAA,MAAM,IAAK,CAAA,aAAA,CAAc,SAAS,CAAA,CAAA;AACrD,IAAA,IAAI,CAAC,UAAY,EAAA;AACf,MAAM,MAAA,IAAI,MAAM,KACd,CAAA,MAAA,CAAO,mDAAmD,MAAO,CAAA,KAAA,CAAM,IACrE,CAAA,SACF,CACF,CAAA,yCAAA,CAAA,CAAA,CAAA;AAAA,KACF;AACA,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,KAAA,CAAM,MAAM,IAAA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CAAA,MAAA;AAAA,QAChB,QAAQ,OAAQ,CAAA,MAAA;AAAA,OACjB,CAAA,CAAA;AAAA,KACH;AAAA,GACF;AACF,CAAA,CAAA;AA1FA,IAAqB,OAArB,GAAA,SAAA;AAAqB,QACZ,WAAc,GAAA,yBAAA,CAAA;AADF,QAGZ,KAAQ,GAAA;AAAA,EACb,IAAA,EAAM,MAAM,MAAO,CAAA;AAAA,IACjB,MAAQ,EAAA,KAAA;AAAA,IACR,WAAa,EAAA,qCAAA;AAAA,IACb,KAAA,EAAO,CAAC,KAAO,EAAA,CAAA,KAAM,QAAQ,OAAQ,CAAA,IAAA,CAAK,OAAQ,CAAA,KAAK,CAAC,CAAA;AAAA,IACxD,GAAK,EAAA,mBAAA;AAAA,GACN,CAAA;AACH,CAAA;;;;"}
@@ -8,8 +8,7 @@ const _Version = class extends Command {
8
8
  output.info(output.content`Current ${_Version.description}: ${output.token.yellow(currentVersion)}`.value);
9
9
  const lastVersion = await dependency.checkForNewVersion(cliDependency, currentVersion);
10
10
  if (lastVersion) {
11
- output.info(output.content` Latest ${_Version.description}: ${output.token.yellow(lastVersion)}\nšŸ’”`);
12
- output.info(dependency.getOutputUpdateCLIReminder(dependency.dependencyManagerUsedForCreating(), [cliDependency]));
11
+ output.info(dependency.getOutputUpdateCLIReminder(dependency.dependencyManagerUsedForCreating(), lastVersion));
13
12
  }
14
13
  }
15
14
  getCurrentVersion() {
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../src/cli/commands/version.ts"],"sourcesContent":["import {Command} from '@oclif/core'\nimport {output, dependency} from '@shopify/cli-kit'\n\nexport default class Version extends Command {\n static description = 'Shopify CLI version'\n\n async run(): Promise<void> {\n const cliDependency = '@shopify/cli'\n const currentVersion = this.getCurrentVersion()\n output.info(output.content`Current ${Version.description}: ${output.token.yellow(currentVersion)}`.value)\n const lastVersion = await dependency.checkForNewVersion(cliDependency, currentVersion)\n if (lastVersion) {\n output.info(output.content` Latest ${Version.description}: ${output.token.yellow(lastVersion)}\\nšŸ’”`)\n output.info(dependency.getOutputUpdateCLIReminder(dependency.dependencyManagerUsedForCreating(), [cliDependency]))\n }\n }\n\n getCurrentVersion(): string {\n return this.config.version\n }\n}\n"],"names":[],"mappings":";;;AAGA,MAAqB,QAAA,GAArB,cAAqC,OAAQ,CAAA;AAAA,EAG3C,MAAM,GAAqB,GAAA;AACzB,IAAA,MAAM,aAAgB,GAAA,cAAA,CAAA;AACtB,IAAM,MAAA,cAAA,GAAiB,KAAK,iBAAkB,EAAA,CAAA;AAC9C,IAAO,MAAA,CAAA,IAAA,CAAK,MAAO,CAAA,OAAA,CAAA,QAAA,EAAkB,QAAQ,CAAA,WAAA,CAAA,EAAA,EAAgB,OAAO,KAAM,CAAA,MAAA,CAAO,cAAc,CAAA,CAAA,CAAA,CAAI,KAAK,CAAA,CAAA;AACxG,IAAA,MAAM,WAAc,GAAA,MAAM,UAAW,CAAA,kBAAA,CAAmB,eAAe,cAAc,CAAA,CAAA;AACrF,IAAA,IAAI,WAAa,EAAA;AACf,MAAO,MAAA,CAAA,IAAA,CAAK,OAAO,OAAkB,CAAA,QAAA,EAAA,QAAA,CAAQ,gBAAgB,MAAO,CAAA,KAAA,CAAM,MAAO,CAAA,WAAW,CAAO,CAAA,IAAA,CAAA,CAAA,CAAA;AACnG,MAAO,MAAA,CAAA,IAAA,CAAK,WAAW,0BAA2B,CAAA,UAAA,CAAW,kCAAoC,EAAA,CAAC,aAAa,CAAC,CAAC,CAAA,CAAA;AAAA,KACnH;AAAA,GACF;AAAA,EAEA,iBAA4B,GAAA;AAC1B,IAAA,OAAO,KAAK,MAAO,CAAA,OAAA,CAAA;AAAA,GACrB;AACF,CAAA,CAAA;AAjBA,IAAqB,OAArB,GAAA,SAAA;AAAqB,QACZ,WAAc,GAAA,qBAAA;;;;"}
1
+ {"version":3,"file":"version.js","sources":["../../src/cli/commands/version.ts"],"sourcesContent":["import {Command} from '@oclif/core'\nimport {output, dependency} from '@shopify/cli-kit'\n\nexport default class Version extends Command {\n static description = 'Shopify CLI version'\n\n async run(): Promise<void> {\n const cliDependency = '@shopify/cli'\n const currentVersion = this.getCurrentVersion()\n output.info(output.content`Current ${Version.description}: ${output.token.yellow(currentVersion)}`.value)\n const lastVersion = await dependency.checkForNewVersion(cliDependency, currentVersion)\n if (lastVersion) {\n output.info(dependency.getOutputUpdateCLIReminder(dependency.dependencyManagerUsedForCreating(), lastVersion))\n }\n }\n\n getCurrentVersion(): string {\n return this.config.version\n }\n}\n"],"names":[],"mappings":";;;AAGA,MAAqB,QAAA,GAArB,cAAqC,OAAQ,CAAA;AAAA,EAG3C,MAAM,GAAqB,GAAA;AACzB,IAAA,MAAM,aAAgB,GAAA,cAAA,CAAA;AACtB,IAAM,MAAA,cAAA,GAAiB,KAAK,iBAAkB,EAAA,CAAA;AAC9C,IAAO,MAAA,CAAA,IAAA,CAAK,MAAO,CAAA,OAAA,CAAA,QAAA,EAAkB,QAAQ,CAAA,WAAA,CAAA,EAAA,EAAgB,OAAO,KAAM,CAAA,MAAA,CAAO,cAAc,CAAA,CAAA,CAAA,CAAI,KAAK,CAAA,CAAA;AACxG,IAAA,MAAM,WAAc,GAAA,MAAM,UAAW,CAAA,kBAAA,CAAmB,eAAe,cAAc,CAAA,CAAA;AACrF,IAAA,IAAI,WAAa,EAAA;AACf,MAAA,MAAA,CAAO,KAAK,UAAW,CAAA,0BAAA,CAA2B,WAAW,gCAAiC,EAAA,EAAG,WAAW,CAAC,CAAA,CAAA;AAAA,KAC/G;AAAA,GACF;AAAA,EAEA,iBAA4B,GAAA;AAC1B,IAAA,OAAO,KAAK,MAAO,CAAA,OAAA,CAAA;AAAA,GACrB;AACF,CAAA,CAAA;AAhBA,IAAqB,OAArB,GAAA,SAAA;AAAqB,QACZ,WAAc,GAAA,qBAAA;;;;"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { settings, run, flush } from '@oclif/core';
2
2
  import Bugsnag from '@bugsnag/js';
3
3
  import { environment, error } from '@shopify/cli-kit';
4
4
 
5
- var version = "3.0.13";
5
+ var version = "3.0.16";
6
6
 
7
7
  function runCLI() {
8
8
  if (environment.local.isDebug()) {
@@ -1,6 +1,6 @@
1
1
  import { http, output, path, store, os, ruby, environment } from '@shopify/cli-kit';
2
2
 
3
- var version = "3.0.13";
3
+ var version = "3.0.16";
4
4
 
5
5
  const url = "https://monorail-edge.shopifysvc.com/v1/produce";
6
6
  const reportEvent = async (command, args) => {
@@ -30,6 +30,14 @@ const buildPayload = async (command, args = [], currentTime) => {
30
30
  }
31
31
  const appInfo = store.getAppInfo(directory);
32
32
  const { platform, arch } = os.platformAndArch();
33
+ const rawPartnerId = appInfo?.orgId;
34
+ let partnerIdAsInt;
35
+ if (rawPartnerId !== void 0) {
36
+ partnerIdAsInt = parseInt(rawPartnerId, 10);
37
+ if (isNaN(partnerIdAsInt)) {
38
+ partnerIdAsInt = void 0;
39
+ }
40
+ }
33
41
  return {
34
42
  schema_id: "app_cli3_command/1.0",
35
43
  payload: {
@@ -46,7 +54,7 @@ const buildPayload = async (command, args = [], currentTime) => {
46
54
  node_version: process.version.replace("v", ""),
47
55
  is_employee: await environment.local.isShopify(),
48
56
  api_key: appInfo?.appId,
49
- partner_id: appInfo?.orgId
57
+ partner_id: partnerIdAsInt
50
58
  }
51
59
  };
52
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"monorail.js","sources":["../../src/services/monorail.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport {version} from '../../package.json'\nimport {environment, http, os, output, path, ruby, store} from '@shopify/cli-kit'\n\nexport const url = 'https://monorail-edge.shopifysvc.com/v1/produce'\n\nexport const reportEvent = async (command: string, args: string[]) => {\n const currentTime = new Date().getTime()\n const payload = await buildPayload(command, args, currentTime)\n const body = JSON.stringify(payload)\n const headers = buildHeaders(currentTime)\n\n const response = await http.fetch(url, {method: 'POST', body, headers})\n if (response.status === 200) {\n output.debug(`Analytics event sent: ${body}`)\n } else {\n output.debug(`Failed to report usage analytics: ${response.statusText}`)\n }\n}\n\nconst buildHeaders = (currentTime: number) => {\n return {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Monorail-Edge-Event-Created-At-Ms': currentTime.toString(),\n 'X-Monorail-Edge-Event-Sent-At-Ms': currentTime.toString(),\n }\n}\n\nconst buildPayload = async (command: string, args: string[] = [], currentTime: number) => {\n let directory = process.cwd()\n const pathFlagIndex = args.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = path.resolve(args[pathFlagIndex + 1])\n }\n const appInfo = store.getAppInfo(directory)\n const {platform, arch} = os.platformAndArch()\n return {\n schema_id: 'app_cli3_command/1.0',\n payload: {\n project_type: 'node',\n command,\n args: args.join(' '),\n time_start: currentTime,\n time_end: currentTime,\n total_time: 0,\n success: true,\n uname: `${platform} ${arch}`,\n cli_version: version,\n ruby_version: (await ruby.version()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n api_key: appInfo?.appId,\n partner_id: appInfo?.orgId,\n },\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,GAAM,GAAA,kDAAA;AAEN,MAAA,WAAA,GAAc,OAAO,OAAA,EAAiB,IAAmB,KAAA;AACpE,EAAA,MAAM,WAAc,GAAA,IAAI,IAAK,EAAA,CAAE,OAAQ,EAAA,CAAA;AACvC,EAAA,MAAM,OAAU,GAAA,MAAM,YAAa,CAAA,OAAA,EAAS,MAAM,WAAW,CAAA,CAAA;AAC7D,EAAM,MAAA,IAAA,GAAO,IAAK,CAAA,SAAA,CAAU,OAAO,CAAA,CAAA;AACnC,EAAM,MAAA,OAAA,GAAU,aAAa,WAAW,CAAA,CAAA;AAExC,EAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,KAAM,CAAA,GAAA,EAAK,EAAC,MAAQ,EAAA,MAAA,EAAQ,IAAM,EAAA,OAAA,EAAQ,CAAA,CAAA;AACtE,EAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,IAAO,MAAA,C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KAAA,EAAO,GAAG,QAAY,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA;AAAA,MACtB,WAAa,EAAA,OAAA;AAAA,MACb,YAAe,EAAA,MAAM,IAAK,CAAA,OAAA,EAAc,IAAA,EAAA;AAAA,MACxC,YAAc,EAAA,OAAA,CAAQ,OAAQ,CAAA,OAAA,CAAQ,KAAK,EAAE,CAAA;AAAA,MAC7C,WAAa,EAAA,MAAM,WAAY,CAAA,KAAA,CAAM,SAAU,EAAA;AAAA,MAC/C,SAAS,OAAS,EAAA,KAAA;AAAA,MAClB,YAAY,OAAS,EAAA,KAAA;AAAA,KACvB;AAAA,GACF,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"monorail.js","sources":["../../src/services/monorail.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport {version} from '../../package.json'\nimport {environment, http, os, output, path, ruby, store} from '@shopify/cli-kit'\n\nexport const url = 'https://monorail-edge.shopifysvc.com/v1/produce'\n\nexport const reportEvent = async (command: string, args: string[]) => {\n const currentTime = new Date().getTime()\n const payload = await buildPayload(command, args, currentTime)\n const body = JSON.stringify(payload)\n const headers = buildHeaders(currentTime)\n\n const response = await http.fetch(url, {method: 'POST', body, headers})\n if (response.status === 200) {\n output.debug(`Analytics event sent: ${body}`)\n } else {\n output.debug(`Failed to report usage analytics: ${response.statusText}`)\n }\n}\n\nconst buildHeaders = (currentTime: number) => {\n return {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Monorail-Edge-Event-Created-At-Ms': currentTime.toString(),\n 'X-Monorail-Edge-Event-Sent-At-Ms': currentTime.toString(),\n }\n}\n\nconst buildPayload = async (command: string, args: string[] = [], currentTime: number) => {\n let directory = process.cwd()\n const pathFlagIndex = args.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = path.resolve(args[pathFlagIndex + 1])\n }\n const appInfo = store.getAppInfo(directory)\n const {platform, arch} = os.platformAndArch()\n\n const rawPartnerId = appInfo?.orgId\n let partnerIdAsInt: number | undefined\n if (rawPartnerId !== undefined) {\n partnerIdAsInt = parseInt(rawPartnerId, 10)\n if (isNaN(partnerIdAsInt)) {\n partnerIdAsInt = undefined\n }\n }\n\n return {\n schema_id: 'app_cli3_command/1.0',\n payload: {\n project_type: 'node',\n command,\n args: args.join(' '),\n time_start: currentTime,\n time_end: currentTime,\n total_time: 0,\n success: true,\n uname: `${platform} ${arch}`,\n cli_version: version,\n ruby_version: (await ruby.version()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n api_key: appInfo?.appId,\n partner_id: partnerIdAsInt,\n },\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,GAAM,GAAA,kDAAA;AAEN,MAAA,WAAA,GAAc,OAAO,OAAA,EAAiB,IAAmB,KAAA;AACpE,EAAA,MAAM,WAAc,GAAA,IAAI,IAAK,EAAA,CAAE,OAAQ,EAAA,CAAA;AACvC,EAAA,MAAM,OAAU,GAAA,MAAM,YAAa,CAAA,OAAA,EAAS,MAAM,WAAW,CAAA,CAAA;AAC7D,EAAM,MAAA,IAAA,GAAO,IAAK,CAAA,SAAA,CAAU,OAAO,CAAA,CAAA;AACnC,EAAM,MAAA,OAAA,GAAU,aAAa,WAAW,CAAA,CAAA;AAExC,EAAM,MAAA,QAAA,GAAW,MAAM,IAAA,CAAK,KAAM,CAAA,GAAA,EAAK,EAAC,MAAQ,EAAA,MAAA,EAAQ,IAAM,EAAA,OAAA,EAAQ,CAAA,CAAA;AACtE,EAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,IAAO,MAAA,CAAA,KAAA,CAAM,yBAAyB,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,GACvC,MAAA;AACL,IAAO,MAAA,CAAA,KAAA,CAAM,CAAqC,kCAAA,EAAA,QAAA,CAAS,UAAY,CAAA,CAAA,CAAA,CAAA;AAAA,GACzE;AACF,EAAA;AAEA,MAAM,YAAA,GAAe,CAAC,WAAwB,KAAA;AAC5C,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AAY,EAAA,CAAA;AAAA,MACZ,OAAS,EAAA,IAAA;AAAA,MACT,KAAA,EAAO,GAAG,QAAY,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA;AAAA,MACtB,WAAa,EAAA,OAAA;AAAA,MACb,YAAe,EAAA,MAAM,IAAK,CAAA,OAAA,EAAc,IAAA,EAAA;AAAA,MACxC,YAAc,EAAA,OAAA,CAAQ,OAAQ,CAAA,OAAA,CAAQ,KAAK,EAAE,CAAA;AAAA,MAC7C,WAAa,EAAA,MAAM,WAAY,CAAA,KAAA,CAAM,SAAU,EAAA;AAAA,MAC/C,SAAS,OAAS,EAAA,KAAA;AAAA,MAClB,UAAY,EAAA,cAAA;AAAA,KACd;AAAA,GACF,CAAA;AACF,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli",
3
- "version": "3.0.13",
3
+ "version": "3.0.16",
4
4
  "private": false,
5
5
  "description": "A CLI tool to build for the Shopify platform",
6
6
  "type": "module",
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@bugsnag/js": "^7.16.7",
51
- "@oclif/core": "1.9.0",
51
+ "@oclif/core": "^1.0",
52
52
  "@oclif/plugin-help": "^5.1.12",
53
53
  "@oclif/plugin-plugins": "^2.1.0",
54
- "@shopify/cli-kit": "3.0.13",
55
- "@shopify/plugin-ngrok": "^0.2.6"
54
+ "@shopify/plugin-ngrok": "^0.2.9",
55
+ "@shopify/cli-kit": "^3.0.16"
56
56
  },
57
57
  "devDependencies": {
58
58
  "vitest": "0.13.1"