@shopify/cli 3.35.0 → 3.36.0

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.
Files changed (32) hide show
  1. package/dist/cli/commands/kitchen-sink/async.d.ts +10 -0
  2. package/dist/cli/commands/kitchen-sink/async.js +14 -0
  3. package/dist/cli/commands/kitchen-sink/async.js.map +1 -0
  4. package/dist/cli/commands/kitchen-sink/banners.d.ts +10 -0
  5. package/dist/cli/commands/kitchen-sink/banners.js +14 -0
  6. package/dist/cli/commands/kitchen-sink/banners.js.map +1 -0
  7. package/dist/cli/commands/{kitchen-sink.d.ts → kitchen-sink/index.d.ts} +2 -1
  8. package/dist/cli/commands/kitchen-sink/index.js +20 -0
  9. package/dist/cli/commands/kitchen-sink/index.js.map +1 -0
  10. package/dist/cli/commands/kitchen-sink/prompts.d.ts +10 -0
  11. package/dist/cli/commands/kitchen-sink/prompts.js +14 -0
  12. package/dist/cli/commands/kitchen-sink/prompts.js.map +1 -0
  13. package/dist/cli/commands/upgrade.js +3 -3
  14. package/dist/cli/commands/upgrade.js.map +1 -1
  15. package/dist/cli/services/kitchen-sink/async.d.ts +1 -0
  16. package/dist/cli/services/kitchen-sink/async.js +49 -0
  17. package/dist/cli/services/kitchen-sink/async.js.map +1 -0
  18. package/dist/cli/services/kitchen-sink/banners.d.ts +1 -0
  19. package/dist/cli/services/{kitchen-sink.js → kitchen-sink/banners.js} +22 -68
  20. package/dist/cli/services/kitchen-sink/banners.js.map +1 -0
  21. package/dist/cli/services/kitchen-sink/prompts.d.ts +1 -0
  22. package/dist/cli/services/kitchen-sink/prompts.js +90 -0
  23. package/dist/cli/services/kitchen-sink/prompts.js.map +1 -0
  24. package/dist/cli/services/upgrade.js +6 -4
  25. package/dist/cli/services/upgrade.js.map +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/oclif.manifest.json +1 -1
  28. package/package.json +9 -5
  29. package/dist/cli/commands/kitchen-sink.js +0 -15
  30. package/dist/cli/commands/kitchen-sink.js.map +0 -1
  31. package/dist/cli/services/kitchen-sink.d.ts +0 -1
  32. package/dist/cli/services/kitchen-sink.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ import Command from '@shopify/cli-kit/node/base-command';
