@shopify/create-app 3.58.2 → 3.59.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.
Files changed (82) hide show
  1. package/dist/chunk-3JLUTHGR.js +114 -0
  2. package/dist/chunk-3JNB3A7C.js +14080 -0
  3. package/dist/chunk-6IZ3YCE6.js +144 -0
  4. package/dist/chunk-7XQTD3L4.js +213522 -0
  5. package/dist/chunk-DJYDRQPG.js +30996 -0
  6. package/dist/chunk-DY2DAXN2.js +104 -0
  7. package/dist/chunk-F6KQQF76.js +7817 -0
  8. package/dist/chunk-FBB6KUZG.js +821 -0
  9. package/dist/chunk-G6FN5VUE.js +102 -0
  10. package/dist/chunk-GXPKATXW.js +194 -0
  11. package/dist/chunk-HCBGYFVF.js +99 -0
  12. package/dist/chunk-IL6UMTVA.js +62 -0
  13. package/dist/chunk-LKGDG6WW.js +87 -0
  14. package/dist/chunk-M63RTPGR.js +63 -0
  15. package/dist/chunk-OFS45IA7.js +2468 -0
  16. package/dist/chunk-P4TVG45N.js +900 -0
  17. package/dist/chunk-SSNXQGVF.js +11 -0
  18. package/dist/chunk-TDBGZYDD.js +45349 -0
  19. package/dist/chunk-TMGCRPEZ.js +4283 -0
  20. package/dist/chunk-UVY6LL5H.js +145 -0
  21. package/dist/chunk-VJ2TN2CW.js +72 -0
  22. package/dist/chunk-WCNR75S2.js +73 -0
  23. package/dist/chunk-WETZUTXU.js +18914 -0
  24. package/dist/chunk-WK5TEOA2.js +37 -0
  25. package/dist/chunk-X4SHWSZZ.js +3179 -0
  26. package/dist/chunk-YJIQMGQH.js +13764 -0
  27. package/dist/chunk-YLEF4RUH.js +144 -0
  28. package/dist/chunk-ZPB26OWQ.js +5605 -0
  29. package/dist/commands/init.js +31 -123
  30. package/dist/commands/init.test.js +123 -0
  31. package/dist/constants-K3R4N3N3.js +19 -0
  32. package/dist/custom-oclif-loader-2S5LB2FS.js +83 -0
  33. package/dist/del-A5YM6R3Y.js +2846 -0
  34. package/dist/devtools-KQM4GF6J.js +3685 -0
  35. package/dist/error-handler-N3GIE2DS.js +34 -0
  36. package/dist/hooks/postrun.js +108 -2
  37. package/dist/hooks/prerun.js +77 -2
  38. package/dist/index.js +22 -7
  39. package/dist/lib-76JUGQYQ.js +8 -0
  40. package/dist/local-NYXQXMB7.js +59 -0
  41. package/dist/magic-string.es-6WMSFIAX.js +1291 -0
  42. package/dist/multipart-parser-O2BQODS2.js +359 -0
  43. package/dist/node-package-manager-3J3VEQCR.js +68 -0
  44. package/dist/open-B7XFJJCK.js +290 -0
  45. package/dist/out-JZ52TJE3.js +5 -0
  46. package/dist/path-HO4HBKK5.js +28 -0
  47. package/dist/prompts/init.js +23 -118
  48. package/dist/prompts/init.test.js +115 -0
  49. package/dist/services/init.js +25 -139
  50. package/dist/services/init.test.js +18 -0
  51. package/dist/system-5VPAJEUM.js +25 -0
  52. package/dist/ui-D34IKHO6.js +49 -0
  53. package/dist/utils/template/cleanup.js +18 -19
  54. package/dist/utils/template/cleanup.test.js +74 -0
  55. package/dist/utils/template/npm.js +22 -58
  56. package/dist/utils/template/npm.test.js +153 -0
  57. package/dist/yoga.wasm +0 -0
  58. package/oclif.manifest.json +1 -1
  59. package/package.json +5 -6
  60. package/dist/commands/init.d.ts +0 -20
  61. package/dist/commands/init.js.map +0 -1
  62. package/dist/constants.d.ts +0 -1
  63. package/dist/constants.js +0 -2
  64. package/dist/constants.js.map +0 -1
  65. package/dist/hooks/postrun.d.ts +0 -1
  66. package/dist/hooks/postrun.js.map +0 -1
  67. package/dist/hooks/prerun.d.ts +0 -1
  68. package/dist/hooks/prerun.js.map +0 -1
  69. package/dist/index.d.ts +0 -2
  70. package/dist/index.js.map +0 -1
  71. package/dist/prompts/init.d.ts +0 -39
  72. package/dist/prompts/init.js.map +0 -1
  73. package/dist/services/init.d.ts +0 -9
  74. package/dist/services/init.js.map +0 -1
  75. package/dist/tsconfig.tsbuildinfo +0 -1
  76. package/dist/utils/template/cleanup.d.ts +0 -1
  77. package/dist/utils/template/cleanup.js.map +0 -1
  78. package/dist/utils/template/npm.d.ts +0 -12
  79. package/dist/utils/template/npm.js.map +0 -1
  80. package/dist/utils/versions.d.ts +0 -1
  81. package/dist/utils/versions.js +0 -21
  82. package/dist/utils/versions.js.map +0 -1
