@commercetools-frontend/create-mc-app 24.11.0 → 24.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @commercetools-frontend/create-mc-app
2
2
 
3
+ ## 24.13.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @commercetools-frontend/application-config@24.13.0
9
+
10
+ ## 24.12.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies []:
15
+ - @commercetools-frontend/application-config@24.12.0
16
+
3
17
  ## 24.11.0
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -5,3 +5,102 @@
5
5
  </p>
6
6
 
7
7
  Check out the [documentation](https://docs.commercetools.com/merchant-center-customizations/api-reference/create-mc-app) for more information.
8
+
9
+ ## Local Development
10
+
11
+ This guide is for **internal developers** who want to modify starter templates and test changes locally without publishing a new release.
12
+
13
+ ### How It Works
14
+
15
+ The CLI clones templates from the GitHub repository (not your local filesystem). This means you must push template changes to a git branch before testing them locally.
16
+
17
+ ### Prerequisites
18
+
19
+ - Repository cloned locally
20
+ - `pnpm` installed
21
+ - Git push access to the repository
22
+
23
+ ### Workflow
24
+
25
+ #### 1. Make Template Changes
26
+
27
+ Edit files in the template directories:
28
+
29
+ ```bash
30
+ # For custom applications
31
+ application-templates/starter/
32
+ application-templates/starter-typescript/
33
+
34
+ # For custom views
35
+ custom-views-templates/starter/
36
+ custom-views-templates/starter-typescript/
37
+ ```
38
+
39
+ #### 2. Commit and Push to a Branch
40
+
41
+ ```bash
42
+ git checkout -b my-template-changes # create a new branch
43
+ git add application-templates/starter/ # do this after you make changes
44
+ git commit -m "chore(templates): add welcome header to starter template"
45
+ git push origin my-template-changes # push the changes to the new branch
46
+ ```
47
+
48
+ #### 3. Run the Local CLI with Your Branch
49
+
50
+ From the repository root:
51
+
52
+ ```bash
53
+ NODE_ENV=test node packages/create-mc-app/bin/cli.js my-test-app \
54
+ --template starter \
55
+ --template-version my-template-changes # important: use the branch name you created
56
+ ```
57
+
58
+ **Important:** Use relative paths (e.g., `my-test-app`) not absolute paths (e.g., `/Users/name/my-test-app`).
59
+
60
+ #### 4. Verify Your Changes
61
+
62
+ ```bash
63
+ cd my-test-app # navigate to the new app
64
+ yarn start # verify your template changes are present
65
+ ```
66
+
67
+ ### Quick Reference
68
+
69
+ ```bash
70
+ # Complete workflow
71
+ git checkout -b template-updates # create a new branch
72
+ # ... make changes to application-templates/starter/ (e.g., add a welcome message) ...
73
+ git add application-templates/starter/ # do this after you make changes
74
+ git commit -m "chore(templates): update landing page styles"
75
+ git push origin template-updates # push the changes to the new branch
76
+
77
+ cd packages/create-mc-app
78
+ pnpm build
79
+ cd ../..
80
+
81
+ NODE_ENV=test node packages/create-mc-app/bin/cli.js test-project \
82
+ --template starter \
83
+ --template-version template-updates
84
+
85
+ cd test-project # navigate to the new app
86
+ yarn start # verify your template changes are present
87
+ ```
88
+
89
+ ### Key Points
90
+
91
+ - ✅ **Must push changes to git** - Templates are cloned from GitHub, not copied from local filesystem
92
+ - ✅ **Use relative paths** - Avoid absolute paths starting with `/`
93
+ - ✅ **Use `--template-version`** - Specify your branch name to test changes
94
+ - ✅ **No npm publish needed** - Test directly with git branches
95
+ - ✅ **Test before merging** - Validate template changes work correctly before merging to `main`
96
+
97
+ ### Troubleshooting
98
+
99
+ **Error: "Name contains illegal characters"**
100
+
101
+ - You're using an absolute path. Use a relative path instead (e.g., `my-app` instead of `/Users/name/my-app`)
102
+
103
+ **Templates not reflecting changes**
104
+
105
+ - Ensure you've pushed your changes to the git branch
106
+ - Verify the `--template-version` flag matches your branch name
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
6
7
  var commander = require('commander');
7
8
  var listr2 = require('listr2');
8
9
  var execa = require('execa');
@@ -41,6 +42,7 @@ var prettier = require('prettier');
41
42
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
42
43
 
43
44
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
45
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
44
46
  var execa__default = /*#__PURE__*/_interopDefault(execa);
45
47
  var semver__default = /*#__PURE__*/_interopDefault(semver);
46
48
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
@@ -72,7 +74,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
72
74
 
73
75
  var pkgJson = {
74
76
  name: "@commercetools-frontend/create-mc-app",
75
- version: "24.11.0",
77
+ version: "24.13.0",
76
78
  description: "Create Merchant Center applications to quickly get up and running",
77
79
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
78
80
  repository: {
@@ -98,7 +100,7 @@ var pkgJson = {
98
100
  "@babel/core": "^7.22.17",
99
101
  "@babel/runtime": "^7.22.15",
100
102
  "@babel/runtime-corejs3": "^7.22.15",
101
- "@commercetools-frontend/application-config": "^24.11.0",
103
+ "@commercetools-frontend/application-config": "^24.13.0",
102
104
  "@types/babel__core": "^7.20.1",
103
105
  "@types/semver": "^7.5.1",
104
106
  commander: "^13.1.0",
@@ -136,10 +138,11 @@ async function getLatestReleaseVersion() {
136
138
  function hintOutdatedVersion(currentVersion, releaseVersion) {
137
139
  var _context;
138
140
  const hasBeenReleastedInLatestTag = semver__default["default"].gt(releaseVersion, currentVersion);
139
- const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
141
+ const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
140
142
  if (hintNewerVersions.length > 0) {
143
+ var _context2;
141
144
  console.log('');
142
- console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
145
+ console.log(_concatInstanceProperty__default["default"](_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
143
146
  console.log('');
144
147
  }
145
148
  }
@@ -206,7 +209,7 @@ const getInstallCommand = options => {
206
209
  case 'npm':
207
210
  return 'npm install --legacy-peer-deps';
208
211
  default:
209
- return `${packageManager} install`;
212
+ return "".concat(packageManager, " install");
210
213
  }
211
214
  };
212
215
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -216,19 +219,21 @@ const wordify = slug => {
216
219
  return _mapInstanceProperty__default["default"](_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
217
220
  };
218
221
  const resolveFilePathByExtension = requestedModule => {
219
- var _context3;
222
+ var _context3, _context5;
220
223
  const fileExtension = _findInstanceProperty__default["default"](_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
221
- const filePath = `${requestedModule}${ext}`;
224
+ var _context4;
225
+ const filePath = _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, ext);
222
226
  return doesFileExist(filePath);
223
227
  });
224
- return `${requestedModule}${fileExtension}`;
228
+ return _concatInstanceProperty__default["default"](_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
225
229
  };
226
230
 
227
231
  const throwIfApplicationTypeIsNotSupported = applicationType => {
228
232
  var _context;
229
233
  const applicationTypesList = _Object$keys__default["default"](applicationTypes);
230
234
  if (!_includesInstanceProperty__default["default"](_context = _Object$values__default["default"](applicationTypesList)).call(_context, applicationType)) {
231
- throw new Error(`The provided application type "${applicationType.toString()}" does not exist. Available types are "${applicationTypesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
235
+ var _context2;
236
+ throw new Error(_concatInstanceProperty__default["default"](_context2 = "The provided application type \"".concat(applicationType.toString(), "\" does not exist. Available types are \"")).call(_context2, applicationTypesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
232
237
  }
233
238
  };
234
239
  const throwIfTemplateIsNotSupported = templateName => {
@@ -238,19 +243,22 @@ const throwIfTemplateIsNotSupported = templateName => {
238
243
  break;
239
244
  default:
240
245
  {
246
+ var _context3;
241
247
  const templateNamesList = _Object$keys__default["default"](availableTemplates).toString();
242
- throw new Error(`The provided template name "${templateName}" does not exist. Available templates are "${templateNamesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
248
+ throw new Error(_concatInstanceProperty__default["default"](_context3 = "The provided template name \"".concat(templateName, "\" does not exist. Available templates are \"")).call(_context3, templateNamesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
243
249
  }
244
250
  }
245
251
  };
246
252
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
247
253
  if (doesFileExist(dirPath)) {
248
- throw new Error(`A directory named "${dirName}" already exists at this location "${dirPath}". Please choose a different project name or remove the directory, then try running the command again.`);
254
+ var _context4;
255
+ throw new Error(_concatInstanceProperty__default["default"](_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
249
256
  }
250
257
  };
251
258
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
252
259
  if (!doesFileExist(templateFolderPath)) {
253
- throw new Error(`The downloaded template "${templateName}" does not exist for the given version "${versionToCheck}". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
260
+ var _context5;
261
+ throw new Error(_concatInstanceProperty__default["default"](_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
254
262
  }
255
263
  // In case the version is semver (usually release tags) we check that
256
264
  // the cloned repository contains the template matching the given version
@@ -260,48 +268,52 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
260
268
  }));
261
269
  const versionAsNumber = versionToCheck.replace('v', '');
262
270
  if (templatePackageJson.version !== versionAsNumber) {
263
- throw new Error(`The downloaded template "${templateName}" does not match the version "${versionAsNumber}", instead got "${templatePackageJson.version}". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
271
+ var _context6, _context7;
272
+ throw new Error(_concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = "The downloaded template \"".concat(templateName, "\" does not match the version \"")).call(_context7, versionAsNumber, "\", instead got \"")).call(_context6, templatePackageJson.version, "\". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
264
273
  }
265
274
  }
266
275
  };
267
276
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
268
277
  if (!initialProjectKey) {
269
- throw new Error(`Provide a valid project key that you have access to.`);
278
+ throw new Error("Provide a valid project key that you have access to.");
270
279
  }
271
280
  };
272
281
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
273
282
  const hasValidNodeVersion = semver__default["default"].satisfies(currentNodeVersion, expectedVersionRange);
274
283
  if (!hasValidNodeVersion) {
275
- throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
284
+ var _context8;
285
+ throw new Error(_concatInstanceProperty__default["default"](_context8 = "You are running Node ".concat(currentNodeVersion, " but create-mc-app requires Node ")).call(_context8, expectedVersionRange, ". Please update your version of Node."));
276
286
  }
277
287
  };
278
288
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
279
289
  const allowedCloudIdentifiers = _Object$values__default["default"](applicationConfig.CLOUD_IDENTIFIERS);
280
290
  if (!_includesInstanceProperty__default["default"](allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
281
- throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
291
+ var _context9;
292
+ throw new Error(_concatInstanceProperty__default["default"](_context9 = "The cloud region \"".concat(cloudIdentifier, "\" is not supported. Supported regions are: ")).call(_context9, allowedCloudIdentifiers.join(', '), "."));
282
293
  }
283
294
  };
284
295
 
285
296
  const question = (rl, value) => new _Promise__default["default"](resolve => rl.question(value, resolve));
286
297
  const getEntryPointUriPath = async (rl, options) => {
298
+ var _context;
287
299
  if (options.applicationType === applicationTypes['custom-view']) {
288
300
  return;
289
301
  }
290
302
  if (options.entryPointUriPath) {
291
303
  return options.entryPointUriPath;
292
304
  }
293
- const randomEntryPointUriPath = `${options.template}-${crypto__default["default"].randomBytes(3).toString('hex')}`;
305
+ const randomEntryPointUriPath = _concatInstanceProperty__default["default"](_context = "".concat(options.template, "-")).call(_context, crypto__default["default"].randomBytes(3).toString('hex'));
294
306
  if (options.yes) {
295
307
  return randomEntryPointUriPath;
296
308
  }
297
- const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
309
+ const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
298
310
  return answerEntryPointUriPath || randomEntryPointUriPath;
299
311
  };
300
312
  const getInitialProjectKey = async (rl, options) => {
301
313
  if (options.initialProjectKey) {
302
314
  return options.initialProjectKey;
303
315
  }
304
- const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
316
+ const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
305
317
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
306
318
  return initialProjectKey;
307
319
  };
@@ -328,7 +340,7 @@ async function processOptions(projectDirectoryName, options) {
328
340
 
329
341
  // Parse options
330
342
  let tagOrBranchVersion = options.templateVersion || 'main';
331
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
343
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
332
344
  const templateName = options.template;
333
345
 
334
346
  // Validate options
@@ -363,15 +375,16 @@ function downloadTemplate(options) {
363
375
  return {
364
376
  title: 'Downloading template',
365
377
  task: () => {
378
+ var _context;
366
379
  const tmpDir = os__default["default"].tmpdir();
367
380
  const tmpFolderNameForClonedRepository = ['merchant-center-application-kit', '--', options.tagOrBranchVersion, '--', _Date$now__default["default"]().toString()].join('');
368
381
  const clonedRepositoryPath = path__default["default"].join(tmpDir, tmpFolderNameForClonedRepository);
369
382
  const templateFolderPath = path__default["default"].join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
370
383
  return new listr2.Listr([{
371
- title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
384
+ title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
372
385
  task: async () => {
373
386
  // Shallow clone repository
374
- const result = await execa__default["default"]('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
387
+ const result = await execa__default["default"]('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
375
388
  cwd: tmpDir,
376
389
  encoding: 'utf-8'
377
390
  });
@@ -382,7 +395,7 @@ function downloadTemplate(options) {
382
395
  return result.stdout;
383
396
  }
384
397
  }, {
385
- title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
398
+ title: _concatInstanceProperty__default["default"](_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
386
399
  task: async () => {
387
400
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
388
401
  const result = await execa__default["default"](command, [templateFolderPath,
@@ -395,12 +408,12 @@ function downloadTemplate(options) {
395
408
  }
396
409
  const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
397
410
  if (!doesFileExist(templatePackageJsonPath)) {
398
- throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
411
+ throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
399
412
  }
400
413
  return result.stdout;
401
414
  }
402
415
  }, {
403
- title: `Cleaning up project directory`,
416
+ title: "Cleaning up project directory",
404
417
  task: async () => {
405
418
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
406
419
  const result = await execa__default["default"](command, _mapInstanceProperty__default["default"](filesToBeRemoved).call(filesToBeRemoved, filePath => path__default["default"].join(options.projectDirectoryPath, filePath)), {
@@ -487,7 +500,8 @@ function updatePackageJson(options, releaseVersion) {
487
500
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
488
501
  const result = core.transformFileSync(filePath, {
489
502
  plugins: [function replaceConfig() {
490
- const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
503
+ var _options$entryPointUr;
504
+ const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
491
505
  return {
492
506
  visitor: {
493
507
  Identifier(nodePath) {
@@ -522,9 +536,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
522
536
  }],
523
537
  retainLines: true
524
538
  });
525
- if (result?.code) {
539
+ if (result !== null && result !== void 0 && result.code) {
526
540
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
527
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
541
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
528
542
  fs__default["default"].writeFileSync(filePath, formattedData, {
529
543
  encoding: 'utf8'
530
544
  });
@@ -537,7 +551,7 @@ function getApplicationConfigName(options) {
537
551
  case applicationTypes['custom-view']:
538
552
  return 'custom-view-config';
539
553
  default:
540
- throw new Error(`Unknown application type ${options.applicationType}`);
554
+ throw new Error("Unknown application type ".concat(options.applicationType));
541
555
  }
542
556
  }
543
557
  function updateApplicationConfig(options) {
@@ -565,9 +579,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
565
579
  }],
566
580
  retainLines: true
567
581
  });
568
- if (result?.code) {
582
+ if (result !== null && result !== void 0 && result.code) {
569
583
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
570
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
584
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
571
585
  fs__default["default"].writeFileSync(filePath, formattedData, {
572
586
  encoding: 'utf8'
573
587
  });
@@ -604,7 +618,7 @@ const messagesByApplicationType = {
604
618
  const run = () => {
605
619
  // Default command
606
620
  commander.program.argument('<project-directory>').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', applicationTypes['custom-application']).option('--template <name>', '(optional) The name of the template to install.', availableTemplates.starter).option('--template-version <version>', '(optional) The version of the template to install (either a git tag or a git branch of the "commercetools/merchant-center-application-kit" repository).', 'main').option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', false).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', false).option('--entry-point-uri-path <value>', '(optional) The version of the template to install. (default: starter-<hash>)').option('--initial-project-key <value>', '(optional) A commercetools project key used for the initial login in development. By default, the value is prompted in the terminal.').option('--cloud-identifier <value>', '(optional) Cloud region identifier. By default, the value is prompted in the terminal').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
607
- var _context;
621
+ var _context, _context2;
608
622
  const releaseVersion = await getLatestReleaseVersion();
609
623
  hintOutdatedVersion(pkgJson.version, releaseVersion);
610
624
  const taskOptions = await processOptions(projectDirectory, options);
@@ -619,16 +633,16 @@ const run = () => {
619
633
  await taskList.run();
620
634
  const packageManager = getPreferredPackageManager(taskOptions);
621
635
  console.log('');
622
- console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
636
+ console.log(_concatInstanceProperty__default["default"](_context2 = "\uD83C\uDF89 \uD83C\uDF89 \uD83C\uDF89 The ".concat(messages.featureName, " has been created in the \"")).call(_context2, taskOptions.projectDirectoryName, "\" folder."));
623
637
  console.log('');
624
- console.log(`To get started:`);
625
- console.log(`$ cd ${taskOptions.projectDirectoryName}`);
638
+ console.log("To get started:");
639
+ console.log("$ cd ".concat(taskOptions.projectDirectoryName));
626
640
  if (!shouldInstallDependencies) {
627
- console.log(`$ ${packageManager} install`);
641
+ console.log("$ ".concat(packageManager, " install"));
628
642
  }
629
- console.log(`$ ${packageManager} start`);
643
+ console.log("$ ".concat(packageManager, " start"));
630
644
  console.log('');
631
- console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
645
+ console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
632
646
  });
633
647
  commander.program.parse();
634
648
  };
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
6
7
  var commander = require('commander');
7
8
  var listr2 = require('listr2');
8
9
  var execa = require('execa');
@@ -41,6 +42,7 @@ var prettier = require('prettier');
41
42
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
42
43
 
43
44
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
45
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
44
46
  var execa__default = /*#__PURE__*/_interopDefault(execa);
45
47
  var semver__default = /*#__PURE__*/_interopDefault(semver);
46
48
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
@@ -72,7 +74,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
72
74
 
73
75
  var pkgJson = {
74
76
  name: "@commercetools-frontend/create-mc-app",
75
- version: "24.11.0",
77
+ version: "24.13.0",
76
78
  description: "Create Merchant Center applications to quickly get up and running",
77
79
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
78
80
  repository: {
@@ -98,7 +100,7 @@ var pkgJson = {
98
100
  "@babel/core": "^7.22.17",
99
101
  "@babel/runtime": "^7.22.15",
100
102
  "@babel/runtime-corejs3": "^7.22.15",
101
- "@commercetools-frontend/application-config": "^24.11.0",
103
+ "@commercetools-frontend/application-config": "^24.13.0",
102
104
  "@types/babel__core": "^7.20.1",
103
105
  "@types/semver": "^7.5.1",
104
106
  commander: "^13.1.0",
@@ -136,10 +138,11 @@ async function getLatestReleaseVersion() {
136
138
  function hintOutdatedVersion(currentVersion, releaseVersion) {
137
139
  var _context;
138
140
  const hasBeenReleastedInLatestTag = semver__default["default"].gt(releaseVersion, currentVersion);
139
- const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
141
+ const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
140
142
  if (hintNewerVersions.length > 0) {
143
+ var _context2;
141
144
  console.log('');
142
- console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
145
+ console.log(_concatInstanceProperty__default["default"](_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
143
146
  console.log('');
144
147
  }
145
148
  }
@@ -206,7 +209,7 @@ const getInstallCommand = options => {
206
209
  case 'npm':
207
210
  return 'npm install --legacy-peer-deps';
208
211
  default:
209
- return `${packageManager} install`;
212
+ return "".concat(packageManager, " install");
210
213
  }
211
214
  };
212
215
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -216,19 +219,21 @@ const wordify = slug => {
216
219
  return _mapInstanceProperty__default["default"](_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
217
220
  };
218
221
  const resolveFilePathByExtension = requestedModule => {
219
- var _context3;
222
+ var _context3, _context5;
220
223
  const fileExtension = _findInstanceProperty__default["default"](_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
221
- const filePath = `${requestedModule}${ext}`;
224
+ var _context4;
225
+ const filePath = _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, ext);
222
226
  return doesFileExist(filePath);
223
227
  });
224
- return `${requestedModule}${fileExtension}`;
228
+ return _concatInstanceProperty__default["default"](_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
225
229
  };
226
230
 
227
231
  const throwIfApplicationTypeIsNotSupported = applicationType => {
228
232
  var _context;
229
233
  const applicationTypesList = _Object$keys__default["default"](applicationTypes);
230
234
  if (!_includesInstanceProperty__default["default"](_context = _Object$values__default["default"](applicationTypesList)).call(_context, applicationType)) {
231
- throw new Error(`The provided application type "${applicationType.toString()}" does not exist. Available types are "${applicationTypesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
235
+ var _context2;
236
+ throw new Error(_concatInstanceProperty__default["default"](_context2 = "The provided application type \"".concat(applicationType.toString(), "\" does not exist. Available types are \"")).call(_context2, applicationTypesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
232
237
  }
233
238
  };
234
239
  const throwIfTemplateIsNotSupported = templateName => {
@@ -238,19 +243,22 @@ const throwIfTemplateIsNotSupported = templateName => {
238
243
  break;
239
244
  default:
240
245
  {
246
+ var _context3;
241
247
  const templateNamesList = _Object$keys__default["default"](availableTemplates).toString();
242
- throw new Error(`The provided template name "${templateName}" does not exist. Available templates are "${templateNamesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
248
+ throw new Error(_concatInstanceProperty__default["default"](_context3 = "The provided template name \"".concat(templateName, "\" does not exist. Available templates are \"")).call(_context3, templateNamesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
243
249
  }
244
250
  }
245
251
  };
246
252
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
247
253
  if (doesFileExist(dirPath)) {
248
- throw new Error(`A directory named "${dirName}" already exists at this location "${dirPath}". Please choose a different project name or remove the directory, then try running the command again.`);
254
+ var _context4;
255
+ throw new Error(_concatInstanceProperty__default["default"](_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
249
256
  }
250
257
  };
251
258
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
252
259
  if (!doesFileExist(templateFolderPath)) {
253
- throw new Error(`The downloaded template "${templateName}" does not exist for the given version "${versionToCheck}". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
260
+ var _context5;
261
+ throw new Error(_concatInstanceProperty__default["default"](_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
254
262
  }
255
263
  // In case the version is semver (usually release tags) we check that
256
264
  // the cloned repository contains the template matching the given version
@@ -260,48 +268,52 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
260
268
  }));
261
269
  const versionAsNumber = versionToCheck.replace('v', '');
262
270
  if (templatePackageJson.version !== versionAsNumber) {
263
- throw new Error(`The downloaded template "${templateName}" does not match the version "${versionAsNumber}", instead got "${templatePackageJson.version}". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
271
+ var _context6, _context7;
272
+ throw new Error(_concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = "The downloaded template \"".concat(templateName, "\" does not match the version \"")).call(_context7, versionAsNumber, "\", instead got \"")).call(_context6, templatePackageJson.version, "\". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
264
273
  }
265
274
  }
266
275
  };
267
276
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
268
277
  if (!initialProjectKey) {
269
- throw new Error(`Provide a valid project key that you have access to.`);
278
+ throw new Error("Provide a valid project key that you have access to.");
270
279
  }
271
280
  };
272
281
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
273
282
  const hasValidNodeVersion = semver__default["default"].satisfies(currentNodeVersion, expectedVersionRange);
274
283
  if (!hasValidNodeVersion) {
275
- throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
284
+ var _context8;
285
+ throw new Error(_concatInstanceProperty__default["default"](_context8 = "You are running Node ".concat(currentNodeVersion, " but create-mc-app requires Node ")).call(_context8, expectedVersionRange, ". Please update your version of Node."));
276
286
  }
277
287
  };
278
288
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
279
289
  const allowedCloudIdentifiers = _Object$values__default["default"](applicationConfig.CLOUD_IDENTIFIERS);
280
290
  if (!_includesInstanceProperty__default["default"](allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
281
- throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
291
+ var _context9;
292
+ throw new Error(_concatInstanceProperty__default["default"](_context9 = "The cloud region \"".concat(cloudIdentifier, "\" is not supported. Supported regions are: ")).call(_context9, allowedCloudIdentifiers.join(', '), "."));
282
293
  }
283
294
  };
284
295
 
285
296
  const question = (rl, value) => new _Promise__default["default"](resolve => rl.question(value, resolve));
286
297
  const getEntryPointUriPath = async (rl, options) => {
298
+ var _context;
287
299
  if (options.applicationType === applicationTypes['custom-view']) {
288
300
  return;
289
301
  }
290
302
  if (options.entryPointUriPath) {
291
303
  return options.entryPointUriPath;
292
304
  }
293
- const randomEntryPointUriPath = `${options.template}-${crypto__default["default"].randomBytes(3).toString('hex')}`;
305
+ const randomEntryPointUriPath = _concatInstanceProperty__default["default"](_context = "".concat(options.template, "-")).call(_context, crypto__default["default"].randomBytes(3).toString('hex'));
294
306
  if (options.yes) {
295
307
  return randomEntryPointUriPath;
296
308
  }
297
- const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
309
+ const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
298
310
  return answerEntryPointUriPath || randomEntryPointUriPath;
299
311
  };
300
312
  const getInitialProjectKey = async (rl, options) => {
301
313
  if (options.initialProjectKey) {
302
314
  return options.initialProjectKey;
303
315
  }
304
- const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
316
+ const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
305
317
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
306
318
  return initialProjectKey;
307
319
  };
@@ -328,7 +340,7 @@ async function processOptions(projectDirectoryName, options) {
328
340
 
329
341
  // Parse options
330
342
  let tagOrBranchVersion = options.templateVersion || 'main';
331
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
343
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
332
344
  const templateName = options.template;
333
345
 
334
346
  // Validate options
@@ -363,15 +375,16 @@ function downloadTemplate(options) {
363
375
  return {
364
376
  title: 'Downloading template',
365
377
  task: () => {
378
+ var _context;
366
379
  const tmpDir = os__default["default"].tmpdir();
367
380
  const tmpFolderNameForClonedRepository = ['merchant-center-application-kit', '--', options.tagOrBranchVersion, '--', _Date$now__default["default"]().toString()].join('');
368
381
  const clonedRepositoryPath = path__default["default"].join(tmpDir, tmpFolderNameForClonedRepository);
369
382
  const templateFolderPath = path__default["default"].join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
370
383
  return new listr2.Listr([{
371
- title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
384
+ title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
372
385
  task: async () => {
373
386
  // Shallow clone repository
374
- const result = await execa__default["default"]('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
387
+ const result = await execa__default["default"]('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
375
388
  cwd: tmpDir,
376
389
  encoding: 'utf-8'
377
390
  });
@@ -382,7 +395,7 @@ function downloadTemplate(options) {
382
395
  return result.stdout;
383
396
  }
384
397
  }, {
385
- title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
398
+ title: _concatInstanceProperty__default["default"](_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
386
399
  task: async () => {
387
400
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
388
401
  const result = await execa__default["default"](command, [templateFolderPath,
@@ -395,12 +408,12 @@ function downloadTemplate(options) {
395
408
  }
396
409
  const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
397
410
  if (!doesFileExist(templatePackageJsonPath)) {
398
- throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
411
+ throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
399
412
  }
400
413
  return result.stdout;
401
414
  }
402
415
  }, {
403
- title: `Cleaning up project directory`,
416
+ title: "Cleaning up project directory",
404
417
  task: async () => {
405
418
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
406
419
  const result = await execa__default["default"](command, _mapInstanceProperty__default["default"](filesToBeRemoved).call(filesToBeRemoved, filePath => path__default["default"].join(options.projectDirectoryPath, filePath)), {
@@ -487,7 +500,8 @@ function updatePackageJson(options, releaseVersion) {
487
500
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
488
501
  const result = core.transformFileSync(filePath, {
489
502
  plugins: [function replaceConfig() {
490
- const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
503
+ var _options$entryPointUr;
504
+ const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
491
505
  return {
492
506
  visitor: {
493
507
  Identifier(nodePath) {
@@ -522,9 +536,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
522
536
  }],
523
537
  retainLines: true
524
538
  });
525
- if (result?.code) {
539
+ if (result !== null && result !== void 0 && result.code) {
526
540
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
527
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
541
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
528
542
  fs__default["default"].writeFileSync(filePath, formattedData, {
529
543
  encoding: 'utf8'
530
544
  });
@@ -537,7 +551,7 @@ function getApplicationConfigName(options) {
537
551
  case applicationTypes['custom-view']:
538
552
  return 'custom-view-config';
539
553
  default:
540
- throw new Error(`Unknown application type ${options.applicationType}`);
554
+ throw new Error("Unknown application type ".concat(options.applicationType));
541
555
  }
542
556
  }
543
557
  function updateApplicationConfig(options) {
@@ -565,9 +579,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
565
579
  }],
566
580
  retainLines: true
567
581
  });
568
- if (result?.code) {
582
+ if (result !== null && result !== void 0 && result.code) {
569
583
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
570
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
584
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
571
585
  fs__default["default"].writeFileSync(filePath, formattedData, {
572
586
  encoding: 'utf8'
573
587
  });
@@ -604,7 +618,7 @@ const messagesByApplicationType = {
604
618
  const run = () => {
605
619
  // Default command
606
620
  commander.program.argument('<project-directory>').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', applicationTypes['custom-application']).option('--template <name>', '(optional) The name of the template to install.', availableTemplates.starter).option('--template-version <version>', '(optional) The version of the template to install (either a git tag or a git branch of the "commercetools/merchant-center-application-kit" repository).', 'main').option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', false).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', false).option('--entry-point-uri-path <value>', '(optional) The version of the template to install. (default: starter-<hash>)').option('--initial-project-key <value>', '(optional) A commercetools project key used for the initial login in development. By default, the value is prompted in the terminal.').option('--cloud-identifier <value>', '(optional) Cloud region identifier. By default, the value is prompted in the terminal').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
607
- var _context;
621
+ var _context, _context2;
608
622
  const releaseVersion = await getLatestReleaseVersion();
609
623
  hintOutdatedVersion(pkgJson.version, releaseVersion);
610
624
  const taskOptions = await processOptions(projectDirectory, options);
@@ -619,16 +633,16 @@ const run = () => {
619
633
  await taskList.run();
620
634
  const packageManager = getPreferredPackageManager(taskOptions);
621
635
  console.log('');
622
- console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
636
+ console.log(_concatInstanceProperty__default["default"](_context2 = "\uD83C\uDF89 \uD83C\uDF89 \uD83C\uDF89 The ".concat(messages.featureName, " has been created in the \"")).call(_context2, taskOptions.projectDirectoryName, "\" folder."));
623
637
  console.log('');
624
- console.log(`To get started:`);
625
- console.log(`$ cd ${taskOptions.projectDirectoryName}`);
638
+ console.log("To get started:");
639
+ console.log("$ cd ".concat(taskOptions.projectDirectoryName));
626
640
  if (!shouldInstallDependencies) {
627
- console.log(`$ ${packageManager} install`);
641
+ console.log("$ ".concat(packageManager, " install"));
628
642
  }
629
- console.log(`$ ${packageManager} start`);
643
+ console.log("$ ".concat(packageManager, " start"));
630
644
  console.log('');
631
- console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
645
+ console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
632
646
  });
633
647
  commander.program.parse();
634
648
  };
@@ -1,4 +1,5 @@
1
1
  import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
2
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
2
3
  import { program } from 'commander';
3
4
  import { Listr } from 'listr2';
4
5
  import execa from 'execa';
@@ -36,7 +37,7 @@ import prettier from 'prettier';
36
37
 
37
38
  var pkgJson = {
38
39
  name: "@commercetools-frontend/create-mc-app",
39
- version: "24.11.0",
40
+ version: "24.13.0",
40
41
  description: "Create Merchant Center applications to quickly get up and running",
41
42
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
42
43
  repository: {
@@ -62,7 +63,7 @@ var pkgJson = {
62
63
  "@babel/core": "^7.22.17",
63
64
  "@babel/runtime": "^7.22.15",
64
65
  "@babel/runtime-corejs3": "^7.22.15",
65
- "@commercetools-frontend/application-config": "^24.11.0",
66
+ "@commercetools-frontend/application-config": "^24.13.0",
66
67
  "@types/babel__core": "^7.20.1",
67
68
  "@types/semver": "^7.5.1",
68
69
  commander: "^13.1.0",
@@ -100,10 +101,11 @@ async function getLatestReleaseVersion() {
100
101
  function hintOutdatedVersion(currentVersion, releaseVersion) {
101
102
  var _context;
102
103
  const hasBeenReleastedInLatestTag = semver.gt(releaseVersion, currentVersion);
103
- const hintNewerVersions = _filterInstanceProperty(_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
104
+ const hintNewerVersions = _filterInstanceProperty(_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
104
105
  if (hintNewerVersions.length > 0) {
106
+ var _context2;
105
107
  console.log('');
106
- console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
108
+ console.log(_concatInstanceProperty(_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
107
109
  console.log('');
108
110
  }
109
111
  }
@@ -170,7 +172,7 @@ const getInstallCommand = options => {
170
172
  case 'npm':
171
173
  return 'npm install --legacy-peer-deps';
172
174
  default:
173
- return `${packageManager} install`;
175
+ return "".concat(packageManager, " install");
174
176
  }
175
177
  };
176
178
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -180,19 +182,21 @@ const wordify = slug => {
180
182
  return _mapInstanceProperty(_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
181
183
  };
182
184
  const resolveFilePathByExtension = requestedModule => {
183
- var _context3;
185
+ var _context3, _context5;
184
186
  const fileExtension = _findInstanceProperty(_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
185
- const filePath = `${requestedModule}${ext}`;
187
+ var _context4;
188
+ const filePath = _concatInstanceProperty(_context4 = "".concat(requestedModule)).call(_context4, ext);
186
189
  return doesFileExist(filePath);
187
190
  });
188
- return `${requestedModule}${fileExtension}`;
191
+ return _concatInstanceProperty(_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
189
192
  };
190
193
 
191
194
  const throwIfApplicationTypeIsNotSupported = applicationType => {
192
195
  var _context;
193
196
  const applicationTypesList = _Object$keys(applicationTypes);
194
197
  if (!_includesInstanceProperty(_context = _Object$values(applicationTypesList)).call(_context, applicationType)) {
195
- throw new Error(`The provided application type "${applicationType.toString()}" does not exist. Available types are "${applicationTypesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
198
+ var _context2;
199
+ throw new Error(_concatInstanceProperty(_context2 = "The provided application type \"".concat(applicationType.toString(), "\" does not exist. Available types are \"")).call(_context2, applicationTypesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
196
200
  }
197
201
  };
198
202
  const throwIfTemplateIsNotSupported = templateName => {
@@ -202,19 +206,22 @@ const throwIfTemplateIsNotSupported = templateName => {
202
206
  break;
203
207
  default:
204
208
  {
209
+ var _context3;
205
210
  const templateNamesList = _Object$keys(availableTemplates).toString();
206
- throw new Error(`The provided template name "${templateName}" does not exist. Available templates are "${templateNamesList}". Make sure you are also using the latest version of "@commercetools-frontend/create-mc-app".`);
211
+ throw new Error(_concatInstanceProperty(_context3 = "The provided template name \"".concat(templateName, "\" does not exist. Available templates are \"")).call(_context3, templateNamesList, "\". Make sure you are also using the latest version of \"@commercetools-frontend/create-mc-app\"."));
207
212
  }
208
213
  }
209
214
  };
210
215
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
211
216
  if (doesFileExist(dirPath)) {
212
- throw new Error(`A directory named "${dirName}" already exists at this location "${dirPath}". Please choose a different project name or remove the directory, then try running the command again.`);
217
+ var _context4;
218
+ throw new Error(_concatInstanceProperty(_context4 = "A directory named \"".concat(dirName, "\" already exists at this location \"")).call(_context4, dirPath, "\". Please choose a different project name or remove the directory, then try running the command again."));
213
219
  }
214
220
  };
215
221
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
216
222
  if (!doesFileExist(templateFolderPath)) {
217
- throw new Error(`The downloaded template "${templateName}" does not exist for the given version "${versionToCheck}". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
223
+ var _context5;
224
+ throw new Error(_concatInstanceProperty(_context5 = "The downloaded template \"".concat(templateName, "\" does not exist for the given version \"")).call(_context5, versionToCheck, "\". Check the releases page if you are looking for a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
218
225
  }
219
226
  // In case the version is semver (usually release tags) we check that
220
227
  // the cloned repository contains the template matching the given version
@@ -224,48 +231,52 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
224
231
  }));
225
232
  const versionAsNumber = versionToCheck.replace('v', '');
226
233
  if (templatePackageJson.version !== versionAsNumber) {
227
- throw new Error(`The downloaded template "${templateName}" does not match the version "${versionAsNumber}", instead got "${templatePackageJson.version}". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases`);
234
+ var _context6, _context7;
235
+ throw new Error(_concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = "The downloaded template \"".concat(templateName, "\" does not match the version \"")).call(_context7, versionAsNumber, "\", instead got \"")).call(_context6, templatePackageJson.version, "\". Check the releases page if you want to provide a specific version: https://github.com/commercetools/merchant-center-application-kit/releases"));
228
236
  }
229
237
  }
230
238
  };
231
239
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
232
240
  if (!initialProjectKey) {
233
- throw new Error(`Provide a valid project key that you have access to.`);
241
+ throw new Error("Provide a valid project key that you have access to.");
234
242
  }
235
243
  };
236
244
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
237
245
  const hasValidNodeVersion = semver.satisfies(currentNodeVersion, expectedVersionRange);
238
246
  if (!hasValidNodeVersion) {
239
- throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
247
+ var _context8;
248
+ throw new Error(_concatInstanceProperty(_context8 = "You are running Node ".concat(currentNodeVersion, " but create-mc-app requires Node ")).call(_context8, expectedVersionRange, ". Please update your version of Node."));
240
249
  }
241
250
  };
242
251
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
243
252
  const allowedCloudIdentifiers = _Object$values(CLOUD_IDENTIFIERS);
244
253
  if (!_includesInstanceProperty(allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
245
- throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
254
+ var _context9;
255
+ throw new Error(_concatInstanceProperty(_context9 = "The cloud region \"".concat(cloudIdentifier, "\" is not supported. Supported regions are: ")).call(_context9, allowedCloudIdentifiers.join(', '), "."));
246
256
  }
247
257
  };
248
258
 
249
259
  const question = (rl, value) => new _Promise(resolve => rl.question(value, resolve));
250
260
  const getEntryPointUriPath = async (rl, options) => {
261
+ var _context;
251
262
  if (options.applicationType === applicationTypes['custom-view']) {
252
263
  return;
253
264
  }
254
265
  if (options.entryPointUriPath) {
255
266
  return options.entryPointUriPath;
256
267
  }
257
- const randomEntryPointUriPath = `${options.template}-${crypto.randomBytes(3).toString('hex')}`;
268
+ const randomEntryPointUriPath = _concatInstanceProperty(_context = "".concat(options.template, "-")).call(_context, crypto.randomBytes(3).toString('hex'));
258
269
  if (options.yes) {
259
270
  return randomEntryPointUriPath;
260
271
  }
261
- const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
272
+ const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
262
273
  return answerEntryPointUriPath || randomEntryPointUriPath;
263
274
  };
264
275
  const getInitialProjectKey = async (rl, options) => {
265
276
  if (options.initialProjectKey) {
266
277
  return options.initialProjectKey;
267
278
  }
268
- const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
279
+ const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
269
280
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
270
281
  return initialProjectKey;
271
282
  };
@@ -292,7 +303,7 @@ async function processOptions(projectDirectoryName, options) {
292
303
 
293
304
  // Parse options
294
305
  let tagOrBranchVersion = options.templateVersion || 'main';
295
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty(tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
306
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty(tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
296
307
  const templateName = options.template;
297
308
 
298
309
  // Validate options
@@ -327,15 +338,16 @@ function downloadTemplate(options) {
327
338
  return {
328
339
  title: 'Downloading template',
329
340
  task: () => {
341
+ var _context;
330
342
  const tmpDir = os.tmpdir();
331
343
  const tmpFolderNameForClonedRepository = ['merchant-center-application-kit', '--', options.tagOrBranchVersion, '--', _Date$now().toString()].join('');
332
344
  const clonedRepositoryPath = path.join(tmpDir, tmpFolderNameForClonedRepository);
333
345
  const templateFolderPath = path.join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
334
346
  return new Listr([{
335
- title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
347
+ title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
336
348
  task: async () => {
337
349
  // Shallow clone repository
338
- const result = await execa('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
350
+ const result = await execa('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
339
351
  cwd: tmpDir,
340
352
  encoding: 'utf-8'
341
353
  });
@@ -346,7 +358,7 @@ function downloadTemplate(options) {
346
358
  return result.stdout;
347
359
  }
348
360
  }, {
349
- title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
361
+ title: _concatInstanceProperty(_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
350
362
  task: async () => {
351
363
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
352
364
  const result = await execa(command, [templateFolderPath,
@@ -359,12 +371,12 @@ function downloadTemplate(options) {
359
371
  }
360
372
  const templatePackageJsonPath = path.join(options.projectDirectoryPath, 'package.json');
361
373
  if (!doesFileExist(templatePackageJsonPath)) {
362
- throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
374
+ throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
363
375
  }
364
376
  return result.stdout;
365
377
  }
366
378
  }, {
367
- title: `Cleaning up project directory`,
379
+ title: "Cleaning up project directory",
368
380
  task: async () => {
369
381
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
370
382
  const result = await execa(command, _mapInstanceProperty(filesToBeRemoved).call(filesToBeRemoved, filePath => path.join(options.projectDirectoryPath, filePath)), {
@@ -451,7 +463,8 @@ function updatePackageJson(options, releaseVersion) {
451
463
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
452
464
  const result = transformFileSync(filePath, {
453
465
  plugins: [function replaceConfig() {
454
- const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
466
+ var _options$entryPointUr;
467
+ const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
455
468
  return {
456
469
  visitor: {
457
470
  Identifier(nodePath) {
@@ -486,9 +499,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
486
499
  }],
487
500
  retainLines: true
488
501
  });
489
- if (result?.code) {
502
+ if (result !== null && result !== void 0 && result.code) {
490
503
  const prettierConfig = prettier.resolveConfig.sync(options.projectDirectoryPath);
491
- const formattedData = prettier.format(result.code + os.EOL, prettierConfig ?? undefined);
504
+ const formattedData = prettier.format(result.code + os.EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
492
505
  fs.writeFileSync(filePath, formattedData, {
493
506
  encoding: 'utf8'
494
507
  });
@@ -501,7 +514,7 @@ function getApplicationConfigName(options) {
501
514
  case applicationTypes['custom-view']:
502
515
  return 'custom-view-config';
503
516
  default:
504
- throw new Error(`Unknown application type ${options.applicationType}`);
517
+ throw new Error("Unknown application type ".concat(options.applicationType));
505
518
  }
506
519
  }
507
520
  function updateApplicationConfig(options) {
@@ -529,9 +542,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
529
542
  }],
530
543
  retainLines: true
531
544
  });
532
- if (result?.code) {
545
+ if (result !== null && result !== void 0 && result.code) {
533
546
  const prettierConfig = prettier.resolveConfig.sync(options.projectDirectoryPath);
534
- const formattedData = prettier.format(result.code + os.EOL, prettierConfig ?? undefined);
547
+ const formattedData = prettier.format(result.code + os.EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
535
548
  fs.writeFileSync(filePath, formattedData, {
536
549
  encoding: 'utf8'
537
550
  });
@@ -568,7 +581,7 @@ const messagesByApplicationType = {
568
581
  const run = () => {
569
582
  // Default command
570
583
  program.argument('<project-directory>').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', applicationTypes['custom-application']).option('--template <name>', '(optional) The name of the template to install.', availableTemplates.starter).option('--template-version <version>', '(optional) The version of the template to install (either a git tag or a git branch of the "commercetools/merchant-center-application-kit" repository).', 'main').option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', false).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', false).option('--entry-point-uri-path <value>', '(optional) The version of the template to install. (default: starter-<hash>)').option('--initial-project-key <value>', '(optional) A commercetools project key used for the initial login in development. By default, the value is prompted in the terminal.').option('--cloud-identifier <value>', '(optional) Cloud region identifier. By default, the value is prompted in the terminal').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
571
- var _context;
584
+ var _context, _context2;
572
585
  const releaseVersion = await getLatestReleaseVersion();
573
586
  hintOutdatedVersion(pkgJson.version, releaseVersion);
574
587
  const taskOptions = await processOptions(projectDirectory, options);
@@ -583,16 +596,16 @@ const run = () => {
583
596
  await taskList.run();
584
597
  const packageManager = getPreferredPackageManager(taskOptions);
585
598
  console.log('');
586
- console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
599
+ console.log(_concatInstanceProperty(_context2 = "\uD83C\uDF89 \uD83C\uDF89 \uD83C\uDF89 The ".concat(messages.featureName, " has been created in the \"")).call(_context2, taskOptions.projectDirectoryName, "\" folder."));
587
600
  console.log('');
588
- console.log(`To get started:`);
589
- console.log(`$ cd ${taskOptions.projectDirectoryName}`);
601
+ console.log("To get started:");
602
+ console.log("$ cd ".concat(taskOptions.projectDirectoryName));
590
603
  if (!shouldInstallDependencies) {
591
- console.log(`$ ${packageManager} install`);
604
+ console.log("$ ".concat(packageManager, " install"));
592
605
  }
593
- console.log(`$ ${packageManager} start`);
606
+ console.log("$ ".concat(packageManager, " start"));
594
607
  console.log('');
595
- console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
608
+ console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
596
609
  });
597
610
  program.parse();
598
611
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/create-mc-app",
3
- "version": "24.11.0",
3
+ "version": "24.13.0",
4
4
  "description": "Create Merchant Center applications to quickly get up and running",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "@babel/core": "^7.22.17",
27
27
  "@babel/runtime": "^7.22.15",
28
28
  "@babel/runtime-corejs3": "^7.22.15",
29
- "@commercetools-frontend/application-config": "^24.11.0",
29
+ "@commercetools-frontend/application-config": "^24.13.0",
30
30
  "@types/babel__core": "^7.20.1",
31
31
  "@types/semver": "^7.5.1",
32
32
  "commander": "^13.1.0",