@shopify/create-app 1.0.8 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @shopify/create-app
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9cb99f12]
8
+ - Updated dependencies [882e54e6]
9
+ - @shopify/cli-kit@2.0.1
10
+
11
+ ## 1.1.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [488c06a]
16
+ - Updated dependencies [f156c37]
17
+ - Updated dependencies [5763a76]
18
+ - @shopify/cli-kit@1.1.1
19
+
20
+ ## 1.0.9
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [df1c523]
25
+ - @shopify/cli-kit@1.0.9
26
+
3
27
  ## 1.0.8
4
28
 
5
29
  ### Patch Changes
@@ -1,16 +1,22 @@
1
- import { ui, path, error, git, file, os, constants, string, system, dependency, output, template as template$1 } from '@shopify/cli-kit';
2
- import { fileURLToPath } from 'url';
1
+ import { ui, git, constants, path, dependency, file, string, template, npm, output } from '@shopify/cli-kit';
3
2
  import { Writable } from 'stream';
4
3
  import { Flags, Command } from '@oclif/core';
5
4
 
6
5
  const init$1 = async (options, prompt = ui.prompt) => {
6
+ const templateURLMap = {
7
+ node: "https://github.com/Shopify/starter-node-app"
8
+ };
9
+ const defaults = {
10
+ name: "app",
11
+ template: templateURLMap.node
12
+ };
7
13
  const questions = [];
8
14
  if (!options.name) {
9
15
  questions.push({
10
16
  type: "input",
11
17
  name: "name",
12
18
  message: "Your app's working name?",
13
- default: "app",
19
+ default: defaults.name,
14
20
  validate: (value) => {
15
21
  if (value.length === 0) {
16
22
  return "App Name cannot be empty";
@@ -22,38 +28,27 @@ const init$1 = async (options, prompt = ui.prompt) => {
22
28
  }
23
29
  });
24
30
  }
25
- if (!options.template) {
31
+ if (!options.template && Object.keys(templateURLMap).length > 1) {
26
32
  questions.push({
27
33
  type: "select",
28
34
  name: "template",
29
- choices: ["node", "rails"],
35
+ choices: Object.keys(templateURLMap),
30
36
  message: "Which template would you like to use?",
31
- default: "https://github.com/Shopify/shopify-app-node#cli-next"
37
+ default: defaults.template
32
38
  });
33
39
  }
34
40
  const promptOutput = await prompt(questions);
35
- return { ...options, ...promptOutput, template: "https://github.com/Shopify/shopify-app-node#cli-next" };
41
+ const answers = {
42
+ ...options,
43
+ ...promptOutput
44
+ };
45
+ const templateURL = templateURLMap[answers.template];
46
+ answers.template = templateURL || answers.template || defaults.template;
47
+ return answers;
36
48
  };
37
49
 
38
- async function template(name) {
39
- const templatePath = await path.findUp(`templates/${name}`, {
40
- cwd: path.dirname(fileURLToPath(import.meta.url)),
41
- type: "directory"
42
- });
43
- if (templatePath) {
44
- return templatePath;
45
- } else {
46
- throw new error.Bug(`Couldn't find the template ${name} in @shopify/create-app.`);
47
- }
48
- }
49
-
50
50
  async function downloadTemplate({ templateUrl, into }) {
51
- const components = templateUrl.split("#");
52
- let branch;
53
- const repository = components[0];
54
- if (components.length === 2) {
55
- branch = components[1];
56
- }
51
+ const [repository, branch] = templateUrl.split("#");
57
52
  const options = { "--recurse-submodules": null };
58
53
  if (branch) {
59
54
  options["--branch"] = branch;
@@ -65,177 +60,141 @@ async function downloadTemplate({ templateUrl, into }) {
65
60
  });
66
61
  }
67
62
 
68
- const configurationFileNames = {
69
- home: "shopify.home.toml",
70
- homeTemplate: "shopify.home.template.toml"
71
- };
72
- const blocks = {
73
- home: {
74
- directoryName: "home",
75
- configurationName: configurationFileNames.home
63
+ async function updateCLIDependencies(packageJSON, local) {
64
+ packageJSON.dependencies = packageJSON.dependencies || {};
65
+ packageJSON.dependencies["@shopify/cli"] = constants.versions.cli;
66
+ packageJSON.dependencies["@shopify/app"] = constants.versions.app;
67
+ if (local) {
68
+ const cliPath = `file:${await path.findUp("packages/cli", { type: "directory" })}`;
69
+ const appPath = `file:${await path.findUp("packages/app", { type: "directory" })}`;
70
+ const cliKitPath = `file:${await path.findUp("packages/cli-kit", { type: "directory" })}`;
71
+ packageJSON.dependencies["@shopify/cli"] = cliPath;
72
+ packageJSON.dependencies["@shopify/app"] = appPath;
73
+ const dependencyOverrides = {
74
+ "@shopify/cli": cliPath,
75
+ "@shopify/app": appPath,
76
+ "@shopify/cli-kit": cliKitPath
77
+ };
78
+ packageJSON.overrides = packageJSON.overrides ? { ...packageJSON.overrides, ...dependencyOverrides } : dependencyOverrides;
79
+ packageJSON.resolutions = packageJSON.resolutions ? { ...packageJSON.resolutions, ...dependencyOverrides } : dependencyOverrides;
76
80
  }
77
- };
81
+ return packageJSON;
82
+ }
83
+ async function getDeepInstallNPMTasks({
84
+ from,
85
+ dependencyManager,
86
+ didInstallEverything
87
+ }) {
88
+ const packageJSONFiles = await path.glob([path.join(from, "**/package.json")]);
89
+ let foldersInstalled = 0;
90
+ return packageJSONFiles.map((filePath) => {
91
+ const folderPath = filePath.replace("package.json", "");
92
+ const titlePath = folderPath.replace(from, "");
93
+ return {
94
+ title: `Installing dependencies in ${titlePath}`,
95
+ task: async (_, task) => {
96
+ const output = new Writable({
97
+ write(chunk, _2, next) {
98
+ task.output = chunk.toString();
99
+ next();
100
+ }
101
+ });
102
+ await dependency.install(folderPath, dependencyManager, output, output);
103
+ task.title = `Installed dependencies in ${titlePath}`;
104
+ foldersInstalled++;
105
+ if (foldersInstalled === packageJSONFiles.length) {
106
+ didInstallEverything();
107
+ }
108
+ }
109
+ };
110
+ });
111
+ }
78
112
 
79
113
  async function cleanup(homeOutputDirectory) {
80
114
  const gitPaths = await path.glob([
81
115
  path.join(homeOutputDirectory, "**", ".git"),
82
116
  path.join(homeOutputDirectory, "**", ".github"),
83
- path.join(homeOutputDirectory, "**", ".gitmodules")
117
+ path.join(homeOutputDirectory, "**", ".gitmodules"),
118
+ path.join(homeOutputDirectory, "LICENSE*")
84
119
  ], {
85
120
  dot: true,
86
121
  onlyFiles: false,
87
122
  onlyDirectories: false,
88
123
  ignore: ["**/node_modules/**"]
89
124
  });
90
- const templatePaths = await path.glob([
91
- path.join(homeOutputDirectory, "**", "_template"),
92
- path.join(homeOutputDirectory, "**", configurationFileNames.homeTemplate)
93
- ], {
94
- onlyFiles: false,
95
- onlyDirectories: false,
96
- ignore: ["**/node_modules/**"]
97
- });
98
- const pathsToDelete = [...gitPaths, ...templatePaths];
99
- return Promise.all(pathsToDelete.map((path2) => file.rmdir(path2, { force: true }))).then(() => {
125
+ return Promise.all(gitPaths.map((path2) => file.rmdir(path2, { force: true }))).then(() => {
100
126
  });
101
127
  }
102
128
 
103
129
  async function init(options) {
104
- const user = await os.username() ?? "";
105
- const templatePath = await template("app");
106
- let cliPackageVersion = constants.versions.cli;
107
- let appPackageVersion = constants.versions.app;
108
- const dependencyOverrides = {};
109
- if (options.local) {
110
- cliPackageVersion = `file:${await path.findUp("packages/cli", { type: "directory" })}`;
111
- appPackageVersion = `file:${await path.findUp("packages/app", { type: "directory" })}`;
112
- dependencyOverrides["@shopify/cli"] = cliPackageVersion;
113
- dependencyOverrides["@shopify/app"] = appPackageVersion;
114
- dependencyOverrides["@shopify/cli-kit"] = `file:${await path.findUp("packages/cli-kit", { type: "directory" })}`;
115
- }
116
130
  const dependencyManager = inferDependencyManager(options.dependencyManager);
117
131
  const hyphenizedName = string.hyphenize(options.name);
118
132
  const outputDirectory = path.join(options.directory, hyphenizedName);
119
133
  await file.inTemporaryDirectory(async (tmpDir) => {
120
- const tmpDirApp = path.join(tmpDir, "app");
121
- const tmpDirHome = path.join(tmpDirApp, blocks.home.directoryName);
122
- const tmpDirDownload = path.join(tmpDir, "download");
123
- await file.mkdir(tmpDirHome);
124
- await file.mkdir(tmpDirDownload);
134
+ const templateDownloadDir = path.join(tmpDir, "download");
135
+ const templateScaffoldDir = path.join(tmpDir, "app");
136
+ await file.mkdir(templateDownloadDir);
125
137
  const list = new ui.Listr([
126
138
  {
127
139
  title: "Downloading template",
128
140
  task: async (_, task) => {
129
141
  await downloadTemplate({
130
142
  templateUrl: options.template,
131
- into: tmpDirDownload
143
+ into: templateDownloadDir
132
144
  });
145
+ task.title = "Template downloaded";
133
146
  }
134
147
  },
135
148
  {
136
149
  title: `Initializing your app ${hyphenizedName}`,
137
- task: async (_, task) => {
138
- await scaffoldTemplate({
139
- ...options,
140
- directory: tmpDirApp,
141
- templatePath,
142
- cliPackageVersion,
143
- appPackageVersion,
144
- user,
145
- dependencyManager,
146
- dependencyOverrides
147
- });
148
- task.title = "App initialized";
149
- }
150
- },
151
- {
152
- title: `Creating home`,
153
- task: async (_, task) => {
154
- const hooksPreFilePaths = await path.glob(path.join(tmpDirDownload, "hooks/pre/*"));
155
- const hooksPostFilePaths = await path.glob(path.join(tmpDirDownload, "hooks/post/*"));
156
- return task.newListr([
150
+ task: async (_, parentTask) => {
151
+ return parentTask.newListr([
157
152
  {
158
- title: "Scaffolding home",
159
- task: async () => {
160
- await scaffoldTemplate({
161
- ...options,
162
- prompts: {},
163
- directory: tmpDirHome,
164
- templatePath: tmpDirDownload,
165
- cliPackageVersion,
166
- appPackageVersion,
167
- user,
168
- dependencyManager,
169
- dependencyOverrides
153
+ title: "Parsing liquid",
154
+ task: async (_2, task) => {
155
+ await template.recursiveDirectoryCopy(templateDownloadDir, templateScaffoldDir, {
156
+ dependency_manager: dependencyManager
170
157
  });
158
+ task.title = "Liquid parsed";
171
159
  }
172
160
  },
173
- ...hooksPreFilePaths.map((sourcePath) => {
174
- const hookPath = path.join(tmpDirHome, path.relative(tmpDirDownload, sourcePath)).replace(".liquid", "");
175
- return {
176
- title: path.basename(hookPath),
177
- task: async (_2, task2) => {
178
- const stdout = new Writable({
179
- write(chunk, encoding, next) {
180
- task2.output = chunk.toString();
181
- next();
182
- }
183
- });
184
- const stderr = new Writable({
185
- write(chunk, encoding, next) {
186
- task2.output = chunk.toString();
187
- next();
188
- }
189
- });
190
- await system.exec(hookPath, [], { cwd: tmpDirHome, stdout, stderr });
191
- }
192
- };
193
- }),
194
- ...hooksPostFilePaths.map((sourcePath) => {
195
- const hookPath = path.join(tmpDirHome, path.relative(tmpDirDownload, sourcePath)).replace(".liquid", "");
196
- return {
197
- title: path.basename(hookPath),
198
- task: async (_2, task2) => {
199
- const stdout = new Writable({
200
- write(chunk, encoding, next) {
201
- task2.output = chunk.toString();
202
- next();
203
- }
204
- });
205
- const stderr = new Writable({
206
- write(chunk, encoding, next) {
207
- task2.output = chunk.toString();
208
- next();
209
- }
210
- });
211
- await system.exec(hookPath, [], { cwd: tmpDirHome, stdout, stderr });
212
- }
213
- };
214
- }),
215
161
  {
216
- title: "Cleaning up home",
217
- task: async () => {
218
- await cleanup(tmpDirHome);
162
+ title: "Updating package.json",
163
+ task: async (_2, task) => {
164
+ const packageJSON = await npm.readPackageJSON(templateScaffoldDir);
165
+ await npm.updateAppData(packageJSON, hyphenizedName);
166
+ await updateCLIDependencies(packageJSON, options.local);
167
+ await npm.writePackageJSON(templateScaffoldDir, packageJSON);
168
+ task.title = "Package.json updated";
169
+ parentTask.title = "App initialized";
219
170
  }
220
171
  }
221
172
  ]);
222
173
  }
223
174
  },
224
175
  {
225
- title: `Installing app dependencies with ${dependencyManager}`,
176
+ title: `Installing dependencies with ${dependencyManager}`,
177
+ task: async (_, parentTask) => {
178
+ function didInstallEverything() {
179
+ parentTask.title = `Dependencies installed with ${dependencyManager}`;
180
+ }
181
+ return parentTask.newListr(await getDeepInstallNPMTasks({
182
+ from: templateScaffoldDir,
183
+ dependencyManager,
184
+ didInstallEverything
185
+ }), { concurrent: false });
186
+ }
187
+ },
188
+ {
189
+ title: "Cleaning up",
226
190
  task: async (_, task) => {
227
- const output2 = new Writable({
228
- write(chunk, encoding, next) {
229
- task.output = chunk.toString();
230
- next();
231
- }
232
- });
233
- await dependency.install(tmpDirApp, dependencyManager, output2, output2);
191
+ await cleanup(templateScaffoldDir);
192
+ task.title = "Completed clean up";
234
193
  }
235
194
  }
236
195
  ], { concurrent: false });
237
196
  await list.run();
238
- await file.move(tmpDirApp, outputDirectory);
197
+ await file.move(templateScaffoldDir, outputDirectory);
239
198
  });
240
199
  output.info(output.content`
241
200
  ${hyphenizedName} is ready to build! ✨
@@ -249,18 +208,6 @@ function inferDependencyManager(optionsDependencyManager) {
249
208
  }
250
209
  return dependency.dependencyManagerUsedForCreating();
251
210
  }
252
- async function scaffoldTemplate(options) {
253
- const templateData = {
254
- name: options.name,
255
- shopify_cli_version: options.cliPackageVersion,
256
- shopify_app_version: options.appPackageVersion,
257
- dependency_overrides: options.dependencyOverrides,
258
- author: options.user,
259
- dependency_manager: options.dependencyManager,
260
- ...options.prompts
261
- };
262
- await template$1.recursiveDirectoryCopy(options.templatePath, options.directory, templateData);
263
- }
264
211
 
265
212
  const _Init = class extends Command {
266
213
  async run() {
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sources":["../../src/prompts/init.ts","../../src/utils/paths.ts","../../src/utils/home-template/download.ts","../../src/constants.ts","../../src/utils/home-template/cleanup.ts","../../src/services/init.ts","../../src/commands/init.ts"],"sourcesContent":["import {ui} from '@shopify/cli-kit'\n\ninterface InitOptions {\n name?: string\n template?: string\n}\n\ninterface InitOutput {\n name: string\n template: string\n}\n\nconst init = async (options: InitOptions, prompt = ui.prompt): Promise<InitOutput> => {\n const questions: ui.Question[] = []\n if (!options.name) {\n questions.push({\n type: 'input',\n name: 'name',\n message: \"Your app's working name?\",\n default: 'app',\n validate: (value) => {\n if (value.length === 0) {\n return 'App Name cannot be empty'\n }\n if (value.length > 30) {\n return 'App name is too long (maximum is 30 characters)'\n }\n return true\n },\n })\n }\n if (!options.template) {\n questions.push({\n type: 'select',\n name: 'template',\n choices: ['node', 'rails'],\n message: 'Which template would you like to use?',\n default: 'https://github.com/Shopify/shopify-app-node#cli-next',\n })\n }\n const promptOutput: InitOutput = await prompt(questions)\n return {...options, ...promptOutput, template: 'https://github.com/Shopify/shopify-app-node#cli-next'}\n}\n\nexport default init\n","import {path, error} from '@shopify/cli-kit'\nimport {fileURLToPath} from 'url'\n\nexport async function template(name: string): Promise<string> {\n const templatePath = await path.findUp(`templates/${name}`, {\n cwd: path.dirname(fileURLToPath(import.meta.url)),\n type: 'directory',\n })\n if (templatePath) {\n return templatePath\n } else {\n throw new error.Bug(`Couldn't find the template ${name} in @shopify/create-app.`)\n }\n}\n","import {git} from '@shopify/cli-kit'\n\nexport default async function downloadTemplate({templateUrl, into}: {templateUrl: string; into: string}) {\n const components = templateUrl.split('#')\n let branch: string | undefined\n const repository = components[0]\n if (components.length === 2) {\n branch = components[1]\n }\n const options: any = {'--recurse-submodules': null}\n if (branch) {\n options['--branch'] = branch\n }\n\n await git.factory().clone(repository, into, options, (err) => {\n if (err) {\n throw new Error(err.message)\n }\n })\n}\n","export const configurationFileNames = {\n home: 'shopify.home.toml',\n homeTemplate: 'shopify.home.template.toml',\n}\n\nexport const blocks = {\n home: {\n directoryName: 'home',\n configurationName: configurationFileNames.home,\n },\n}\n","import {configurationFileNames} from '../../constants'\nimport {file, path} from '@shopify/cli-kit'\n\nexport default async function cleanup(homeOutputDirectory: string) {\n const gitPaths = await path.glob(\n [\n path.join(homeOutputDirectory, '**', '.git'),\n path.join(homeOutputDirectory, '**', '.github'),\n path.join(homeOutputDirectory, '**', '.gitmodules'),\n ],\n {\n dot: true,\n onlyFiles: false,\n onlyDirectories: false,\n ignore: ['**/node_modules/**'],\n },\n )\n\n const templatePaths = await path.glob(\n [\n path.join(homeOutputDirectory, '**', '_template'),\n path.join(homeOutputDirectory, '**', configurationFileNames.homeTemplate),\n ],\n {\n onlyFiles: false,\n onlyDirectories: false,\n ignore: ['**/node_modules/**'],\n },\n )\n\n const pathsToDelete = [...gitPaths, ...templatePaths]\n\n return Promise.all(pathsToDelete.map((path) => file.rmdir(path, {force: true}))).then(() => {})\n}\n","import {template as getTemplatePath} from '../utils/paths'\nimport downloadTemplate from '../utils/home-template/download'\nimport cleanupHome from '../utils/home-template/cleanup'\nimport {blocks} from '../constants'\nimport {string, path, template, file, output, os, ui, dependency, constants, system} from '@shopify/cli-kit'\nimport {Writable} from 'stream'\n\ninterface InitOptions {\n name: string\n directory: string\n template: string\n dependencyManager: string | undefined\n local: boolean\n}\n\nasync function init(options: InitOptions) {\n const user = (await os.username()) ?? ''\n const templatePath = await getTemplatePath('app')\n\n let cliPackageVersion = constants.versions.cli\n let appPackageVersion = constants.versions.app\n const dependencyOverrides: {[key: string]: string} = {}\n\n if (options.local) {\n cliPackageVersion = `file:${(await path.findUp('packages/cli', {type: 'directory'})) as string}`\n appPackageVersion = `file:${(await path.findUp('packages/app', {type: 'directory'})) as string}`\n\n dependencyOverrides['@shopify/cli'] = cliPackageVersion\n dependencyOverrides['@shopify/app'] = appPackageVersion\n dependencyOverrides['@shopify/cli-kit'] = `file:${\n (await path.findUp('packages/cli-kit', {type: 'directory'})) as string\n }`\n }\n\n const dependencyManager = inferDependencyManager(options.dependencyManager)\n const hyphenizedName = string.hyphenize(options.name)\n const outputDirectory = path.join(options.directory, hyphenizedName)\n\n await file.inTemporaryDirectory(async (tmpDir) => {\n const tmpDirApp = path.join(tmpDir, 'app')\n const tmpDirHome = path.join(tmpDirApp, blocks.home.directoryName)\n const tmpDirDownload = path.join(tmpDir, 'download')\n\n await file.mkdir(tmpDirHome)\n await file.mkdir(tmpDirDownload)\n\n const list = new ui.Listr(\n [\n {\n title: 'Downloading template',\n task: async (_, task) => {\n await downloadTemplate({\n templateUrl: options.template,\n into: tmpDirDownload,\n })\n },\n },\n {\n title: `Initializing your app ${hyphenizedName}`,\n task: async (_, task) => {\n await scaffoldTemplate({\n ...options,\n directory: tmpDirApp,\n templatePath,\n cliPackageVersion,\n appPackageVersion,\n user,\n dependencyManager,\n dependencyOverrides,\n })\n task.title = 'App initialized'\n },\n },\n {\n title: `Creating home`,\n task: async (_, task) => {\n const hooksPreFilePaths = await path.glob(path.join(tmpDirDownload, 'hooks/pre/*'))\n const hooksPostFilePaths = await path.glob(path.join(tmpDirDownload, 'hooks/post/*'))\n\n return task.newListr([\n {\n title: 'Scaffolding home',\n task: async () => {\n await scaffoldTemplate({\n ...options,\n prompts: {},\n directory: tmpDirHome,\n templatePath: tmpDirDownload,\n cliPackageVersion,\n appPackageVersion,\n user,\n dependencyManager,\n dependencyOverrides,\n })\n },\n },\n ...hooksPreFilePaths.map((sourcePath) => {\n const hookPath = path.join(tmpDirHome, path.relative(tmpDirDownload, sourcePath)).replace('.liquid', '')\n return {\n title: path.basename(hookPath),\n task: async (_: any, task: any) => {\n const stdout = new Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n })\n const stderr = new Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n })\n await system.exec(hookPath, [], {cwd: tmpDirHome, stdout, stderr})\n },\n }\n }),\n ...hooksPostFilePaths.map((sourcePath) => {\n const hookPath = path.join(tmpDirHome, path.relative(tmpDirDownload, sourcePath)).replace('.liquid', '')\n return {\n title: path.basename(hookPath),\n task: async (_: any, task: any) => {\n const stdout = new Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n })\n const stderr = new Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n })\n await system.exec(hookPath, [], {cwd: tmpDirHome, stdout, stderr})\n },\n }\n }),\n {\n title: 'Cleaning up home',\n task: async () => {\n await cleanupHome(tmpDirHome)\n },\n },\n ])\n },\n },\n {\n title: `Installing app dependencies with ${dependencyManager}`,\n task: async (_, task) => {\n const output = new Writable({\n write(chunk, encoding, next) {\n task.output = chunk.toString()\n next()\n },\n })\n await dependency.install(tmpDirApp, dependencyManager, output, output)\n },\n },\n ],\n {concurrent: false},\n )\n await list.run()\n\n await file.move(tmpDirApp, outputDirectory)\n })\n\n output.info(output.content`\n ${hyphenizedName} is ready to build! ✨\n Docs: ${output.token.link('Quick start guide', 'https://shopify.dev/apps/getting-started')}\n Inspiration ${output.token.command(`${dependencyManager} shopify help`)}\n `)\n}\n\nfunction inferDependencyManager(optionsDependencyManager: string | undefined): dependency.DependencyManager {\n if (optionsDependencyManager && dependency.dependencyManager.includes(optionsDependencyManager)) {\n return optionsDependencyManager as dependency.DependencyManager\n }\n return dependency.dependencyManagerUsedForCreating()\n}\n\nasync function scaffoldTemplate(\n options: InitOptions & {\n directory: string\n prompts?: {[key: string]: string | number | boolean}\n templatePath: string\n cliPackageVersion: string\n appPackageVersion: string\n dependencyOverrides: {[key: string]: string}\n user: string\n dependencyManager: string\n },\n): Promise<void> {\n const templateData = {\n name: options.name,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n shopify_cli_version: options.cliPackageVersion,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n shopify_app_version: options.appPackageVersion,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dependency_overrides: options.dependencyOverrides,\n author: options.user,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dependency_manager: options.dependencyManager,\n ...options.prompts,\n }\n await template.recursiveDirectoryCopy(options.templatePath, options.directory, templateData)\n}\n\nexport default init\n","import initPrompt from '../prompts/init'\nimport initService from '../services/init'\nimport {Command, Flags} from '@oclif/core'\nimport {path} from '@shopify/cli-kit'\n\nexport default class Init extends Command {\n static flags = {\n name: Flags.string({\n char: 'n',\n env: 'SHOPIFY_FLAG_NAME',\n hidden: false,\n }),\n path: Flags.string({\n char: 'p',\n env: 'SHOPIFY_FLAG_PATH',\n parse: (input, _) => Promise.resolve(path.resolve(input)),\n hidden: false,\n }),\n template: Flags.string({\n description: 'The template for app home. Eg, --template https://github.com/Shopify/shopify-app-node',\n env: 'SHOPIFY_FLAG_TEMPLATE',\n }),\n 'dependency-manager': Flags.string({\n char: 'd',\n env: 'SHOPIFY_FLAG_DEPENDENCY_MANAGER',\n hidden: false,\n options: ['npm', 'yarn', 'pnpm'],\n }),\n local: Flags.boolean({\n char: 'l',\n env: 'SHOPIFY_FLAG_LOCAL',\n default: false,\n hidden: true,\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Init)\n const directory = flags.path ? path.resolve(flags.path) : process.cwd()\n const promptAnswers = await initPrompt({\n name: flags.name,\n template: flags.template,\n })\n await initService({\n name: promptAnswers.name,\n dependencyManager: flags['dependency-manager'],\n template: promptAnswers.template,\n local: flags.local,\n directory,\n })\n }\n}\n"],"names":["init","getTemplatePath","cleanupHome","template","initPrompt","initService"],"mappings":";;;;;AAYA,MAAMA,MAAO,GAAA,OAAO,OAAsB,EAAA,MAAA,GAAS,GAAG,MAAgC,KAAA;AACpF,EAAA,MAAM,YAA2B,EAAC,CAAA;AAClC,EAAI,IAAA,CAAC,QAAQ,IAAM,EAAA;AACjB,IAAA,SAAA,CAAU,IAAK,CAAA;AAAA,MACb,IAAM,EAAA,OAAA;AAAA,MACN,IAAM,EAAA,MAAA;AAAA,MACN,OAAS,EAAA,0BAAA;AAAA,MACT,OAAS,EAAA,KAAA;AAAA,MACT,QAAA,EAAU,CAAC,KAAU,KAAA;AACnB,QAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACtB,UAAO,OAAA,0BAAA,CAAA;AAAA,SACT;AACA,QAAI,IAAA,KAAA,CAAM,SAAS,EAAI,EAAA;AACrB,UAAO,OAAA,iDAAA,CAAA;AAAA,SACT;AACA,QAAO,OAAA,IAAA,CAAA;AAAA,OACT;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACA,EAAI,IAAA,CAAC,QAAQ,QAAU,EAAA;AACrB,IAAA,SAAA,CAAU,IAAK,CAAA;AAAA,MACb,IAAM,EAAA,QAAA;AAAA,MACN,IAAM,EAAA,UAAA;AAAA,MACN,OAAA,EAAS,CAAC,MAAA,EAAQ,OAAO,CAAA;AAAA,MACzB,OAAS,EAAA,uCAAA;AAAA,MACT,OAAS,EAAA,sDAAA;AAAA,KACV,CAAA,CAAA;AAAA,GACH;AACA,EAAM,MAAA,YAAA,GAA2B,MAAM,MAAA,CAAO,SAAS,CAAA,CAAA;AACvD,EAAA,OAAO,EAAI,GAAA,OAAA,EAAA,GAAY,YAAc,EAAA,QAAA,EAAU,sDAAsD,EAAA,CAAA;AACvG,CAAA;;ACvCA,eA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AAQ,MAAM,CAAA;AAAA,GAChC,CAAA;AAAA,EACD,KAAA,EAAO,MAAM,OAAQ,CAAA;AAAA,IACnB,IAAM,EAAA,GAAA;AAAA,IACN,GAAK,EAAA,oBAAA;AAAA,IACL,OAAS,EAAA,KAAA;AAAA,IACT,MAAQ,EAAA,IAAA;AAAA,GACT,CAAA;AACH,CAAA;;;;"}
1
+ {"version":3,"file":"init.js","sources":["../../src/prompts/init.ts","../../src/utils/template/download.ts","../../src/utils/template/npm.ts","../../src/utils/template/cleanup.ts","../../src/services/init.ts","../../src/commands/init.ts"],"sourcesContent":["import {ui} from '@shopify/cli-kit'\n\ninterface InitOptions {\n name?: string\n template?: string\n}\n\ninterface InitOutput {\n name: string\n template: string\n}\n\nconst init = async (options: InitOptions, prompt = ui.prompt): Promise<InitOutput> => {\n // Eventually this list should be taken from a remote location\n // That way we don't have to update the CLI every time we add a template\n const templateURLMap = {\n node: 'https://github.com/Shopify/starter-node-app',\n }\n\n const defaults = {\n name: 'app',\n template: templateURLMap.node,\n }\n\n const questions: ui.Question[] = []\n if (!options.name) {\n questions.push({\n type: 'input',\n name: 'name',\n message: \"Your app's working name?\",\n default: defaults.name,\n validate: (value) => {\n if (value.length === 0) {\n return 'App Name cannot be empty'\n }\n if (value.length > 30) {\n return 'App name is too long (maximum is 30 characters)'\n }\n return true\n },\n })\n }\n\n if (!options.template && Object.keys(templateURLMap).length > 1) {\n questions.push({\n type: 'select',\n name: 'template',\n choices: Object.keys(templateURLMap),\n message: 'Which template would you like to use?',\n default: defaults.template,\n })\n }\n\n const promptOutput: InitOutput = await prompt(questions)\n const answers = {\n ...options,\n ...promptOutput,\n }\n\n const templateURL = templateURLMap[answers.template as keyof typeof templateURLMap]\n answers.template = templateURL || answers.template || defaults.template\n\n return answers\n}\n\nexport default init\n","import {git} from '@shopify/cli-kit'\n\nexport default async function downloadTemplate({templateUrl, into}: {templateUrl: string; into: string}) {\n const [repository, branch] = templateUrl.split('#')\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const options: any = {'--recurse-submodules': null}\n if (branch) {\n options['--branch'] = branch\n }\n\n await git.factory().clone(repository, into, options, (err) => {\n if (err) {\n throw new Error(err.message)\n }\n })\n}\n","import {constants, path, dependency, ui, npm} from '@shopify/cli-kit'\nimport {Writable} from 'stream'\n\nexport async function updateCLIDependencies(packageJSON: npm.PackageJSON, local: boolean): Promise<npm.PackageJSON> {\n packageJSON.dependencies = packageJSON.dependencies || {}\n packageJSON.dependencies['@shopify/cli'] = constants.versions.cli\n packageJSON.dependencies['@shopify/app'] = constants.versions.app\n\n if (local) {\n const cliPath = `file:${(await path.findUp('packages/cli', {type: 'directory'})) as string}`\n const appPath = `file:${(await path.findUp('packages/app', {type: 'directory'})) as string}`\n const cliKitPath = `file:${(await path.findUp('packages/cli-kit', {type: 'directory'})) as string}`\n\n // eslint-disable-next-line require-atomic-updates\n packageJSON.dependencies['@shopify/cli'] = cliPath\n // eslint-disable-next-line require-atomic-updates\n packageJSON.dependencies['@shopify/app'] = appPath\n\n const dependencyOverrides = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '@shopify/cli': cliPath,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '@shopify/app': appPath,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '@shopify/cli-kit': cliKitPath,\n }\n\n packageJSON.overrides = packageJSON.overrides\n ? {...packageJSON.overrides, ...dependencyOverrides}\n : dependencyOverrides\n\n packageJSON.resolutions = packageJSON.resolutions\n ? {...packageJSON.resolutions, ...dependencyOverrides}\n : dependencyOverrides\n }\n\n return packageJSON\n}\n\nexport async function getDeepInstallNPMTasks({\n from,\n dependencyManager,\n didInstallEverything,\n}: {\n from: string\n dependencyManager: dependency.DependencyManager\n didInstallEverything(): void\n}): Promise<ui.ListrTask[]> {\n const packageJSONFiles = await path.glob([path.join(from, '**/package.json')])\n let foldersInstalled = 0\n\n return packageJSONFiles.map((filePath) => {\n const folderPath = filePath.replace('package.json', '')\n const titlePath = folderPath.replace(from, '')\n\n return {\n title: `Installing dependencies in ${titlePath}`,\n task: async (_, task) => {\n const output = new Writable({\n write(chunk, _, next) {\n task.output = chunk.toString()\n next()\n },\n })\n\n await dependency.install(folderPath, dependencyManager, output, output)\n\n task.title = `Installed dependencies in ${titlePath}`\n\n foldersInstalled++\n\n if (foldersInstalled === packageJSONFiles.length) {\n didInstallEverything()\n }\n },\n }\n })\n}\n","import {file, path} from '@shopify/cli-kit'\n\nexport default async function cleanup(homeOutputDirectory: string) {\n const gitPaths = await path.glob(\n [\n path.join(homeOutputDirectory, '**', '.git'),\n path.join(homeOutputDirectory, '**', '.github'),\n path.join(homeOutputDirectory, '**', '.gitmodules'),\n path.join(homeOutputDirectory, 'LICENSE*'),\n ],\n {\n dot: true,\n onlyFiles: false,\n onlyDirectories: false,\n ignore: ['**/node_modules/**'],\n },\n )\n\n return Promise.all(gitPaths.map((path) => file.rmdir(path, {force: true}))).then(() => {})\n}\n","import downloadTemplate from '../utils/template/download'\nimport {getDeepInstallNPMTasks, updateCLIDependencies} from '../utils/template/npm'\nimport cleanup from '../utils/template/cleanup'\n\nimport {string, path, file, output, ui, dependency, template, npm} from '@shopify/cli-kit'\n\ninterface InitOptions {\n name: string\n directory: string\n template: string\n dependencyManager: string | undefined\n local: boolean\n}\n\nasync function init(options: InitOptions) {\n const dependencyManager = inferDependencyManager(options.dependencyManager)\n const hyphenizedName = string.hyphenize(options.name)\n const outputDirectory = path.join(options.directory, hyphenizedName)\n\n await file.inTemporaryDirectory(async (tmpDir) => {\n const templateDownloadDir = path.join(tmpDir, 'download')\n const templateScaffoldDir = path.join(tmpDir, 'app')\n\n await file.mkdir(templateDownloadDir)\n\n const list = new ui.Listr(\n [\n {\n title: 'Downloading template',\n task: async (_, task) => {\n await downloadTemplate({\n templateUrl: options.template,\n into: templateDownloadDir,\n })\n task.title = 'Template downloaded'\n },\n },\n {\n title: `Initializing your app ${hyphenizedName}`,\n task: async (_, parentTask) => {\n return parentTask.newListr([\n {\n title: 'Parsing liquid',\n task: async (_, task) => {\n await template.recursiveDirectoryCopy(templateDownloadDir, templateScaffoldDir, {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dependency_manager: dependencyManager,\n })\n\n task.title = 'Liquid parsed'\n },\n },\n {\n title: 'Updating package.json',\n task: async (_, task) => {\n const packageJSON = await npm.readPackageJSON(templateScaffoldDir)\n\n await npm.updateAppData(packageJSON, hyphenizedName)\n await updateCLIDependencies(packageJSON, options.local)\n\n await npm.writePackageJSON(templateScaffoldDir, packageJSON)\n\n task.title = 'Package.json updated'\n parentTask.title = 'App initialized'\n },\n },\n ])\n },\n },\n {\n title: `Installing dependencies with ${dependencyManager}`,\n task: async (_, parentTask) => {\n function didInstallEverything() {\n parentTask.title = `Dependencies installed with ${dependencyManager}`\n }\n\n return parentTask.newListr(\n await getDeepInstallNPMTasks({\n from: templateScaffoldDir,\n dependencyManager,\n didInstallEverything,\n }),\n {concurrent: false},\n )\n },\n },\n {\n title: 'Cleaning up',\n task: async (_, task) => {\n await cleanup(templateScaffoldDir)\n\n task.title = 'Completed clean up'\n },\n },\n ],\n {concurrent: false},\n )\n await list.run()\n\n await file.move(templateScaffoldDir, outputDirectory)\n })\n\n output.info(output.content`\n ${hyphenizedName} is ready to build! ✨\n Docs: ${output.token.link('Quick start guide', 'https://shopify.dev/apps/getting-started')}\n Inspiration ${output.token.command(`${dependencyManager} shopify help`)}\n `)\n}\n\nfunction inferDependencyManager(optionsDependencyManager: string | undefined): dependency.DependencyManager {\n if (optionsDependencyManager && dependency.dependencyManager.includes(optionsDependencyManager)) {\n return optionsDependencyManager as dependency.DependencyManager\n }\n return dependency.dependencyManagerUsedForCreating()\n}\n\nexport default init\n","import initPrompt from '../prompts/init'\nimport initService from '../services/init'\nimport {Command, Flags} from '@oclif/core'\nimport {path} from '@shopify/cli-kit'\n\nexport default class Init extends Command {\n static flags = {\n name: Flags.string({\n char: 'n',\n env: 'SHOPIFY_FLAG_NAME',\n hidden: false,\n }),\n path: Flags.string({\n char: 'p',\n env: 'SHOPIFY_FLAG_PATH',\n parse: (input, _) => Promise.resolve(path.resolve(input)),\n hidden: false,\n }),\n template: Flags.string({\n description: 'The template for app home. Eg, --template https://github.com/Shopify/shopify-app-node',\n env: 'SHOPIFY_FLAG_TEMPLATE',\n }),\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'dependency-manager': Flags.string({\n char: 'd',\n env: 'SHOPIFY_FLAG_DEPENDENCY_MANAGER',\n hidden: false,\n options: ['npm', 'yarn', 'pnpm'],\n }),\n local: Flags.boolean({\n char: 'l',\n env: 'SHOPIFY_FLAG_LOCAL',\n default: false,\n hidden: true,\n }),\n }\n\n async run(): Promise<void> {\n const {flags} = await this.parse(Init)\n const directory = flags.path ? path.resolve(flags.path) : process.cwd()\n const promptAnswers = await initPrompt({\n name: flags.name,\n template: flags.template,\n })\n await initService({\n name: promptAnswers.name,\n dependencyManager: flags['dependency-manager'],\n template: promptAnswers.template,\n local: flags.local,\n directory,\n })\n }\n}\n"],"names":["init","initPrompt","initService"],"mappings":";;;;AAYA,MAAMA,MAAO,GAAA,OAAO,OAAsB,EAAA,MAAA,GAAS,GAAG,MAAgC,KAAA;AAGpF,EAAA,MAAM,cAAiB,GAAA;AAAA,IACrB,IAAM,EAAA,6CAAA;AAAA,GACR,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA;AAAA,IACf,IAAM,EAAA,KAAA;AAAA,IACN,UAAU,cAAe,CAAA,IAAA;AAAA,GAC3B,CAAA;AAEA,EAAA,MAAM,YAA2B,EAAC,CAAA;AAClC,EAAI,IAAA,CAAC,QAAQ,IAAM,EAAA;AACjB,IAAA,SAAA,CAAU,IAAK,CAAA;AAAA,MACb,IAAM,EAAA,OAAA;AAAA,MACN,IAAM,EAAA,MAAA;AAAA,MACN,OAAS,EAAA,0BAAA;AAAA,MACT,SAAS,QAAS,CAAA,IAAA;AAAA,MAClB,QAAA,EAAU,CAAC,KAAU,KAAA;AACnB,QAAI,IAAA,KAAA,CAAM,WAA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,CAAA;AACH,CAAA;;;;"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {run, flush, settings} from '@oclif/core'\nimport {error as kitError, environment} from '@shopify/cli-kit'\n\nfunction runCreateApp() {\n const initIndex = process.argv.findIndex((arg) => arg.includes('init'))\n if (initIndex === -1) {\n const initIndex =\n process.argv.findIndex(\n (arg) => arg.includes('bin/create-app') || arg.includes('bin/dev') || arg.includes('bin/run'),\n ) + 1\n process.argv.splice(initIndex, 0, 'init')\n }\n\n if (environment.local.isDebug()) {\n settings.debug = true\n }\n\n // Start the CLI\n run(undefined, import.meta.url)\n .then(flush)\n .catch((error: Error): Promise<void | Error> => {\n const kitMapper = kitError.mapper\n const kitHandle = kitError.handler\n // eslint-disable-next-line promise/no-nesting\n return kitMapper(error).then((error: Error) => {\n kitHandle(error)\n })\n })\n}\n\nexport default runCreateApp\n"],"names":["error","kitError"],"mappings":";;;AAEA,SAAS,YAAY,GAAG;AACxB,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1E,EAAE,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE;AACxB,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;AACjJ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/C,GAAG;AACH,EAAE,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE;AACnC,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC;AAC1B,GAAG;AACH,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAACA,OAAK,KAAK;AAC5D,IAAI,MAAM,SAAS,GAAGC,KAAQ,CAAC,MAAM,CAAC;AACtC,IAAI,MAAM,SAAS,GAAGA,KAAQ,CAAC,OAAO,CAAC;AACvC,IAAI,OAAO,SAAS,CAACD,OAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK;AAC7C,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;AACxB,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC;AACL;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {run, flush, settings} from '@oclif/core'\nimport {error as kitError, environment} from '@shopify/cli-kit'\n\nfunction runCreateApp() {\n const initIndex = process.argv.findIndex((arg) => arg.includes('init'))\n if (initIndex === -1) {\n const initIndex =\n process.argv.findIndex(\n (arg) => arg.includes('bin/create-app') || arg.includes('bin/dev') || arg.includes('bin/run'),\n ) + 1\n process.argv.splice(initIndex, 0, 'init')\n }\n\n if (environment.local.isDebug()) {\n settings.debug = true\n }\n\n // Start the CLI\n run(undefined, import.meta.url)\n .then(flush)\n .catch((error: Error): Promise<void | Error> => {\n const kitMapper = kitError.mapper\n const kitHandle = kitError.handler\n // eslint-disable-next-line promise/no-nesting\n return kitMapper(error).then((error: Error) => {\n kitHandle(error)\n })\n })\n}\n\nexport default runCreateApp\n"],"names":["error","kitError"],"mappings":";;;AAGA,SAAwB,YAAA,GAAA;AACtB,EAAM,MAAA,SAAA,GAAY,QAAQ,IAAK,CAAA,SAAA,CAAU,CAAC,GAAQ,KAAA,GAAA,CAAI,QAAS,CAAA,MAAM,CAAC,CAAA,CAAA;AACtE,EAAA,IAAI,cAAc,CAAI,CAAA,EAAA;AACpB,IAAA,MAAM,aACJ,OAAQ,CAAA,IAAA,CAAK,UACX,CAAC,GAAA,KAAQ,IAAI,QAAS,CAAA,gBAAgB,CAAK,IAAA,GAAA,CAAI,SAAS,SAAS,CAAA,IAAK,IAAI,QAAS,CAAA,SAAS,CAC9F,CAAI,GAAA,CAAA,CAAA;AACN,IAAA,OAAA,CAAQ,IAAK,CAAA,MAAA,CAAO,UAAW,EAAA,CAAA,EAAG,MAAM,CAAA,CAAA;AAAA,GAC1C;AAEA,EAAI,IAAA,WAAA,CAAY,KAAM,CAAA,OAAA,EAAW,EAAA;AAC/B,IAAA,QAAA,CAAS,KAAQ,GAAA,IAAA,CAAA;AAAA,GACnB;AAGA,EAAI,GAAA,CAAA,KAAA,CAAA,EAAW,YAAY,GAAG,CAAA,CAC3B,KAAK,KAAK,CAAA,CACV,KAAM,CAAA,CAACA,OAAwC,KAAA;AAC9C,IAAA,MAAM,YAAYC,KAAS,CAAA,MAAA,CAAA;AAC3B,IAAA,MAAM,YAAYA,KAAS,CAAA,OAAA,CAAA;AAE3B,IAAA,OAAO,SAAU,CAAAD,OAAK,CAAE,CAAA,IAAA,CAAK,CAAC,MAAiB,KAAA;AAC7C,MAAA,SAAA,CAAU,MAAK,CAAA,CAAA;AAAA,KAChB,CAAA,CAAA;AAAA,GACF,CAAA,CAAA;AACL;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/create-app",
3
- "version": "1.0.8",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "A CLI tool to create a new Shopify app.",
6
6
  "type": "module",
@@ -24,7 +24,6 @@
24
24
  "/bin/run.js",
25
25
  "/bin/run.cmd",
26
26
  "/dist",
27
- "templates",
28
27
  "/oclif.manifest.json"
29
28
  ],
30
29
  "publishConfig": {
@@ -49,14 +48,14 @@
49
48
  "dependencies": {
50
49
  "@bugsnag/js": "^7.16.2",
51
50
  "@oclif/core": "1.6.4",
52
- "@shopify/cli-kit": "1.0.8"
51
+ "@shopify/cli-kit": "2.0.1"
53
52
  },
54
53
  "devDependencies": {
55
- "vitest": "0.8.1"
54
+ "vitest": "0.9.4"
56
55
  },
57
56
  "engine-strict": true,
58
57
  "engines": {
59
- "node": "^14.13.1 || ^16.0.0 || ^17.0.0"
58
+ "node": "^14.13.1 || ^16.0.0 || ^17.0.0 || ^18.0.0"
60
59
  },
61
60
  "os": [
62
61
  "darwin",
@@ -65,6 +64,9 @@
65
64
  ],
66
65
  "oclif": {
67
66
  "bin": "create-app",
68
- "commands": "./dist/commands"
67
+ "commands": "./dist/commands",
68
+ "additionalHelpFlags": [
69
+ "-h"
70
+ ]
69
71
  }
70
72
  }
@@ -1,184 +0,0 @@
1
- ### macOS ###
2
- # General
3
- .DS_Store
4
- .AppleDouble
5
- .LSOverride
6
-
7
- # Icon must end with two \r
8
- Icon
9
-
10
-
11
- # Thumbnails
12
- ._*
13
-
14
- # Files that might appear in the root of a volume
15
- .DocumentRevisions-V100
16
- .fseventsd
17
- .Spotlight-V100
18
- .TemporaryItems
19
- .Trashes
20
- .VolumeIcon.icns
21
- .com.apple.timemachine.donotpresent
22
-
23
- # Directories potentially created on remote AFP share
24
- .AppleDB
25
- .AppleDesktop
26
- Network Trash Folder
27
- Temporary Items
28
- .apdisk
29
-
30
- ### Node ###
31
- # Logs
32
- logs
33
- *.log
34
- npm-debug.log*
35
- yarn-debug.log*
36
- yarn-error.log*
37
- lerna-debug.log*
38
- .pnpm-debug.log*
39
-
40
- # Diagnostic reports (https://nodejs.org/api/report.html)
41
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
42
-
43
- # Runtime data
44
- pids
45
- *.pid
46
- *.seed
47
- *.pid.lock
48
-
49
- # Directory for instrumented libs generated by jscoverage/JSCover
50
- lib-cov
51
-
52
- # Coverage directory used by tools like istanbul
53
- coverage
54
- *.lcov
55
-
56
- # nyc test coverage
57
- .nyc_output
58
-
59
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
60
- .grunt
61
-
62
- # Bower dependency directory (https://bower.io/)
63
- bower_components
64
-
65
- # node-waf configuration
66
- .lock-wscript
67
-
68
- # Compiled binary addons (https://nodejs.org/api/addons.html)
69
- build/Release
70
-
71
- # Dependency directories
72
- node_modules/
73
- jspm_packages/
74
-
75
- # Snowpack dependency directory (https://snowpack.dev/)
76
- web_modules/
77
-
78
- # TypeScript cache
79
- *.tsbuildinfo
80
-
81
- # Optional npm cache directory
82
- .npm
83
-
84
- # Optional eslint cache
85
- .eslintcache
86
-
87
- # Optional stylelint cache
88
- .stylelintcache
89
-
90
- # Microbundle cache
91
- .rpt2_cache/
92
- .rts2_cache_cjs/
93
- .rts2_cache_es/
94
- .rts2_cache_umd/
95
-
96
- # Optional REPL history
97
- .node_repl_history
98
-
99
- # Output of 'npm pack'
100
- *.tgz
101
-
102
- # Yarn Integrity file
103
- .yarn-integrity
104
-
105
- # dotenv environment variable files
106
- .env
107
- .env.development.local
108
- .env.test.local
109
- .env.production.local
110
- .env.local
111
-
112
- # parcel-bundler cache (https://parceljs.org/)
113
- .cache
114
- .parcel-cache
115
-
116
- # Next.js build output
117
- .next
118
- out
119
-
120
- # Nuxt.js build / generate output
121
- .nuxt
122
- dist
123
-
124
- # Gatsby files
125
- .cache/
126
- # Comment in the public line in if your project uses Gatsby and not Next.js
127
- # https://nextjs.org/blog/next-9-1#public-directory-support
128
- # public
129
-
130
- # vuepress build output
131
- .vuepress/dist
132
-
133
- # vuepress v2.x temp and cache directory
134
- .temp
135
-
136
- # Docusaurus cache and generated files
137
- .docusaurus
138
-
139
- # Serverless directories
140
- .serverless/
141
-
142
- # FuseBox cache
143
- .fusebox/
144
-
145
- # DynamoDB Local files
146
- .dynamodb/
147
-
148
- # TernJS port file
149
- .tern-port
150
-
151
- # Stores VSCode versions used for testing VSCode extensions
152
- .vscode-test
153
-
154
- # yarn v2
155
- .yarn/cache
156
- .yarn/unplugged
157
- .yarn/build-state.yml
158
- .yarn/install-state.gz
159
- .pnp.*
160
-
161
- ### Node Patch ###
162
- # Serverless Webpack directories
163
- .webpack/
164
-
165
- # Optional stylelint cache
166
-
167
- # SvelteKit build / generate output
168
- .svelte-kit
169
-
170
- ### react ###
171
- .DS_*
172
- **/*.backup.*
173
- **/*.back.*
174
-
175
- node_modules
176
-
177
- *.sublime*
178
-
179
- psd
180
- thumb
181
- sketch
182
-
183
- # Shopify apps
184
- build
@@ -1,7 +0,0 @@
1
- # {{ name }}
2
-
3
- ## Set up
4
-
5
- 1. Clone the repository.
6
- 2. Install dependencies: `{{dependency_manager}} install`.
7
- 3. Build with `{{dependency_manager}} build`
@@ -1,28 +0,0 @@
1
- {
2
- "name": "{{name}}",
3
- "version": "0.1.0",
4
- "main": "home/index.js",
5
- "license": "UNLICENSED",
6
- "scripts": {
7
- "shopify": "shopify",
8
- "build": "shopify app build",
9
- "dev": "shopify app dev",
10
- "push": "shopify app push",
11
- "scaffold": "shopify app scaffold",
12
- "deploy": "shopify app deploy"
13
- },
14
- "dependencies": {
15
- "@shopify/cli": "{{shopify_cli_version}}",
16
- "@shopify/app": "{{shopify_app_version}}",
17
- "react": "17.0.2"
18
- },{% if dependency_overrides.size > 0 %}{% if dependency_overrides %}
19
- "overrides": {
20
- {% for dependency in dependency_overrides %}
21
- "{{dependency[0]}}": "{{dependency[1]}}"{% unless forloop.last %},{% endunless %}{% endfor %}
22
- },{% endif %}{% endif %}{% if dependency_overrides.size > 0 %}{% if dependency_overrides %}
23
- "resolutions": {
24
- {% for dependency in dependency_overrides %}
25
- "{{dependency[0]}}": "{{dependency[1]}}"{% unless forloop.last %},{% endunless %}{% endfor %}
26
- },{% endif %}{% endif %}
27
- "author": "{{author}}"
28
- }
@@ -1,3 +0,0 @@
1
- # This file stores configurations for your Shopify app.
2
-
3
- name = "{{name}}"