2
+ /**
3
+ * This command is used to output all the async UI components of the CLI.
4
+ * It's useful to test how they behave under different terminal sizes
5
+ * and to help update the documentation when they change.
6
+ */
7
+ export default class KitchenSinkAsync extends Command {
8
+ static description: string;
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { asyncTasks } from '../../services/kitchen-sink/async.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+ /**
4
+ * This command is used to output all the async UI components of the CLI.
5
+ * It's useful to test how they behave under different terminal sizes
6
+ * and to help update the documentation when they change.
7
+ */
8
+ export default class KitchenSinkAsync extends Command {
9
+ async run() {
10
+ await asyncTasks();
11
+ }
12
+ }
13
+ KitchenSinkAsync.description = 'View the UI kit components that process async tasks';
14
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../src/cli/commands/kitchen-sink/async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAA;AAC/D,OAAO,OAAO,MAAM,oCAAoC,CAAA;AAExD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IAGnD,KAAK,CAAC,GAAG;QACP,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;;AAJM,4BAAW,GAAG,qDAAqD,CAAA","sourcesContent":["import {asyncTasks} from '../../services/kitchen-sink/async.js'\nimport Command from '@shopify/cli-kit/node/base-command'\n\n/**\n * This command is used to output all the async UI components of the CLI.\n * It's useful to test how they behave under different terminal sizes\n * and to help update the documentation when they change.\n */\nexport default class KitchenSinkAsync extends Command {\n static description = 'View the UI kit components that process async tasks'\n\n async run(): Promise<void> {\n await asyncTasks()\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import Command from '@shopify/cli-kit/node/base-command';
2
+ /**
3
+ * This command is used to output all the banner UI components of the CLI.
4
+ * It's useful to test how they behave under different terminal sizes
5
+ * and to help update the documentation when they change.
6
+ */
7
+ export default class KitchenSinkBanners extends Command {
8
+ static description: string;
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { banners } from '../../services/kitchen-sink/banners.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+ /**
4
+ * This command is used to output all the banner UI components of the CLI.
5
+ * It's useful to test how they behave under different terminal sizes
6
+ * and to help update the documentation when they change.
7
+ */
8
+ export default class KitchenSinkBanners extends Command {
9
+ async run() {
10
+ await banners();
11
+ }
12
+ }
13
+ KitchenSinkBanners.description = 'View the UI kit components that display banners';
14
+ //# sourceMappingURL=banners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banners.js","sourceRoot":"","sources":["../../../../src/cli/commands/kitchen-sink/banners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,wCAAwC,CAAA;AAC9D,OAAO,OAAO,MAAM,oCAAoC,CAAA;AAExD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IAGrD,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,EAAE,CAAA;IACjB,CAAC;;AAJM,8BAAW,GAAG,iDAAiD,CAAA","sourcesContent":["import {banners} from '../../services/kitchen-sink/banners.js'\nimport Command from '@shopify/cli-kit/node/base-command'\n\n/**\n * This command is used to output all the banner UI components of the CLI.\n * It's useful to test how they behave under different terminal sizes\n * and to help update the documentation when they change.\n */\nexport default class KitchenSinkBanners extends Command {\n static description = 'View the UI kit components that display banners'\n\n async run(): Promise<void> {\n await banners()\n }\n}\n"]}
@@ -4,8 +4,9 @@ import Command from '@shopify/cli-kit/node/base-command';
4
4
  * It's useful to test how they behave under different terminal sizes
5
5
  * and to help update the documentation when they change.
6
6
  */
7
- export default class KitchenSink extends Command {
7
+ export default class KitchenSinkAll extends Command {
8
8
  static description: string;
9
+ static aliases: string[];
9
10
  static hidden: boolean;
10
11
  run(): Promise<void>;
11
12
  }
@@ -0,0 +1,20 @@
1
+ import { asyncTasks } from '../../services/kitchen-sink/async.js';
2
+ import { banners } from '../../services/kitchen-sink/banners.js';
3
+ import { prompts } from '../../services/kitchen-sink/prompts.js';
4
+ import Command from '@shopify/cli-kit/node/base-command';
5
+ /**
6
+ * This command is used to output all the UI components of the CLI.
7
+ * It's useful to test how they behave under different terminal sizes
8
+ * and to help update the documentation when they change.
9
+ */
10
+ export default class KitchenSinkAll extends Command {
11
+ async run() {
12
+ await banners();
13
+ await prompts();
14
+ await asyncTasks();
15
+ }
16
+ }
17
+ KitchenSinkAll.description = 'View all the available UI kit components';
18
+ KitchenSinkAll.aliases = ['kitchen-sink all'];
19
+ KitchenSinkAll.hidden = true;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/kitchen-sink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAA;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,wCAAwC,CAAA;AAC9D,OAAO,EAAC,OAAO,EAAC,MAAM,wCAAwC,CAAA;AAC9D,OAAO,OAAO,MAAM,oCAAoC,CAAA;AAExD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IAKjD,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,EAAE,CAAA;QACf,MAAM,OAAO,EAAE,CAAA;QACf,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;;AARM,0BAAW,GAAG,0CAA0C,CAAA;AACxD,sBAAO,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAC9B,qBAAM,GAAG,IAAI,CAAA","sourcesContent":["import {asyncTasks} from '../../services/kitchen-sink/async.js'\nimport {banners} from '../../services/kitchen-sink/banners.js'\nimport {prompts} from '../../services/kitchen-sink/prompts.js'\nimport Command from '@shopify/cli-kit/node/base-command'\n\n/**\n * This command is used to output all the UI components of the CLI.\n * It's useful to test how they behave under different terminal sizes\n * and to help update the documentation when they change.\n */\nexport default class KitchenSinkAll extends Command {\n static description = 'View all the available UI kit components'\n static aliases = ['kitchen-sink all']\n static hidden = true\n\n async run(): Promise<void> {\n await banners()\n await prompts()\n await asyncTasks()\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import Command from '@shopify/cli-kit/node/base-command';
2
+ /**
3
+ * This command is used to output all the UI prompt components of the CLI.
4
+ * It's useful to test how they behave under different terminal sizes
5
+ * and to help update the documentation when they change.
6
+ */
7
+ export default class KitchenSinkPrompts extends Command {
8
+ static description: string;
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { prompts } from '../../services/kitchen-sink/prompts.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+ /**
4
+ * This command is used to output all the UI prompt components of the CLI.
5
+ * It's useful to test how they behave under different terminal sizes
6
+ * and to help update the documentation when they change.
7
+ */
8
+ export default class KitchenSinkPrompts extends Command {
9
+ async run() {
10
+ await prompts();
11
+ }
12
+ }
13
+ KitchenSinkPrompts.description = 'View the UI kit components prompts';
14
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/cli/commands/kitchen-sink/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,wCAAwC,CAAA;AAC9D,OAAO,OAAO,MAAM,oCAAoC,CAAA;AAExD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IAGrD,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,EAAE,CAAA;IACjB,CAAC;;AAJM,8BAAW,GAAG,oCAAoC,CAAA","sourcesContent":["import {prompts} from '../../services/kitchen-sink/prompts.js'\nimport Command from '@shopify/cli-kit/node/base-command'\n\n/**\n * This command is used to output all the UI prompt components of the CLI.\n * It's useful to test how they behave under different terminal sizes\n * and to help update the documentation when they change.\n */\nexport default class KitchenSinkPrompts extends Command {\n static description = 'View the UI kit components prompts'\n\n async run(): Promise<void> {\n await prompts()\n }\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  import { upgrade } from '../services/upgrade.js';
2
2
  import { Flags } from '@oclif/core';
3
- import { path } from '@shopify/cli-kit';
4
3
  import Command from '@shopify/cli-kit/node/base-command';
5
4
  import { CLI_KIT_VERSION } from '@shopify/cli-kit/common/version';
5
+ import { resolvePath } from '@shopify/cli-kit/node/path';
6
6
  export default class Upgrade extends Command {
7
7
  async run() {
8
8
  const { flags } = await this.parse(Upgrade);
9
- const directory = flags.path ? path.resolve(flags.path) : process.cwd();
9
+ const directory = flags.path ? resolvePath(flags.path) : process.cwd();
10
10
  const currentVersion = CLI_KIT_VERSION;
11
11
  await upgrade(directory, currentVersion);
12
12
  }
@@ -16,7 +16,7 @@ Upgrade.flags = {
16
16
  path: Flags.string({
17
17
  hidden: false,
18
18
  description: 'The path to your project directory.',
19
- parse: (input, _) => Promise.resolve(path.resolve(input)),
19
+ parse: (input, _) => Promise.resolve(resolvePath(input)),
20
20
  env: 'SHOPIFY_FLAG_PATH',
21
21
  }),
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AACrC,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAY1C,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACzC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAA;QACvE,MAAM,cAAc,GAAG,eAAe,CAAA;QACtC,MAAM,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IAC1C,CAAC;;AAhBM,mBAAW,GAAG,0BAA0B,CAAA;AAExC,aAAK,GAAG;IACb,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,qCAAqC;QAClD,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzD,GAAG,EAAE,mBAAmB;KACzB,CAAC;CACH,CAAA","sourcesContent":["import {upgrade} from '../services/upgrade.js'\nimport {Flags} from '@oclif/core'\nimport {path} from '@shopify/cli-kit'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {CLI_KIT_VERSION} from '@shopify/cli-kit/common/version'\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 const currentVersion = CLI_KIT_VERSION\n await upgrade(directory, currentVersion)\n }\n}\n"]}
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,OAAO,MAAM,oCAAoC,CAAA;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAA;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAY1C,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACzC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAA;QACtE,MAAM,cAAc,GAAG,eAAe,CAAA;QACtC,MAAM,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IAC1C,CAAC;;AAhBM,mBAAW,GAAG,0BAA0B,CAAA;AAExC,aAAK,GAAG;IACb,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,qCAAqC;QAClD,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxD,GAAG,EAAE,mBAAmB;KACzB,CAAC;CACH,CAAA","sourcesContent":["import {upgrade} from '../services/upgrade.js'\nimport {Flags} from '@oclif/core'\nimport Command from '@shopify/cli-kit/node/base-command'\nimport {CLI_KIT_VERSION} from '@shopify/cli-kit/common/version'\nimport {resolvePath} from '@shopify/cli-kit/node/path'\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(resolvePath(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 ? resolvePath(flags.path) : process.cwd()\n const currentVersion = CLI_KIT_VERSION\n await upgrade(directory, currentVersion)\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function asyncTasks(): Promise<void>;
@@ -0,0 +1,49 @@
1
+ import { renderConcurrent, renderTasks } from '@shopify/cli-kit/node/ui';
2
+ export async function asyncTasks() {
3
+ // renderConcurrent
4
+ let backendPromiseResolve;
5
+ const backendPromise = new Promise(function (resolve, _reject) {
6
+ backendPromiseResolve = resolve;
7
+ });
8
+ const backendProcess = {
9
+ prefix: 'backend',
10
+ action: async (stdout, _stderr, _signal) => {
11
+ stdout.write('first backend message');
12
+ await new Promise((resolve) => setTimeout(resolve, 1000));
13
+ stdout.write('second backend message');
14
+ await new Promise((resolve) => setTimeout(resolve, 1000));
15
+ stdout.write('third backend message');
16
+ await new Promise((resolve) => setTimeout(resolve, 1000));
17
+ backendPromiseResolve();
18
+ },
19
+ };
20
+ const frontendProcess = {
21
+ prefix: 'frontend',
22
+ action: async (stdout, _stderr, _signal) => {
23
+ await backendPromise;
24
+ stdout.write('first frontend message');
25
+ await new Promise((resolve) => setTimeout(resolve, 1000));
26
+ stdout.write('second frontend message');
27
+ await new Promise((resolve) => setTimeout(resolve, 1000));
28
+ stdout.write('third frontend message');
29
+ },
30
+ };
31
+ await renderConcurrent({ processes: [backendProcess, frontendProcess] });
32
+ // renderTasks
33
+ const tasks = [
34
+ {
35
+ title: 'Installing dependencies',
36
+ task: async () => {
37
+ await new Promise((resolve) => setTimeout(resolve, 2000));
38
+ },
39
+ },
40
+ {
41
+ title: 'Downloading assets',
42
+ task: async () => {
43
+ await new Promise((resolve) => setTimeout(resolve, 2000));
44
+ },
45
+ },
46
+ ];
47
+ await renderTasks(tasks);
48
+ }
49
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version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EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;YACzD,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;YACvC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;YACzD,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACxC,CAAC;KACF,CAAA;IAED,MAAM,gBAAgB,CAAC,EAAC,SAAS,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC,EAAC,CAAC,CAAA;IAEtE,cAAc;IACd,MAAM,KAAK,GAAG;QACZ;YACE,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;YAC3D,CAAC;SACF;QACD;YACE,KAAK,EAAE,oBAAoB;YAC3B,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;YAC3D,CAAC;SACF;KACF,CAAA;IAED,MAAM,WAAW,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC","sourcesContent":["import {renderConcurrent, renderTasks} from '@shopify/cli-kit/node/ui'\nimport {AbortSignal} from '@shopify/cli-kit/node/abort'\nimport {Writable} from 'stream'\n\nexport async function asyncTasks() {\n // renderConcurrent\n let backendPromiseResolve: () => void\n\n const backendPromise = new Promise<void>(function (resolve, _reject) {\n backendPromiseResolve = resolve\n })\n\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n await new Promise((resolve) => setTimeout(resolve, 1000))\n stdout.write('second backend message')\n await new Promise((resolve) => setTimeout(resolve, 1000))\n stdout.write('third backend message')\n await new Promise((resolve) => setTimeout(resolve, 1000))\n\n backendPromiseResolve()\n },\n }\n\n const frontendProcess = {\n prefix: 'frontend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n await backendPromise\n\n stdout.write('first frontend message')\n await new Promise((resolve) => setTimeout(resolve, 1000))\n stdout.write('second frontend message')\n await new Promise((resolve) => setTimeout(resolve, 1000))\n stdout.write('third frontend message')\n },\n }\n\n await renderConcurrent({processes: [backendProcess, frontendProcess]})\n\n // renderTasks\n const tasks = [\n {\n title: 'Installing dependencies',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n },\n {\n title: 'Downloading assets',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n },\n ]\n\n await renderTasks(tasks)\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function banners(): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { error } from '@shopify/cli-kit';
2
- import { renderConcurrent, renderFatalError, renderInfo, renderSelectPrompt, renderSuccess, renderTasks, renderTextPrompt, renderWarning, } from '@shopify/cli-kit/node/ui';
3
- export async function kitchenSink() {
2
+ import { renderFatalError, renderInfo, renderSuccess, renderWarning } from '@shopify/cli-kit/node/ui';
3
+ export async function banners() {
4
+ // Banners
4
5
  renderInfo({
5
6
  headline: 'CLI update available',
6
7
  body: ['Run', { command: 'npm run shopify upgrade' }, { char: '.' }],
@@ -59,6 +60,24 @@ export async function kitchenSink() {
59
60
  },
60
61
  },
61
62
  ],
63
+ customSections: [
64
+ {
65
+ title: 'Custom section',
66
+ body: {
67
+ list: {
68
+ items: ['Item 1', 'Item 2', 'Item 3'],
69
+ },
70
+ },
71
+ },
72
+ {
73
+ title: 'Custom section 2',
74
+ body: {
75
+ list: {
76
+ items: ['Item 1', 'Item 2', 'Item 3'],
77
+ },
78
+ },
79
+ },
80
+ ],
62
81
  });
63
82
  renderSuccess({
64
83
  headline: 'CLI updated.',
@@ -125,70 +144,5 @@ export async function kitchenSink() {
125
144
  ],
126
145
  ];
127
146
  renderFatalError(new error.Abort('No Organization found', undefined, nextSteps));
128
- await renderSelectPrompt({
129
- message: 'Associate your project with the org Castile Ventures?',
130
- choices: [
131
- { label: 'first', value: 'first', key: 'f' },
132
- { label: 'second', value: 'second', key: 's' },
133
- { label: 'third', value: 'third' },
134
- { label: 'fourth', value: 'fourth' },
135
- { label: 'fifth', value: 'fifth', group: 'Automations', key: 'a' },
136
- { label: 'sixth', value: 'sixth', group: 'Automations' },
137
- { label: 'seventh', value: 'seventh' },
138
- { label: 'eighth', value: 'eighth', group: 'Merchant Admin' },
139
- { label: 'ninth', value: 'ninth', group: 'Merchant Admin' },
140
- { label: 'tenth', value: 'tenth' },
141
- ],
142
- infoTable: { add: ['new-ext'], remove: ['integrated-demand-ext', 'order-discount'] },
143
- });
144
- await renderTextPrompt({
145
- message: 'App project name (can be changed later)',
146
- placeholder: 'expansive commerce app',
147
- });
148
- // renderConcurrent at the end
149
- let backendPromiseResolve;
150
- const backendPromise = new Promise(function (resolve, _reject) {
151
- backendPromiseResolve = resolve;
152
- });
153
- const backendProcess = {
154
- prefix: 'backend',
155
- action: async (stdout, _stderr, _signal) => {
156
- stdout.write('first backend message');
157
- await new Promise((resolve) => setTimeout(resolve, 1000));
158
- stdout.write('second backend message');
159
- await new Promise((resolve) => setTimeout(resolve, 1000));
160
- stdout.write('third backend message');
161
- await new Promise((resolve) => setTimeout(resolve, 1000));
162
- backendPromiseResolve();
163
- },
164
- };
165
- const frontendProcess = {
166
- prefix: 'frontend',
167
- action: async (stdout, _stderr, _signal) => {
168
- await backendPromise;
169
- stdout.write('first frontend message');
170
- await new Promise((resolve) => setTimeout(resolve, 1000));
171
- stdout.write('second frontend message');
172
- await new Promise((resolve) => setTimeout(resolve, 1000));
173
- stdout.write('third frontend message');
174
- },
175
- };
176
- await renderConcurrent({ processes: [backendProcess, frontendProcess] });
177
- // renderTasks
178
- const tasks = [
179
- {
180
- title: 'Installing dependencies',
181
- task: async () => {
182
- await new Promise((resolve) => setTimeout(resolve, 2000));
183
- },
184
- },
185
- {
186
- title: 'Downloading assets',
187
- task: async () => {
188
- await new Promise((resolve) => setTimeout(resolve, 2000));
189
- },
190
- },
191
- ];
192
- await renderTasks(tasks);
193
147
  }
194
- //# sourceMappingURL=kitchen-sink.js.map
148
+ //# sourceMappingURL=banners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banners.js","sourceRoot":"","sources":["../../../../src/cli/services/kitchen-sink/banners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAA;AAEnG,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,UAAU;IACV,UAAU,CAAC;QACT,QAAQ,EAAE,sBAAsB;QAChC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,yBAAyB,EAAC,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC;KACjE,CAAC,CAAA;IAEF,UAAU,CAAC;QACT,QAAQ,EAAE;YACR,4DAA4D;YAC5D,EAAC,QAAQ,EAAE,8BAA8B,EAAC;YAC1C,4CAA4C;SAC7C;QACD,IAAI,EAAE;YACJ,uCAAuC;YACvC;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,yBAAyB,EAAC,CAAC;wBAC7C,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,gBAAgB,EAAC,CAAC;qBACrC;iBACF;aACF;SACF;KACF,CAAC,CAAA;IAEF,UAAU,CAAC;QACT,QAAQ,EAAE,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAE,iCAAiC,CAAC;QACpE,SAAS,EAAE;YACT;gBACE,KAAK;gBACL;oBACE,OAAO,EAAE,q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F;SACF;KACF,CAAC,CAAA;IAEF,cAAc;IACd,MAAM,kBAAkB,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAEjE,kBAAkB,CAAC,KAAK,GAAG;;;;;;CAM5B,CAAA;IAEC,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IAEpC,aAAa;IACb,MAAM,SAAS,GAAG;QAChB;YACE,UAAU;YACV;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,yCAAyC;oBAChD,GAAG,EAAE,qCAAqC;iBAC3C;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;SACF;QACD,gEAAgE;QAChE;YACE,gFAAgF;YAChF;gBACE,OAAO,EAAE,SAAS;aACnB;SACF;KACF,CAAA;IAED,gBAAgB,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,uBAAuB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;AAClF,CAAC","sourcesContent":["import {error} from '@shopify/cli-kit'\nimport {renderFatalError, renderInfo, renderSuccess, renderWarning} from '@shopify/cli-kit/node/ui'\n\nexport async function banners() {\n // Banners\n renderInfo({\n headline: 'CLI update available',\n body: ['Run', {command: 'npm run shopify upgrade'}, {char: '.'}],\n })\n\n renderInfo({\n headline: [\n \"To connect this project to your shopify store's inventory:\",\n {filePath: '/my-store/hydrogen.config.js'},\n 'with your store ID and Storefront API key.',\n ],\n body: [\n 'You can also try the following steps:',\n {\n list: {\n items: [\n ['Run', {command: 'shopify project connect'}],\n ['Run', {command: 'hydrogen start'}],\n ],\n },\n },\n ],\n })\n\n renderInfo({\n headline: [{userInput: 'my-app'}, 'initialized and ready to build.'],\n nextSteps: [\n [\n 'Run',\n {\n command: 'cd verification-app',\n },\n ],\n [\n 'To preview your project, run',\n {\n command: 'npm app dev',\n },\n ],\n [\n 'To add extensions, run',\n {\n command: 'npm generate extension',\n },\n ],\n ],\n reference: [\n [\n 'Run',\n {\n command: 'npm shopify help',\n },\n ],\n {\n link: {\n label: 'Dev docs',\n url: 'https://shopify.dev',\n },\n },\n ],\n customSections: [\n {\n title: 'Custom section',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n {\n title: 'Custom section 2',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n ],\n })\n\n renderSuccess({\n headline: 'CLI updated.',\n body: 'You are now running version 3.47.',\n })\n\n renderSuccess({\n headline: 'Deployment successful.',\n body: 'Your extensions have been uploaded to your Shopify Partners Dashboard.',\n nextSteps: [\n {\n link: {\n label: 'See your deployment and set it live',\n url: 'https://partners.shopify.com/1797046/apps/4523695/deployments',\n },\n },\n ],\n })\n\n renderWarning({\n headline: 'You have reached your limit of checkout extensions for this app.',\n body: 'You can free up space for a new one by deleting an existing one.',\n })\n\n renderWarning({\n headline: 'Required access scope update.',\n body: 'The deadline for re-selecting your app scopes is May 1, 2022.',\n reference: [\n {\n link: {\n label: 'Dev docs',\n url: 'https://shopify.dev/app/scopes',\n },\n },\n ],\n })\n\n // Stack trace\n const somethingWentWrong = new error.Bug('Something went wrong.')\n\n somethingWentWrong.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n`\n\n renderFatalError(somethingWentWrong)\n\n // Next Steps\n const nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n renderFatalError(new error.Abort('No Organization found', undefined, nextSteps))\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function prompts(): Promise<void>;
@@ -0,0 +1,90 @@
1
+ import { renderAutocompletePrompt, renderSelectPrompt, renderTextPrompt } from '@shopify/cli-kit/node/ui';
2
+ export async function prompts() {
3
+ // renderSelectPrompt
4
+ await renderSelectPrompt({
5
+ message: 'Associate your project with the org Castile Ventures?',
6
+ choices: [
7
+ { label: 'first', value: 'first', key: 'f' },
8
+ { label: 'second', value: 'second', key: 's' },
9
+ { label: 'third', value: 'third' },
10
+ { label: 'fourth', value: 'fourth' },
11
+ { label: 'fifth', value: 'fifth', group: 'Automations', key: 'a' },
12
+ { label: 'sixth', value: 'sixth', group: 'Automations' },
13
+ { label: 'seventh', value: 'seventh' },
14
+ { label: 'eighth', value: 'eighth', group: 'Merchant Admin' },
15
+ { label: 'ninth', value: 'ninth', group: 'Merchant Admin' },
16
+ { label: 'tenth', value: 'tenth' },
17
+ ],
18
+ infoTable: { add: ['new-ext'], remove: ['integrated-demand-ext', 'order-discount'] },
19
+ });
20
+ // renderTextPrompt
21
+ await renderTextPrompt({
22
+ message: 'App project name (can be changed later)',
23
+ defaultValue: 'expansive commerce app',
24
+ validate: (value) => {
25
+ if (value.includes('shopify'))
26
+ return 'Can\'t include "shopify" in the name';
27
+ },
28
+ });
29
+ // renderAutocompletePrompt
30
+ const database = [
31
+ { label: 'first', value: 'first' },
32
+ { label: 'second', value: 'second' },
33
+ { label: 'third', value: 'third' },
34
+ { label: 'fourth', value: 'fourth' },
35
+ { label: 'fifth', value: 'fifth' },
36
+ { label: 'sixth', value: 'sixth' },
37
+ { label: 'seventh', value: 'seventh' },
38
+ { label: 'eighth', value: 'eighth' },
39
+ { label: 'ninth', value: 'ninth' },
40
+ { label: 'tenth', value: 'tenth' },
41
+ { label: 'eleventh', value: 'eleventh' },
42
+ { label: 'twelfth', value: 'twelfth' },
43
+ { label: 'thirteenth', value: 'thirteenth' },
44
+ { label: 'fourteenth', value: 'fourteenth' },
45
+ { label: 'fifteenth', value: 'fifteenth' },
46
+ { label: 'sixteenth', value: 'sixteenth' },
47
+ { label: 'seventeenth', value: 'seventeenth' },
48
+ { label: 'eighteenth', value: 'eighteenth' },
49
+ { label: 'nineteenth', value: 'nineteenth' },
50
+ { label: 'twentieth', value: 'twentieth' },
51
+ { label: 'twenty-first', value: 'twenty-first' },
52
+ { label: 'twenty-second', value: 'twenty-second' },
53
+ { label: 'twenty-third', value: 'twenty-third' },
54
+ { label: 'twenty-fourth', value: 'twenty-fourth' },
55
+ { label: 'twenty-fifth', value: 'twenty-fifth' },
56
+ { label: 'twenty-sixth', value: 'twenty-sixth' },
57
+ { label: 'twenty-seventh', value: 'twenty-seventh' },
58
+ { label: 'twenty-eighth', value: 'twenty-eighth' },
59
+ { label: 'twenty-ninth', value: 'twenty-ninth' },
60
+ { label: 'thirtieth', value: 'thirtieth' },
61
+ { label: 'thirty-first', value: 'thirty-first' },
62
+ { label: 'thirty-second', value: 'thirty-second' },
63
+ { label: 'thirty-third', value: 'thirty-third' },
64
+ { label: 'thirty-fourth', value: 'thirty-fourth' },
65
+ { label: 'thirty-fifth', value: 'thirty-fifth' },
66
+ { label: 'thirty-sixth', value: 'thirty-sixth' },
67
+ { label: 'thirty-seventh', value: 'thirty-seventh' },
68
+ { label: 'thirty-eighth', value: 'thirty-eighth' },
69
+ { label: 'thirty-ninth', value: 'thirty-ninth' },
70
+ { label: 'fortieth', value: 'fortieth' },
71
+ { label: 'forty-first', value: 'forty-first' },
72
+ { label: 'forty-second', value: 'forty-second' },
73
+ { label: 'forty-third', value: 'forty-third' },
74
+ { label: 'forty-fourth', value: 'forty-fourth' },
75
+ { label: 'forty-fifth', value: 'forty-fifth' },
76
+ { label: 'forty-sixth', value: 'forty-sixth' },
77
+ { label: 'forty-seventh', value: 'forty-seventh' },
78
+ { label: 'forty-eighth', value: 'forty-eighth' },
79
+ { label: 'forty-ninth', value: 'forty-ninth' },
80
+ { label: 'fiftieth', value: 'fiftieth' },
81
+ ];
82
+ await renderAutocompletePrompt({
83
+ message: 'Select a template',
84
+ choices: database,
85
+ search(term) {
86
+ return Promise.resolve(database.filter((item) => item.label.includes(term)));
87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","sourcesContent":["import {renderAutocompletePrompt, renderSelectPrompt, renderTextPrompt} from '@shopify/cli-kit/node/ui'\n\nexport async function prompts() {\n // renderSelectPrompt\n await renderSelectPrompt({\n message: 'Associate your project with the org Castile Ventures?',\n choices: [\n {label: 'first', value: 'first', key: 'f'},\n {label: 'second', value: 'second', key: 's'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n {label: 'fifth', value: 'fifth', group: 'Automations', key: 'a'},\n {label: 'sixth', value: 'sixth', group: 'Automations'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth', group: 'Merchant Admin'},\n {label: 'ninth', value: 'ninth', group: 'Merchant Admin'},\n {label: 'tenth', value: 'tenth'},\n ],\n infoTable: {add: ['new-ext'], remove: ['integrated-demand-ext', 'order-discount']},\n })\n\n // renderTextPrompt\n await renderTextPrompt({\n message: 'App project name (can be changed later)',\n defaultValue: 'expansive commerce app',\n validate: (value) => {\n if (value.includes('shopify')) return 'Can\\'t include \"shopify\" in the name'\n },\n })\n\n // renderAutocompletePrompt\n const database = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n {label: 'eleventh', value: 'eleventh'},\n {label: 'twelfth', value: 'twelfth'},\n {label: 'thirteenth', value: 'thirteenth'},\n {label: 'fourteenth', value: 'fourteenth'},\n {label: 'fifteenth', value: 'fifteenth'},\n {label: 'sixteenth', value: 'sixteenth'},\n {label: 'seventeenth', value: 'seventeenth'},\n {label: 'eighteenth', value: 'eighteenth'},\n {label: 'nineteenth', value: 'nineteenth'},\n {label: 'twentieth', value: 'twentieth'},\n {label: 'twenty-first', value: 'twenty-first'},\n {label: 'twenty-second', value: 'twenty-second'},\n {label: 'twenty-third', value: 'twenty-third'},\n {label: 'twenty-fourth', value: 'twenty-fourth'},\n {label: 'twenty-fifth', value: 'twenty-fifth'},\n {label: 'twenty-sixth', value: 'twenty-sixth'},\n {label: 'twenty-seventh', value: 'twenty-seventh'},\n {label: 'twenty-eighth', value: 'twenty-eighth'},\n {label: 'twenty-ninth', value: 'twenty-ninth'},\n {label: 'thirtieth', value: 'thirtieth'},\n {label: 'thirty-first', value: 'thirty-first'},\n {label: 'thirty-second', value: 'thirty-second'},\n {label: 'thirty-third', value: 'thirty-third'},\n {label: 'thirty-fourth', value: 'thirty-fourth'},\n {label: 'thirty-fifth', value: 'thirty-fifth'},\n {label: 'thirty-sixth', value: 'thirty-sixth'},\n {label: 'thirty-seventh', value: 'thirty-seventh'},\n {label: 'thirty-eighth', value: 'thirty-eighth'},\n {label: 'thirty-ninth', value: 'thirty-ninth'},\n {label: 'fortieth', value: 'fortieth'},\n {label: 'forty-first', value: 'forty-first'},\n {label: 'forty-second', value: 'forty-second'},\n {label: 'forty-third', value: 'forty-third'},\n {label: 'forty-fourth', value: 'forty-fourth'},\n {label: 'forty-fifth', value: 'forty-fifth'},\n {label: 'forty-sixth', value: 'forty-sixth'},\n {label: 'forty-seventh', value: 'forty-seventh'},\n {label: 'forty-eighth', value: 'forty-eighth'},\n {label: 'forty-ninth', value: 'forty-ninth'},\n {label: 'fiftieth', value: 'fiftieth'},\n ]\n\n await renderAutocompletePrompt({\n message: 'Select a template',\n choices: database,\n search(term: string) {\n return Promise.resolve(database.filter((item) => item.label.includes(term)))\n },\n })\n}\n"]}
@@ -1,6 +1,8 @@
1
- import { error, output, path } from '@shopify/cli-kit';
1
+ import { error, output } from '@shopify/cli-kit';
2
2
  import { addNPMDependencies, findUpAndReadPackageJson, checkForNewVersion, getPackageManager, } from '@shopify/cli-kit/node/node-package-manager';
3
3
  import { exec } from '@shopify/cli-kit/node/system';
4
+ import { dirname, moduleDirectory } from '@shopify/cli-kit/node/path';
5
+ import { findPathUp } from '@shopify/cli-kit/node/fs';
4
6
  // Canonical list of oclif plugins that should be installed globally
5
7
  const globalPlugins = ['@shopify/theme'];
6
8
  export async function upgrade(directory, currentVersion) {
@@ -20,12 +22,12 @@ export async function upgrade(directory, currentVersion) {
20
22
  }
21
23
  }
22
24
  async function getProjectDir(directory) {
23
- const configFile = await path.findUp(['shopify.app.toml', 'hydrogen.config.js', 'hydrogen.config.ts'], {
25
+ const configFile = await findPathUp(['shopify.app.toml', 'hydrogen.config.js', 'hydrogen.config.ts'], {
24
26
  cwd: directory,
25
27
  type: 'file',
26
28
  });
27
29
  if (configFile)
28
- return path.dirname(configFile);
30
+ return dirname(configFile);
29
31
  }
30
32
  async function upgradeLocalShopify(projectDir, currentVersion) {
31
33
  const packageJson = (await findUpAndReadPackageJson(projectDir)).content;
@@ -110,7 +112,7 @@ async function oclifPlugins() {
110
112
  let _packageJsonContents;
111
113
  async function packageJsonContents() {
112
114
  if (!_packageJsonContents) {
113
- const packageJson = await findUpAndReadPackageJson(path.moduleDirectory(import.meta.url));
115
+ const packageJson = await findUpAndReadPackageJson(moduleDirectory(import.meta.url));
114
116
  _packageJsonContents = _packageJsonContents || packageJson.content;
115
117
  }
116
118
  return _packageJsonContents;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/services/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AACpD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAElB,iBAAiB,GAElB,MAAM,4CAA4C,CAAA;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,8BAA8B,CAAA;AAIjD,oEAAoE;AACpE,MAAM,aAAa,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAExC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAiB,EAAE,cAAsB;IACrE,IAAI,aAA4B,CAAA;IAEhC,M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, path} from '@shopify/cli-kit'\nimport {\n addNPMDependencies,\n findUpAndReadPackageJson,\n checkForNewVersion,\n DependencyType,\n getPackageManager,\n PackageJson,\n} from '@shopify/cli-kit/node/node-package-manager'\nimport {exec} from '@shopify/cli-kit/node/system'\n\ntype HomebrewPackageName = 'shopify-cli' | 'shopify-cli@3'\n\n// Canonical list of oclif plugins that should be installed globally\nconst globalPlugins = ['@shopify/theme']\n\nexport async function upgrade(directory: string, currentVersion: string): Promise<void> {\n let newestVersion: string | void\n\n const projectDir = await getProjectDir(directory)\n if (projectDir) {\n newestVersion = await upgradeLocalShopify(projectDir, currentVersion)\n } else if (usingPackageManager()) {\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 } else {\n newestVersion = await upgradeGlobalShopify(currentVersion)\n }\n\n if (newestVersion) {\n output.success(`Upgraded Shopify CLI to version ${newestVersion}`)\n }\n}\n\nasync function getProjectDir(directory: string): Promise<string | undefined> {\n const configFile = await path.findUp(['shopify.app.toml', 'hydrogen.config.js', 'hydrogen.config.ts'], {\n cwd: directory,\n type: 'file',\n })\n if (configFile) return path.dirname(configFile)\n}\n\nasync function upgradeLocalShopify(projectDir: string, currentVersion: string): Promise<string | void> {\n const packageJson = (await findUpAndReadPackageJson(projectDir)).content as PackageJson\n const packageJsonDependencies = packageJson.dependencies || {}\n const packageJsonDevDependencies = packageJson.devDependencies || {}\n\n let resolvedVersion: string = {...packageJsonDependencies, ...packageJsonDevDependencies}[await cliDependency()]!\n if (resolvedVersion.slice(0, 1).match(/[\\^~]/)) resolvedVersion = currentVersion\n const newestVersion = await checkForNewVersion(await cliDependency(), resolvedVersion)\n\n if (!newestVersion) {\n outputWontInstallMessage(resolvedVersion)\n return\n }\n\n outputUpgradeMessage(resolvedVersion, newestVersion)\n\n await installJsonDependencies('prod', packageJsonDependencies, projectDir)\n await installJsonDependencies('dev', packageJsonDevDependencies, projectDir)\n return newestVersion\n}\n\nasync function upgradeGlobalShopify(currentVersion: string): Promise<string | void> {\n const newestVersion = await checkForNewVersion(await cliDependency(), currentVersion)\n\n if (!newestVersion) {\n outputWontInstallMessage(currentVersion)\n return\n }\n\n outputUpgradeMessage(currentVersion, newestVersion)\n\n const homebrewPackage = process.env.SHOPIFY_HOMEBREW_FORMULA as HomebrewPackageName | undefined\n try {\n await (homebrewPackage ? upgradeGlobalViaHomebrew(homebrewPackage) : upgradeGlobalViaNpm())\n } catch (err) {\n output.warn('Upgrade failed!')\n throw err\n }\n return newestVersion\n}\n\nasync function upgradeGlobalViaHomebrew(homebrewPackage: HomebrewPackageName): Promise<void> {\n output.info(\n output.content`Homebrew installation detected. Attempting to upgrade via ${output.token.genericShellCommand(\n 'brew upgrade',\n )}...`,\n )\n await exec('brew', ['upgrade', homebrewPackage], {stdio: 'inherit'})\n}\n\nasync function upgradeGlobalViaNpm(): Promise<void> {\n const command = 'npm'\n const args = [\n 'install',\n '-g',\n `${await cliDependency()}@latest`,\n ...globalPlugins.map((plugin) => `${plugin}@latest`),\n ]\n output.info(\n output.content`Attempting to upgrade via ${output.token.genericShellCommand([command, ...args].join(' '))}...`,\n )\n await exec(command, args, {stdio: 'inherit'})\n}\n\nfunction outputWontInstallMessage(currentVersion: string): void {\n output.info(output.content`You're on the latest version, ${output.token.yellow(currentVersion)}, no need to upgrade!`)\n}\n\nfunction outputUpgradeMessage(currentVersion: string, newestVersion: string): void {\n output.info(\n output.content`Upgrading CLI from ${output.token.yellow(currentVersion)} to ${output.token.yellow(\n newestVersion,\n )}...`,\n )\n}\n\nasync function installJsonDependencies(\n depsEnv: DependencyType,\n deps: {[key: string]: string},\n directory: string,\n): Promise<void> {\n const packagesToUpdate = [await cliDependency(), ...(await oclifPlugins())]\n .filter((pkg: string): boolean => {\n const pkgRequirement: string | undefined = deps[pkg]\n return Boolean(pkgRequirement)\n })\n .map((pkg) => {\n return {name: pkg, version: 'latest'}\n })\n\n if (packagesToUpdate.length > 0) {\n await addNPMDependencies(packagesToUpdate, {\n packageManager: await getPackageManager(directory),\n type: depsEnv,\n directory,\n stdout: process.stdout,\n stderr: process.stderr,\n })\n }\n}\n\nasync function cliDependency(): Promise<string> {\n return (await packageJsonContents()).name\n}\n\nasync function oclifPlugins(): Promise<string[]> {\n return (await packageJsonContents())?.oclif?.plugins || []\n}\n\ntype PackageJsonWithName = Omit<PackageJson, 'name'> & {name: string}\nlet _packageJsonContents: PackageJsonWithName | undefined\n\nasync function packageJsonContents(): Promise<PackageJsonWithName> {\n if (!_packageJsonContents) {\n const packageJson = await findUpAndReadPackageJson(path.moduleDirectory(import.meta.url))\n _packageJsonContents = _packageJsonContents || (packageJson.content as PackageJsonWithName)\n }\n return _packageJsonContents\n}\n\nfunction usingPackageManager(): boolean {\n return Boolean(process.env.npm_config_user_agent)\n}\n"]}
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/services/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAElB,iBAAiB,GAElB,MAAM,4CAA4C,CAAA;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,8BAA8B,CAAA;AACjD,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAInD,oEAAoE;AACpE,MAAM,aAAa,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAExC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAiB,EAAE,cAAsB;IACrE,IAAI,aAA4B,CAAA;IAEhC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,CAAA;IACjD,IAAI,UAAU,EAAE;QACd,aAAa,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;KACtE;SAAM,IAAI,mB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G,EAAE,EAAE;QACX,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEJ,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,MAAM,kBAAkB,CAAC,gBAAgB,EAAE;YACzC,cAAc,EAAE,MAAM,iBAAiB,CAAC,SAAS,CAAC;YAClD,IAAI,EAAE,OAAO;YACb,SAAS;YACT,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAA;KACH;AACH,CAAC;AAED,KAAK,UAAU,aAAa;IAC1B,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAA;AAC3C,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAA;AAC5D,CAAC;AAGD,IAAI,oBAAqD,CAAA;AAEzD,KAAK,UAAU,mBAAmB;IAChC,IAAI,CAAC,oBAAoB,EAAE;QACzB,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACpF,oBAAoB,GAAG,oBAAoB,IAAK,WAAW,CAAC,OAA+B,CAAA;KAC5F;IACD,OAAO,oBAAoB,CAAA;AAC7B,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AACnD,CAAC","sourcesContent":["import {error, output} from '@shopify/cli-kit'\nimport {\n addNPMDependencies,\n findUpAndReadPackageJson,\n checkForNewVersion,\n DependencyType,\n getPackageManager,\n PackageJson,\n} from '@shopify/cli-kit/node/node-package-manager'\nimport {exec} from '@shopify/cli-kit/node/system'\nimport {dirname, moduleDirectory} from '@shopify/cli-kit/node/path'\nimport {findPathUp} from '@shopify/cli-kit/node/fs'\n\ntype HomebrewPackageName = 'shopify-cli' | 'shopify-cli@3'\n\n// Canonical list of oclif plugins that should be installed globally\nconst globalPlugins = ['@shopify/theme']\n\nexport async function upgrade(directory: string, currentVersion: string): Promise<void> {\n let newestVersion: string | void\n\n const projectDir = await getProjectDir(directory)\n if (projectDir) {\n newestVersion = await upgradeLocalShopify(projectDir, currentVersion)\n } else if (usingPackageManager()) {\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 } else {\n newestVersion = await upgradeGlobalShopify(currentVersion)\n }\n\n if (newestVersion) {\n output.success(`Upgraded Shopify CLI to version ${newestVersion}`)\n }\n}\n\nasync function getProjectDir(directory: string): Promise<string | undefined> {\n const configFile = await findPathUp(['shopify.app.toml', 'hydrogen.config.js', 'hydrogen.config.ts'], {\n cwd: directory,\n type: 'file',\n })\n if (configFile) return dirname(configFile)\n}\n\nasync function upgradeLocalShopify(projectDir: string, currentVersion: string): Promise<string | void> {\n const packageJson = (await findUpAndReadPackageJson(projectDir)).content\n const packageJsonDependencies = packageJson.dependencies || {}\n const packageJsonDevDependencies = packageJson.devDependencies || {}\n\n let resolvedVersion: string = {...packageJsonDependencies, ...packageJsonDevDependencies}[await cliDependency()]!\n if (resolvedVersion.slice(0, 1).match(/[\\^~]/)) resolvedVersion = currentVersion\n const newestVersion = await checkForNewVersion(await cliDependency(), resolvedVersion)\n\n if (!newestVersion) {\n outputWontInstallMessage(resolvedVersion)\n return\n }\n\n outputUpgradeMessage(resolvedVersion, newestVersion)\n\n await installJsonDependencies('prod', packageJsonDependencies, projectDir)\n await installJsonDependencies('dev', packageJsonDevDependencies, projectDir)\n return newestVersion\n}\n\nasync function upgradeGlobalShopify(currentVersion: string): Promise<string | void> {\n const newestVersion = await checkForNewVersion(await cliDependency(), currentVersion)\n\n if (!newestVersion) {\n outputWontInstallMessage(currentVersion)\n return\n }\n\n outputUpgradeMessage(currentVersion, newestVersion)\n\n const homebrewPackage = process.env.SHOPIFY_HOMEBREW_FORMULA as HomebrewPackageName | undefined\n try {\n await (homebrewPackage ? upgradeGlobalViaHomebrew(homebrewPackage) : upgradeGlobalViaNpm())\n } catch (err) {\n output.warn('Upgrade failed!')\n throw err\n }\n return newestVersion\n}\n\nasync function upgradeGlobalViaHomebrew(homebrewPackage: HomebrewPackageName): Promise<void> {\n output.info(\n output.content`Homebrew installation detected. Attempting to upgrade via ${output.token.genericShellCommand(\n 'brew upgrade',\n )}...`,\n )\n await exec('brew', ['upgrade', homebrewPackage], {stdio: 'inherit'})\n}\n\nasync function upgradeGlobalViaNpm(): Promise<void> {\n const command = 'npm'\n const args = [\n 'install',\n '-g',\n `${await cliDependency()}@latest`,\n ...globalPlugins.map((plugin) => `${plugin}@latest`),\n ]\n output.info(\n output.content`Attempting to upgrade via ${output.token.genericShellCommand([command, ...args].join(' '))}...`,\n )\n await exec(command, args, {stdio: 'inherit'})\n}\n\nfunction outputWontInstallMessage(currentVersion: string): void {\n output.info(output.content`You're on the latest version, ${output.token.yellow(currentVersion)}, no need to upgrade!`)\n}\n\nfunction outputUpgradeMessage(currentVersion: string, newestVersion: string): void {\n output.info(\n output.content`Upgrading CLI from ${output.token.yellow(currentVersion)} to ${output.token.yellow(\n newestVersion,\n )}...`,\n )\n}\n\nasync function installJsonDependencies(\n depsEnv: DependencyType,\n deps: {[key: string]: string},\n directory: string,\n): Promise<void> {\n const packagesToUpdate = [await cliDependency(), ...(await oclifPlugins())]\n .filter((pkg: string): boolean => {\n const pkgRequirement: string | undefined = deps[pkg]\n return Boolean(pkgRequirement)\n })\n .map((pkg) => {\n return {name: pkg, version: 'latest'}\n })\n\n if (packagesToUpdate.length > 0) {\n await addNPMDependencies(packagesToUpdate, {\n packageManager: await getPackageManager(directory),\n type: depsEnv,\n directory,\n stdout: process.stdout,\n stderr: process.stderr,\n })\n }\n}\n\nasync function cliDependency(): Promise<string> {\n return (await packageJsonContents()).name\n}\n\nasync function oclifPlugins(): Promise<string[]> {\n return (await packageJsonContents())?.oclif?.plugins || []\n}\n\ntype PackageJsonWithName = Omit<PackageJson, 'name'> & {name: string}\nlet _packageJsonContents: PackageJsonWithName | undefined\n\nasync function packageJsonContents(): Promise<PackageJsonWithName> {\n if (!_packageJsonContents) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(import.meta.url))\n _packageJsonContents = _packageJsonContents || (packageJson.content as PackageJsonWithName)\n }\n return _packageJsonContents\n}\n\nfunction usingPackageManager(): boolean {\n return Boolean(process.env.npm_config_user_agent)\n}\n"]}