@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
@@ -0,0 +1,5 @@
1
+ import {
2
+ require_out
3
+ } from "./chunk-ZPB26OWQ.js";
4
+ import "./chunk-M63RTPGR.js";
5
+ export default require_out();
@@ -0,0 +1,28 @@
1
+ import {
2
+ basename,
3
+ cwd,
4
+ dirname,
5
+ extname,
6
+ isAbsolutePath,
7
+ joinPath,
8
+ moduleDirectory,
9
+ normalizePath,
10
+ relativePath,
11
+ relativizePath,
12
+ resolvePath
13
+ } from "./chunk-G6FN5VUE.js";
14
+ import "./chunk-GXPKATXW.js";
15
+ import "./chunk-M63RTPGR.js";
16
+ export {
17
+ basename,
18
+ cwd,
19
+ dirname,
20
+ extname,
21
+ isAbsolutePath,
22
+ joinPath,
23
+ moduleDirectory,
24
+ normalizePath,
25
+ relativePath,
26
+ relativizePath,
27
+ resolvePath
28
+ };
@@ -1,119 +1,24 @@
1
- import { generateRandomNameForSubdirectory } from '@shopify/cli-kit/node/fs';
2
- import { renderText, renderSelectPrompt, renderTextPrompt } from '@shopify/cli-kit/node/ui';
3
- // Eventually this list should be taken from a remote location
4
- // That way we don't have to update the CLI every time we add a template
5
- export const templates = {
6
- remix: {
7
- url: 'https://github.com/Shopify/shopify-app-template-remix',
8
- label: 'Start with Remix (recommended)',
9
- visible: true,
10
- branches: {
11
- prompt: 'For your Remix template, which language do you want?',
12
- options: {
13
- javascript: { branch: 'javascript', label: 'JavaScript' },
14
- typescript: { branch: 'main', label: 'TypeScript' },
15
- },
16
- },
17
- },
18
- none: {
19
- url: 'https://github.com/Shopify/shopify-app-template-none',
20
- label: 'Start by adding your first extension',
21
- visible: true,
22
- },
23
- node: {
24
- url: 'https://github.com/Shopify/shopify-app-template-node',
25
- visible: false,
26
- },
27
- php: {
28
- url: 'https://github.com/Shopify/shopify-app-template-php',
29
- visible: false,
30
- },
31
- ruby: {
32
- url: 'https://github.com/Shopify/shopify-app-template-ruby',
33
- visible: false,
34
- },
1
+ import {
2
+ init_default,
3
+ isPredefinedTemplate,
4
+ templates,
5
+ visibleTemplates
6
+ } from "../chunk-6IZ3YCE6.js";
7
+ import "../chunk-TDBGZYDD.js";
8
+ import "../chunk-FBB6KUZG.js";
9
+ import "../chunk-YLEF4RUH.js";
10
+ import "../chunk-G6FN5VUE.js";
11
+ import "../chunk-UVY6LL5H.js";
12
+ import "../chunk-7XQTD3L4.js";
13
+ import "../chunk-P4TVG45N.js";
14
+ import "../chunk-ZPB26OWQ.js";
15
+ import "../chunk-WCNR75S2.js";
16
+ import "../chunk-3JLUTHGR.js";
17
+ import "../chunk-GXPKATXW.js";
18
+ import "../chunk-M63RTPGR.js";
19
+ export {
20
+ init_default as default,
21
+ isPredefinedTemplate,
22
+ templates,
23
+ visibleTemplates
35
24
  };
36
- export const allTemplates = Object.keys(templates);
37
- export const visibleTemplates = allTemplates.filter((key) => templates[key].visible);
38
- const templateOptionsInOrder = ['remix', 'none'];
39
- const init = async (options) => {
40
- let name = options.name;
41
- let template = options.template;
42
- const flavor = options.flavor;
43
- const defaults = {
44
- name: await generateRandomNameForSubdirectory({ suffix: 'app', directory: options.directory }),
45
- template: templates.remix.url,
46
- };
47
- let welcomed = false;
48
- if (!name) {
49
- renderText({ text: '\nWelcome. Let’s get started by naming your app project. You can change it later.' });
50
- welcomed = true;
51
- name = await renderTextPrompt({
52
- message: 'Your project name?',
53
- defaultValue: defaults.name,
54
- validate: (value) => {
55
- if (value.length === 0) {
56
- return "App name can't be empty";
57
- }
58
- if (value.length > 30) {
59
- return 'Enter a shorter name (30 character max.)';
60
- }
61
- if (value.toLowerCase().includes('shopify')) {
62
- return "App name can't include the word 'shopify'";
63
- }
64
- },
65
- });
66
- }
67
- if (!template) {
68
- if (!welcomed) {
69
- renderText({ text: '\nWelcome. Let’s get started by choosing a template for your app project.' });
70
- welcomed = true;
71
- }
72
- template = await renderSelectPrompt({
73
- choices: templateOptionsInOrder.map((key) => {
74
- return {
75
- label: templates[key].label || key,
76
- value: key,
77
- };
78
- }),
79
- message: 'Get started building your app:',
80
- defaultValue: allTemplates.find((key) => templates[key].url === defaults.template),
81
- });
82
- }
83
- const answers = {
84
- ...options,
85
- name,
86
- template,
87
- templateType: isPredefinedTemplate(template) ? template : 'custom',
88
- };
89
- let selectedUrl;
90
- let branch;
91
- if (answers.templateType !== 'custom') {
92
- const selectedTemplate = templates[answers.templateType];
93
- selectedUrl = selectedTemplate.url;
94
- if (selectedTemplate.branches) {
95
- if (flavor) {
96
- branch = selectedTemplate.branches.options[flavor]?.branch;
97
- }
98
- else {
99
- branch = await renderSelectPrompt({
100
- message: selectedTemplate.branches.prompt || 'Choose a flavor:',
101
- choices: Object.entries(selectedTemplate.branches.options).map(([_key, branch]) => ({
102
- value: branch.branch,
103
- label: branch.label,
104
- })),
105
- });
106
- }
107
- }
108
- }
109
- if (branch) {
110
- selectedUrl += `#${branch}`;
111
- }
112
- answers.template = selectedUrl || answers.template || defaults.template;
113
- return answers;
114
- };
115
- export default init;
116
- export function isPredefinedTemplate(template) {
117
- return allTemplates.includes(template);
118
- }
119
- //# sourceMappingURL=init.js.map
@@ -0,0 +1,115 @@
1
+ import {
2
+ init_default
3
+ } from "../chunk-6IZ3YCE6.js";
4
+ import {
5
+ installGlobalCLIPrompt,
6
+ renderSelectPrompt,
7
+ renderText,
8
+ renderTextPrompt
9
+ } from "../chunk-TDBGZYDD.js";
10
+ import "../chunk-FBB6KUZG.js";
11
+ import "../chunk-YLEF4RUH.js";
12
+ import "../chunk-G6FN5VUE.js";
13
+ import "../chunk-UVY6LL5H.js";
14
+ import "../chunk-7XQTD3L4.js";
15
+ import "../chunk-P4TVG45N.js";
16
+ import "../chunk-ZPB26OWQ.js";
17
+ import "../chunk-WCNR75S2.js";
18
+ import {
19
+ beforeEach,
20
+ describe,
21
+ globalExpect,
22
+ test,
23
+ vi
24
+ } from "../chunk-3JNB3A7C.js";
25
+ import "../chunk-3JLUTHGR.js";
26
+ import "../chunk-GXPKATXW.js";
27
+ import {
28
+ init_cjs_shims
29
+ } from "../chunk-M63RTPGR.js";
30
+
31
+ // src/prompts/init.test.ts
32
+ init_cjs_shims();
33
+ vi.mock("@shopify/cli-kit/node/ui");
34
+ vi.mock("@shopify/cli-kit/node/is-global");
35
+ var globalCLIResult = { install: true, alreadyInstalled: false };
36
+ describe("init", () => {
37
+ beforeEach(() => {
38
+ vi.mocked(installGlobalCLIPrompt).mockResolvedValue(globalCLIResult);
39
+ });
40
+ test("when name is not passed", async () => {
41
+ const answers = {
42
+ name: "app"
43
+ };
44
+ const options = { template: "template", directory: "/" };
45
+ vi.mocked(renderTextPrompt).mockResolvedValueOnce(answers.name);
46
+ const got = await init_default(options);
47
+ globalExpect(renderText).toHaveBeenCalledWith({
48
+ text: "\nWelcome. Let\u2019s get started by naming your app project. You can change it later."
49
+ });
50
+ globalExpect(renderTextPrompt).toHaveBeenCalledWith({
51
+ message: "Your project name?",
52
+ defaultValue: globalExpect.stringMatching(/^\w+-\w+-app$/),
53
+ validate: globalExpect.any(Function)
54
+ });
55
+ globalExpect(got).toEqual({ ...options, ...answers, templateType: "custom", globalCLIResult });
56
+ });
57
+ test("when name is passed", async () => {
58
+ const answers = {
59
+ template: "https://github.com/Shopify/shopify-app-template-remix"
60
+ };
61
+ const options = { name: "app", directory: "/" };
62
+ const got = await init_default(options);
63
+ globalExpect(renderText).toHaveBeenCalledWith({
64
+ text: "\nWelcome. Let\u2019s get started by choosing a template for your app project."
65
+ });
66
+ globalExpect(renderTextPrompt).not.toHaveBeenCalled();
67
+ globalExpect(got).toEqual({ ...options, ...answers, templateType: "custom", globalCLIResult });
68
+ });
69
+ test("it renders the label for the template options", async () => {
70
+ const answers = {
71
+ name: "app",
72
+ template: "https://github.com/Shopify/shopify-app-template-none"
73
+ };
74
+ const options = { directory: "/" };
75
+ vi.mocked(renderTextPrompt).mockResolvedValueOnce(answers.name);
76
+ vi.mocked(renderSelectPrompt).mockResolvedValueOnce("none");
77
+ const got = await init_default(options);
78
+ globalExpect(renderSelectPrompt).toHaveBeenCalledWith({
79
+ choices: [
80
+ { label: "Start with Remix (recommended)", value: "remix" },
81
+ { label: "Start by adding your first extension", value: "none" }
82
+ ],
83
+ message: "Get started building your app:",
84
+ defaultValue: "remix"
85
+ });
86
+ globalExpect(got).toEqual({ ...options, ...answers, templateType: "none", globalCLIResult });
87
+ });
88
+ test("it renders branches for templates that have them", async () => {
89
+ const answers = {
90
+ name: "app",
91
+ template: "https://github.com/Shopify/shopify-app-template-remix#javascript"
92
+ };
93
+ const options = { directory: "/" };
94
+ vi.mocked(renderTextPrompt).mockResolvedValueOnce(answers.name);
95
+ vi.mocked(renderSelectPrompt).mockResolvedValueOnce("remix");
96
+ vi.mocked(renderSelectPrompt).mockResolvedValueOnce("javascript");
97
+ const got = await init_default(options);
98
+ globalExpect(renderSelectPrompt).toHaveBeenCalledWith({
99
+ choices: [
100
+ { label: "Start with Remix (recommended)", value: "remix" },
101
+ { label: "Start by adding your first extension", value: "none" }
102
+ ],
103
+ message: "Get started building your app:",
104
+ defaultValue: "remix"
105
+ });
106
+ globalExpect(renderSelectPrompt).toHaveBeenCalledWith({
107
+ choices: [
108
+ { label: "JavaScript", value: "javascript" },
109
+ { label: "TypeScript", value: "main" }
110
+ ],
111
+ message: "For your Remix template, which language do you want?"
112
+ });
113
+ globalExpect(got).toEqual({ ...options, ...answers, templateType: "remix", globalCLIResult });
114
+ });
115
+ });
@@ -1,139 +1,25 @@
1
- import { getDeepInstallNPMTasks, updateCLIDependencies } from '../utils/template/npm.js';
2
- import cleanup from '../utils/template/cleanup.js';
3
- import { findUpAndReadPackageJson, packageManager, packageManagerFromUserAgent, UnknownPackageManagerError, writePackageJSON, } from '@shopify/cli-kit/node/node-package-manager';
4
- import { renderSuccess, renderTasks } from '@shopify/cli-kit/node/ui';
5
- import { parseGitHubRepositoryReference } from '@shopify/cli-kit/node/github';
6
- import { hyphenate } from '@shopify/cli-kit/common/string';
7
- import { recursiveLiquidTemplateCopy } from '@shopify/cli-kit/node/liquid';
8
- import { isShopify } from '@shopify/cli-kit/node/context/local';
9
- import { downloadGitRepository, initializeGitRepository } from '@shopify/cli-kit/node/git';
10
- import { appendFile, fileExists, fileExistsSync, inTemporaryDirectory, mkdir, moveFile, writeFile, } from '@shopify/cli-kit/node/fs';
11
- import { joinPath } from '@shopify/cli-kit/node/path';
12
- import { username } from '@shopify/cli-kit/node/os';
13
- import { AbortError } from '@shopify/cli-kit/node/error';
14
- import { formatPackageManagerCommand } from '@shopify/cli-kit/node/output';
15
- async function init(options) {
16
- const packageManager = inferPackageManager(options.packageManager);
17
- const hyphenizedName = hyphenate(options.name);
18
- const outputDirectory = joinPath(options.directory, hyphenizedName);
19
- const githubRepo = parseGitHubRepositoryReference(options.template);
20
- await ensureAppDirectoryIsAvailable(outputDirectory, hyphenizedName);
21
- await inTemporaryDirectory(async (tmpDir) => {
22
- const templateDownloadDir = joinPath(tmpDir, 'download');
23
- const templatePathDir = githubRepo.filePath
24
- ? joinPath(templateDownloadDir, githubRepo.filePath)
25
- : templateDownloadDir;
26
- const templateScaffoldDir = joinPath(tmpDir, 'app');
27
- const repoUrl = githubRepo.branch ? `${githubRepo.baseURL}#${githubRepo.branch}` : githubRepo.baseURL;
28
- await mkdir(templateDownloadDir);
29
- const tasks = [
30
- {
31
- title: `Downloading template from ${repoUrl}`,
32
- task: async () => {
33
- await downloadGitRepository({
34
- repoUrl,
35
- destination: templateDownloadDir,
36
- shallow: true,
37
- });
38
- },
39
- },
40
- ];
41
- tasks.push({
42
- title: 'Parsing liquid',
43
- task: async () => {
44
- await recursiveLiquidTemplateCopy(templatePathDir, templateScaffoldDir, {
45
- dependency_manager: packageManager,
46
- app_name: options.name,
47
- });
48
- },
49
- }, {
50
- title: 'Updating package.json',
51
- task: async () => {
52
- const packageJSON = (await findUpAndReadPackageJson(templateScaffoldDir)).content;
53
- packageJSON.name = hyphenizedName;
54
- packageJSON.author = (await username()) ?? '';
55
- packageJSON.private = true;
56
- const workspacesFolders = ['extensions/*'].concat(detectAdditionalWorkspacesFolders(templateScaffoldDir));
57
- switch (packageManager) {
58
- case 'npm':
59
- case 'yarn':
60
- case 'bun':
61
- packageJSON.workspaces = workspacesFolders;
62
- break;
63
- case 'pnpm': {
64
- const workspacesContent = workspacesFolders.map((folder) => ` - '${folder}'`).join(`\n`);
65
- await writeFile(joinPath(templateScaffoldDir, 'pnpm-workspace.yaml'), `packages:\n${workspacesContent}`);
66
- // Ensure that the installation of dependencies doesn't fail when using
67
- // pnpm due to missing peerDependencies.
68
- await appendFile(joinPath(templateScaffoldDir, '.npmrc'), `auto-install-peers=true\n`);
69
- break;
70
- }
71
- case 'unknown':
72
- throw new UnknownPackageManagerError();
73
- }
74
- await updateCLIDependencies({ packageJSON, local: options.local, directory: templateScaffoldDir });
75
- await writePackageJSON(templateScaffoldDir, packageJSON);
76
- },
77
- });
78
- if (await isShopify()) {
79
- tasks.push({
80
- title: "[Shopifolks-only] Configuring the project's NPM registry",
81
- task: async () => {
82
- const npmrcPath = joinPath(templateScaffoldDir, '.npmrc');
83
- const npmrcContent = `@shopify:registry=https://registry.npmjs.org\n`;
84
- await appendFile(npmrcPath, npmrcContent);
85
- },
86
- });
87
- }
88
- tasks.push({
89
- title: 'Installing dependencies',
90
- task: async () => {
91
- await getDeepInstallNPMTasks({ from: templateScaffoldDir, packageManager });
92
- },
93
- }, {
94
- title: 'Cleaning up',
95
- task: async () => {
96
- await cleanup(templateScaffoldDir);
97
- },
98
- }, {
99
- title: 'Initializing a Git repository...',
100
- task: async () => {
101
- await initializeGitRepository(templateScaffoldDir);
102
- },
103
- });
104
- await renderTasks(tasks);
105
- await moveFile(templateScaffoldDir, outputDirectory);
106
- });
107
- renderSuccess({
108
- headline: [{ userInput: hyphenizedName }, 'is ready for you to build!'],
109
- nextSteps: [
110
- ['Run', { command: `cd ${hyphenizedName}` }],
111
- ['For extensions, run', { command: formatPackageManagerCommand(packageManager, 'generate extension') }],
112
- ['To see your app, run', { command: formatPackageManagerCommand(packageManager, 'dev') }],
113
- ],
114
- reference: [
115
- { link: { label: 'Shopify docs', url: 'https://shopify.dev' } },
116
- [
117
- 'For an overview of commands, run',
118
- { command: `${formatPackageManagerCommand(packageManager, 'shopify app', '--help')}` },
119
- ],
120
- ],
121
- });
122
- }
123
- function inferPackageManager(optionsPackageManager) {
124
- if (optionsPackageManager && packageManager.includes(optionsPackageManager)) {
125
- return optionsPackageManager;
126
- }
127
- const usedPackageManager = packageManagerFromUserAgent();
128
- return usedPackageManager === 'unknown' ? 'npm' : usedPackageManager;
129
- }
130
- async function ensureAppDirectoryIsAvailable(directory, name) {
131
- const exists = await fileExists(directory);
132
- if (exists)
133
- throw new AbortError(`\nA directory with this name (${name}) already exists.\nChoose a new name for your app.`);
134
- }
135
- function detectAdditionalWorkspacesFolders(directory) {
136
- return ['web', 'web/frontend'].filter((folder) => fileExistsSync(joinPath(directory, folder)));
137
- }
138
- export default init;
139
- //# sourceMappingURL=init.js.map
1
+ import {
2
+ init_default
3
+ } from "../chunk-F6KQQF76.js";
4
+ import "../chunk-WK5TEOA2.js";
5
+ import "../chunk-IL6UMTVA.js";
6
+ import "../chunk-DJYDRQPG.js";
7
+ import "../chunk-SSNXQGVF.js";
8
+ import "../chunk-TMGCRPEZ.js";
9
+ import "../chunk-VJ2TN2CW.js";
10
+ import "../chunk-YJIQMGQH.js";
11
+ import "../chunk-TDBGZYDD.js";
12
+ import "../chunk-FBB6KUZG.js";
13
+ import "../chunk-YLEF4RUH.js";
14
+ import "../chunk-G6FN5VUE.js";
15
+ import "../chunk-UVY6LL5H.js";
16
+ import "../chunk-7XQTD3L4.js";
17
+ import "../chunk-P4TVG45N.js";
18
+ import "../chunk-ZPB26OWQ.js";
19
+ import "../chunk-WCNR75S2.js";
20
+ import "../chunk-3JLUTHGR.js";
21
+ import "../chunk-GXPKATXW.js";
22
+ import "../chunk-M63RTPGR.js";
23
+ export {
24
+ init_default as default
25
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ describe,
3
+ globalExpect,
4
+ test
5
+ } from "../chunk-3JNB3A7C.js";
6
+ import "../chunk-3JLUTHGR.js";
7
+ import "../chunk-GXPKATXW.js";
8
+ import {
9
+ init_cjs_shims
10
+ } from "../chunk-M63RTPGR.js";
11
+
12
+ // src/services/init.test.ts
13
+ init_cjs_shims();
14
+ describe("init", () => {
15
+ test("successfully initializes the app", () => {
16
+ globalExpect(true).toBe(true);
17
+ });
18
+ });
@@ -0,0 +1,25 @@
1
+ import {
2
+ captureOutput,
3
+ exec,
4
+ openURL,
5
+ sleep,
6
+ terminalSupportsRawMode
7
+ } from "./chunk-TDBGZYDD.js";
8
+ import "./chunk-FBB6KUZG.js";
9
+ import "./chunk-YLEF4RUH.js";
10
+ import "./chunk-G6FN5VUE.js";
11
+ import "./chunk-UVY6LL5H.js";
12
+ import "./chunk-7XQTD3L4.js";
13
+ import "./chunk-P4TVG45N.js";
14
+ import "./chunk-ZPB26OWQ.js";
15
+ import "./chunk-WCNR75S2.js";
16
+ import "./chunk-3JLUTHGR.js";
17
+ import "./chunk-GXPKATXW.js";
18
+ import "./chunk-M63RTPGR.js";
19
+ export {
20
+ captureOutput,
21
+ exec,
22
+ openURL,
23
+ sleep,
24
+ terminalSupportsRawMode
25
+ };
@@ -0,0 +1,49 @@
1
+ import {
2
+ handleCtrlC,
3
+ keypress,
4
+ render,
5
+ renderAutocompletePrompt,
6
+ renderConcurrent,
7
+ renderConfirmationPrompt,
8
+ renderDangerousConfirmationPrompt,
9
+ renderError,
10
+ renderFatalError,
11
+ renderInfo,
12
+ renderSelectPrompt,
13
+ renderSuccess,
14
+ renderTable,
15
+ renderTasks,
16
+ renderText,
17
+ renderTextPrompt,
18
+ renderWarning
19
+ } from "./chunk-TDBGZYDD.js";
20
+ import "./chunk-FBB6KUZG.js";
21
+ import "./chunk-YLEF4RUH.js";
22
+ import "./chunk-G6FN5VUE.js";
23
+ import "./chunk-UVY6LL5H.js";
24
+ import "./chunk-7XQTD3L4.js";
25
+ import "./chunk-P4TVG45N.js";
26
+ import "./chunk-ZPB26OWQ.js";
27
+ import "./chunk-WCNR75S2.js";
28
+ import "./chunk-3JLUTHGR.js";
29
+ import "./chunk-GXPKATXW.js";
30
+ import "./chunk-M63RTPGR.js";
31
+ export {
32
+ handleCtrlC,
33
+ keypress,
34
+ render,
35
+ renderAutocompletePrompt,
36
+ renderConcurrent,
37
+ renderConfirmationPrompt,
38
+ renderDangerousConfirmationPrompt,
39
+ renderError,
40
+ renderFatalError,
41
+ renderInfo,
42
+ renderSelectPrompt,
43
+ renderSuccess,
44
+ renderTable,
45
+ renderTasks,
46
+ renderText,
47
+ renderTextPrompt,
48
+ renderWarning
49
+ };
@@ -1,19 +1,18 @@
1
- import { rmdir, glob } from '@shopify/cli-kit/node/fs';
2
- import { joinPath } from '@shopify/cli-kit/node/path';
3
- export default async function cleanup(webOutputDirectory) {
4
- const gitPaths = await glob([
5
- joinPath(webOutputDirectory, '**', '.git'),
6
- joinPath(webOutputDirectory, '**', '.github'),
7
- joinPath(webOutputDirectory, '**', '.gitmodules'),
8
- joinPath(webOutputDirectory, 'LICENSE*'),
9
- joinPath(webOutputDirectory, '**', 'frontend/LICENSE*'),
10
- joinPath(webOutputDirectory, 'package.json.cli2'),
11
- ], {
12
- dot: true,
13
- onlyFiles: false,
14
- onlyDirectories: false,
15
- ignore: ['**/node_modules/**'],
16
- });
17
- return Promise.all(gitPaths.map((path) => rmdir(path, { force: true }))).then(() => { });
18
- }
19
- //# sourceMappingURL=cleanup.js.map
1
+ import {
2
+ cleanup
3
+ } from "../../chunk-WK5TEOA2.js";
4
+ import "../../chunk-TDBGZYDD.js";
5
+ import "../../chunk-FBB6KUZG.js";
6
+ import "../../chunk-YLEF4RUH.js";
7
+ import "../../chunk-G6FN5VUE.js";
8
+ import "../../chunk-UVY6LL5H.js";
9
+ import "../../chunk-7XQTD3L4.js";
10
+ import "../../chunk-P4TVG45N.js";
11
+ import "../../chunk-ZPB26OWQ.js";
12
+ import "../../chunk-WCNR75S2.js";
13
+ import "../../chunk-3JLUTHGR.js";
14
+ import "../../chunk-GXPKATXW.js";
15
+ import "../../chunk-M63RTPGR.js";
16
+ export {
17
+ cleanup as default
18
+ };
@@ -0,0 +1,74 @@
1
+ import {
2
+ cleanup
3
+ } from "../../chunk-WK5TEOA2.js";
4
+ import {
5
+ fileExists,
6
+ inTemporaryDirectory,
7
+ mkdir,
8
+ writeFile
9
+ } from "../../chunk-TDBGZYDD.js";
10
+ import "../../chunk-FBB6KUZG.js";
11
+ import "../../chunk-YLEF4RUH.js";
12
+ import {
13
+ joinPath
14
+ } from "../../chunk-G6FN5VUE.js";
15
+ import "../../chunk-UVY6LL5H.js";
16
+ import "../../chunk-7XQTD3L4.js";
17
+ import "../../chunk-P4TVG45N.js";
18
+ import "../../chunk-ZPB26OWQ.js";
19
+ import "../../chunk-WCNR75S2.js";
20
+ import {
21
+ describe,
22
+ globalExpect,
23
+ test
24
+ } from "../../chunk-3JNB3A7C.js";
25
+ import "../../chunk-3JLUTHGR.js";
26
+ import "../../chunk-GXPKATXW.js";
27
+ import {
28
+ init_cjs_shims
29
+ } from "../../chunk-M63RTPGR.js";
30
+
31
+ // src/utils/template/cleanup.test.ts
32
+ init_cjs_shims();
33
+ describe("cleanup", () => {
34
+ async function mockProjectFolder(tmpDir) {
35
+ await Promise.all([
36
+ // should keep these
37
+ writeFile(joinPath(tmpDir, "server.js"), "console.log()"),
38
+ mkdir(joinPath(tmpDir, "node_modules")),
39
+ // should delete these
40
+ mkdir(joinPath(tmpDir, ".git")),
41
+ mkdir(joinPath(tmpDir, ".github")),
42
+ mkdir(joinPath(tmpDir, ".gitmodules")),
43
+ mkdir(joinPath(tmpDir, "frontend")),
44
+ mkdir(joinPath(tmpDir, "package.json.cli2"))
45
+ ]);
46
+ await Promise.all([
47
+ // should keep these
48
+ writeFile(joinPath(tmpDir, "frontend", "server.js"), "console.log()"),
49
+ // should delete these
50
+ mkdir(joinPath(tmpDir, "frontend", ".git")),
51
+ mkdir(joinPath(tmpDir, "frontend", "node_modules"))
52
+ ]);
53
+ }
54
+ test("cleans up template files in web directory", async () => {
55
+ await inTemporaryDirectory(async (tmpDir) => {
56
+ await mockProjectFolder(tmpDir);
57
+ await cleanup(tmpDir);
58
+ await globalExpect(fileExists(joinPath(tmpDir, ".git"))).resolves.toBe(false);
59
+ await globalExpect(fileExists(joinPath(tmpDir, ".github"))).resolves.toBe(false);
60
+ await globalExpect(fileExists(joinPath(tmpDir, ".gitmodules"))).resolves.toBe(false);
61
+ await globalExpect(fileExists(joinPath(tmpDir, "frontend", ".git"))).resolves.toBe(false);
62
+ await globalExpect(fileExists(joinPath(tmpDir, "package.json.cli2"))).resolves.toBe(false);
63
+ });
64
+ });
65
+ test("keeps non-template files", async () => {
66
+ await inTemporaryDirectory(async (tmpDir) => {
67
+ await mockProjectFolder(tmpDir);
68
+ await cleanup(tmpDir);
69
+ await globalExpect(fileExists(joinPath(tmpDir, "server.js"))).resolves.toBe(true);
70
+ await globalExpect(fileExists(joinPath(tmpDir, "node_modules"))).resolves.toBe(true);
71
+ await globalExpect(fileExists(joinPath(tmpDir, "frontend", "node_modules"))).resolves.toBe(true);
72
+ });
73
+ });
74
+ });