@@ -1,124 +1,32 @@
1
- var _a;
2
- import initPrompt, { isPredefinedTemplate, templates, visibleTemplates } from '../prompts/init.js';
3
- import initService from '../services/init.js';
4
- import { Flags } from '@oclif/core';
5
- import { globalFlags } from '@shopify/cli-kit/node/cli';
6
- import Command from '@shopify/cli-kit/node/base-command';
7
- import { resolvePath, cwd } from '@shopify/cli-kit/node/path';
8
- import { AbortError } from '@shopify/cli-kit/node/error';
9
- import { outputContent, outputToken } from '@shopify/cli-kit/node/output';
10
- import { addPublicMetadata } from '@shopify/cli-kit/node/metadata';
11
- // eslint-disable-next-line node/prefer-global/url
12
- import { URL } from 'url';
13
- class Init extends Command {
14
- async run() {
15
- const { flags } = await this.parse(_a);
16
- this.validateTemplateValue(flags.template);
17
- this.validateFlavorValue(flags.template, flags.flavor);
18
- const promptAnswers = await initPrompt({
19
- name: flags.name,
20
- template: flags.template,
21
- flavor: flags.flavor,
22
- directory: flags.path,
23
- });
24
- await addPublicMetadata(() => ({
25
- cmd_create_app_template: promptAnswers.templateType,
26
- cmd_create_app_template_url: promptAnswers.template,
27
- }));
28
- await initService({
29
- name: promptAnswers.name,
30
- packageManager: flags['package-manager'],
31
- template: promptAnswers.template,
32
- local: flags.local,
33
- directory: flags.path,
34
- });
35
- }
36
- validateTemplateValue(template) {
37
- if (!template) {
38
- return;
39
- }
40
- const url = this.parseURL(template);
41
- if (url && url.origin !== 'https://github.com')
42
- throw new AbortError('Only GitHub repository references are supported, ' +
43
- 'e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]');
44
- if (!url && !isPredefinedTemplate(template))
45
- throw new AbortError(outputContent `Only ${visibleTemplates
46
- .map((alias) => outputContent `${outputToken.yellow(alias)}`.value)
47
- .join(', ')} template aliases are supported`);
48
- }
49
- validateFlavorValue(template, flavor) {
50
- if (!template) {
51
- if (flavor) {
52
- throw new AbortError(outputContent `The ${outputToken.yellow('--flavor')} flag requires the ${outputToken.yellow('--template')} flag to be set`);
53
- }
54
- else {
55
- return;
56
- }
57
- }
58
- if (!flavor) {
59
- return;
60
- }
61
- if (!isPredefinedTemplate(template)) {
62
- throw new AbortError(outputContent `The ${outputToken.yellow('--flavor')} flag is not supported for custom templates`);
63
- }
64
- const templateConfig = templates[template];
65
- if (!templateConfig.branches) {
66
- throw new AbortError(outputContent `The ${outputToken.yellow(template)} template does not support flavors`);
67
- }
68
- if (!templateConfig.branches.options[flavor]) {
69
- throw new AbortError(outputContent `Invalid option for ${outputToken.yellow('--flavor')}\nThe ${outputToken.yellow('--flavor')} flag for ${outputToken.yellow(template)} accepts only ${Object.keys(templateConfig.branches.options)
70
- .map((alias) => outputContent `${outputToken.yellow(alias)}`.value)
71
- .join(', ')}`);
72
- }
73
- }
74
- parseURL(url) {
75
- try {
76
- return new URL(url);
77
- // eslint-disable-next-line no-catch-all/no-catch-all
78
- }
79
- catch (error) {
80
- return undefined;
81
- }
82
- }
83
- }
84
- _a = Init;
85
- Init.summary = 'Create a new app project';
86
- Init.flags = {
87
- ...globalFlags,
88
- name: Flags.string({
89
- char: 'n',
90
- env: 'SHOPIFY_FLAG_NAME',
91
- hidden: false,
92
- }),
93
- path: Flags.string({
94
- char: 'p',
95
- env: 'SHOPIFY_FLAG_PATH',
96
- parse: async (input) => resolvePath(input),
97
- default: async () => cwd(),
98
- hidden: false,
99
- }),
100
- template: Flags.string({
101
- description: `The app template. Accepts one of the following:
102
- - <${visibleTemplates.join('|')}>
103
- - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]`,
104
- env: 'SHOPIFY_FLAG_TEMPLATE',
105
- }),
106
- flavor: Flags.string({
107
- description: 'Which flavor of the given template to use.',
108
- env: 'SHOPIFY_FLAG_TEMPLATE_FLAVOR',
109
- }),
110
- 'package-manager': Flags.string({
111
- char: 'd',
112
- env: 'SHOPIFY_FLAG_PACKAGE_MANAGER',
113
- hidden: false,
114
- options: ['npm', 'yarn', 'pnpm', 'bun'],
115
- }),
116
- local: Flags.boolean({
117
- char: 'l',
118
- env: 'SHOPIFY_FLAG_LOCAL',
119
- default: false,
120
- hidden: true,
121
- }),
1
+ import {
2
+ Init
3
+ } from "../chunk-OFS45IA7.js";
4
+ import "../chunk-X4SHWSZZ.js";
5
+ import "../chunk-LKGDG6WW.js";
6
+ import "../chunk-F6KQQF76.js";
7
+ import "../chunk-WK5TEOA2.js";
8
+ import "../chunk-IL6UMTVA.js";
9
+ import "../chunk-WETZUTXU.js";
10
+ import "../chunk-DJYDRQPG.js";
11
+ import "../chunk-SSNXQGVF.js";
12
+ import "../chunk-TMGCRPEZ.js";
13
+ import "../chunk-HCBGYFVF.js";
14
+ import "../chunk-VJ2TN2CW.js";
15
+ import "../chunk-YJIQMGQH.js";
16
+ import "../chunk-DY2DAXN2.js";
17
+ import "../chunk-6IZ3YCE6.js";
18
+ import "../chunk-TDBGZYDD.js";
19
+ import "../chunk-FBB6KUZG.js";
20
+ import "../chunk-YLEF4RUH.js";
21
+ import "../chunk-G6FN5VUE.js";
22
+ import "../chunk-UVY6LL5H.js";
23
+ import "../chunk-7XQTD3L4.js";
24
+ import "../chunk-P4TVG45N.js";
25
+ import "../chunk-ZPB26OWQ.js";
26
+ import "../chunk-WCNR75S2.js";
27
+ import "../chunk-3JLUTHGR.js";
28
+ import "../chunk-GXPKATXW.js";
29
+ import "../chunk-M63RTPGR.js";
30
+ export {
31
+ Init as default
122
32
  };
123
- export default Init;
124
- //# sourceMappingURL=init.js.map
@@ -0,0 +1,123 @@
1
+ import {
2
+ Init
3
+ } from "../chunk-OFS45IA7.js";
4
+ import {
5
+ errorHandler
6
+ } from "../chunk-X4SHWSZZ.js";
7
+ import "../chunk-LKGDG6WW.js";
8
+ import {
9
+ init_default
10
+ } from "../chunk-F6KQQF76.js";
11
+ import "../chunk-WK5TEOA2.js";
12
+ import "../chunk-IL6UMTVA.js";
13
+ import "../chunk-WETZUTXU.js";
14
+ import "../chunk-DJYDRQPG.js";
15
+ import "../chunk-SSNXQGVF.js";
16
+ import "../chunk-TMGCRPEZ.js";
17
+ import "../chunk-HCBGYFVF.js";
18
+ import "../chunk-VJ2TN2CW.js";
19
+ import "../chunk-YJIQMGQH.js";
20
+ import "../chunk-DY2DAXN2.js";
21
+ import {
22
+ init_exports,
23
+ visibleTemplates
24
+ } from "../chunk-6IZ3YCE6.js";
25
+ import {
26
+ AbortError,
27
+ outputContent,
28
+ outputToken
29
+ } from "../chunk-TDBGZYDD.js";
30
+ import "../chunk-FBB6KUZG.js";
31
+ import "../chunk-YLEF4RUH.js";
32
+ import "../chunk-G6FN5VUE.js";
33
+ import "../chunk-UVY6LL5H.js";
34
+ import {
35
+ require_lib
36
+ } from "../chunk-7XQTD3L4.js";
37
+ import "../chunk-P4TVG45N.js";
38
+ import "../chunk-ZPB26OWQ.js";
39
+ import "../chunk-WCNR75S2.js";
40
+ import {
41
+ beforeEach,
42
+ describe,
43
+ globalExpect,
44
+ test,
45
+ vi
46
+ } from "../chunk-3JNB3A7C.js";
47
+ import "../chunk-3JLUTHGR.js";
48
+ import "../chunk-GXPKATXW.js";
49
+ import {
50
+ __toESM,
51
+ init_cjs_shims
52
+ } from "../chunk-M63RTPGR.js";
53
+
54
+ // src/commands/init.test.ts
55
+ init_cjs_shims();
56
+ var import_core = __toESM(require_lib(), 1);
57
+ vi.mock("../services/init");
58
+ vi.mock("@shopify/cli-kit/node/error-handler");
59
+ vi.mock("@oclif/core", async () => {
60
+ const actual = await vi.importActual("@oclif/core");
61
+ return {
62
+ ...actual,
63
+ Errors: {
64
+ handle: vi.fn()
65
+ }
66
+ };
67
+ });
68
+ beforeEach(() => {
69
+ vi.spyOn(init_exports, "default").mockResolvedValue({
70
+ name: "name",
71
+ template: "http://test.es",
72
+ templateType: "custom",
73
+ globalCLIResult: { install: false, alreadyInstalled: false }
74
+ });
75
+ });
76
+ describe("create app command", () => {
77
+ test("executes correctly when no template flag receivec", async () => {
78
+ await Init.run();
79
+ globalExpect(init_default).toHaveBeenCalledOnce();
80
+ });
81
+ test.each(["remix"])("executes correctly when using %s as a template alias name", async (alias) => {
82
+ await Init.run(["--template", alias]);
83
+ globalExpect(init_default).toHaveBeenCalledOnce();
84
+ });
85
+ test("executes correctly when using a flavor for the remix template", async () => {
86
+ await Init.run(["--template", "remix", "--flavor", "javascript"]);
87
+ globalExpect(init_default).toHaveBeenCalledOnce();
88
+ });
89
+ test("executes correctly when using a non-visible template alias name", async () => {
90
+ await Init.run(["--template", "node"]);
91
+ globalExpect(init_default).toHaveBeenCalledOnce();
92
+ });
93
+ test("executes correctly when using a github url as a template alias name", async () => {
94
+ await Init.run(["--template", "https://github.com/myrepo"]);
95
+ globalExpect(init_default).toHaveBeenCalledOnce();
96
+ });
97
+ test("throw an error when using a non supported template alias name", async () => {
98
+ vi.mocked(errorHandler).mockImplementation(async () => {
99
+ });
100
+ await Init.run(["--template", "java"]);
101
+ const anyConfig = globalExpect.any(import_core.Config);
102
+ const expectedError = new AbortError(
103
+ outputContent`Only ${visibleTemplates.map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")} template aliases are supported`
104
+ );
105
+ globalExpect(errorHandler).toHaveBeenCalledWith(expectedError, anyConfig);
106
+ });
107
+ test("throw an error when using a non github url repo", async () => {
108
+ await Init.run(["--template", "http://nongithub.com/myrepo"]);
109
+ const anyConfig = globalExpect.any(import_core.Config);
110
+ const expectedError = new AbortError(
111
+ "Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]"
112
+ );
113
+ globalExpect(errorHandler).toHaveBeenCalledWith(expectedError, anyConfig);
114
+ });
115
+ test("throw an error when using a flavor for a template that has no branches set up", async () => {
116
+ await Init.run(["--template", "node", "--flavor", "javascript"]);
117
+ const anyConfig = globalExpect.any(import_core.Config);
118
+ const expectedError = new AbortError(
119
+ outputContent`The ${outputToken.yellow("node")} template does not support flavors`
120
+ );
121
+ globalExpect(errorHandler).toHaveBeenCalledWith(expectedError, anyConfig);
122
+ });
123
+ });
@@ -0,0 +1,19 @@
1
+ import {
2
+ bugsnagApiKey,
3
+ defaultThemeKitAccessDomain,
4
+ environmentVariables,
5
+ pathConstants,
6
+ sessionConstants,
7
+ systemEnvironmentVariables
8
+ } from "./chunk-YLEF4RUH.js";
9
+ import "./chunk-G6FN5VUE.js";
10
+ import "./chunk-GXPKATXW.js";
11
+ import "./chunk-M63RTPGR.js";
12
+ export {
13
+ bugsnagApiKey,
14
+ defaultThemeKitAccessDomain,
15
+ environmentVariables,
16
+ pathConstants,
17
+ sessionConstants,
18
+ systemEnvironmentVariables
19
+ };
@@ -0,0 +1,83 @@
1
+ import {
2
+ fileExistsSync
3
+ } from "./chunk-TDBGZYDD.js";
4
+ import "./chunk-FBB6KUZG.js";
5
+ import "./chunk-YLEF4RUH.js";
6
+ import {
7
+ cwd,
8
+ joinPath
9
+ } from "./chunk-G6FN5VUE.js";
10
+ import "./chunk-UVY6LL5H.js";
11
+ import {
12
+ require_lib
13
+ } from "./chunk-7XQTD3L4.js";
14
+ import "./chunk-P4TVG45N.js";
15
+ import "./chunk-ZPB26OWQ.js";
16
+ import "./chunk-WCNR75S2.js";
17
+ import "./chunk-3JLUTHGR.js";
18
+ import "./chunk-GXPKATXW.js";
19
+ import {
20
+ __toESM,
21
+ init_cjs_shims
22
+ } from "./chunk-M63RTPGR.js";
23
+
24
+ // ../cli-kit/src/public/node/custom-oclif-loader.ts
25
+ init_cjs_shims();
26
+ var import_core = __toESM(require_lib(), 1);
27
+ var ShopifyConfig = class extends import_core.Config {
28
+ constructor(options) {
29
+ const path = sniffForPath() ?? cwd();
30
+ if (fileExistsSync(joinPath(`${path}`, "package.json"))) {
31
+ options.pluginAdditions = {
32
+ core: ["@shopify/cli-hydrogen"],
33
+ path
34
+ };
35
+ }
36
+ super(options);
37
+ this["determinePriority"] = this.customPriority;
38
+ }
39
+ customPriority(commands) {
40
+ const oclifPlugins = this.pjson.oclif?.plugins ?? [];
41
+ const commandPlugins = commands.sort((aCommand, bCommand) => {
42
+ const pluginAliasA = aCommand.pluginAlias ?? "A-Cannot-Find-This";
43
+ const pluginAliasB = bCommand.pluginAlias ?? "B-Cannot-Find-This";
44
+ const aIndex = oclifPlugins.indexOf(pluginAliasA);
45
+ const bIndex = oclifPlugins.indexOf(pluginAliasB);
46
+ if (aCommand.pluginType === "core" && bCommand.pluginAlias === "@shopify/cli-hydrogen") {
47
+ return 1;
48
+ }
49
+ if (aCommand.pluginAlias === "@shopify/cli-hydrogen" && bCommand.pluginType === "core") {
50
+ return -1;
51
+ }
52
+ if (aCommand.pluginType === "core" && bCommand.pluginType === "core") {
53
+ return aIndex - bIndex;
54
+ }
55
+ if (bCommand.pluginType === "core" && aCommand.pluginType !== "core") {
56
+ return 1;
57
+ }
58
+ if (aCommand.pluginType === "core" && bCommand.pluginType !== "core") {
59
+ return -1;
60
+ }
61
+ if (aCommand.pluginType === "jit" && bCommand.pluginType !== "jit") {
62
+ return 1;
63
+ }
64
+ if (bCommand.pluginType === "jit" && aCommand.pluginType !== "jit") {
65
+ return -1;
66
+ }
67
+ return 0;
68
+ });
69
+ return commandPlugins[0];
70
+ }
71
+ };
72
+ function sniffForPath() {
73
+ const pathFlagIndex = process.argv.indexOf("--path");
74
+ if (pathFlagIndex === -1)
75
+ return;
76
+ const pathFlag = process.argv[pathFlagIndex + 1];
77
+ if (!pathFlag || pathFlag.startsWith("-"))
78
+ return;
79
+ return pathFlag;
80
+ }
81
+ export {
82
+ ShopifyConfig
83
+ };