@commercetools-frontend/create-mc-app 27.9.1 → 27.9.2

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,12 @@
1
1
  # @commercetools-frontend/create-mc-app
2
2
 
3
+ ## 27.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @commercetools-frontend/application-config@27.9.2
9
+
3
10
  ## 27.9.1
4
11
 
5
12
  ### Patch Changes
@@ -3,7 +3,6 @@
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');
7
6
  var commander = require('commander');
8
7
  var listr2 = require('listr2');
9
8
  var execa = require('execa');
@@ -42,7 +41,6 @@ var prettier = require('prettier');
42
41
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
43
42
 
44
43
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
45
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
46
44
  var execa__default = /*#__PURE__*/_interopDefault(execa);
47
45
  var semver__default = /*#__PURE__*/_interopDefault(semver);
48
46
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
@@ -73,7 +71,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
73
71
 
74
72
  var pkgJson = {
75
73
  name: "@commercetools-frontend/create-mc-app",
76
- version: "27.9.1",
74
+ version: "27.9.2",
77
75
  description: "Create Merchant Center applications to quickly get up and running",
78
76
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
79
77
  repository: {
@@ -138,11 +136,10 @@ async function getLatestReleaseVersion() {
138
136
  function hintOutdatedVersion(currentVersion, releaseVersion) {
139
137
  var _context;
140
138
  const hasBeenReleastedInLatestTag = semver__default["default"].gt(releaseVersion, currentVersion);
141
- const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
139
+ const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
142
140
  if (hintNewerVersions.length > 0) {
143
- var _context2;
144
141
  console.log('');
145
- console.log(_concatInstanceProperty__default["default"](_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
142
+ console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
146
143
  console.log('');
147
144
  }
148
145
  }
@@ -209,7 +206,7 @@ const getInstallCommand = options => {
209
206
  case 'npm':
210
207
  return 'npm install --legacy-peer-deps';
211
208
  default:
212
- return "".concat(packageManager, " install");
209
+ return `${packageManager} install`;
213
210
  }
214
211
  };
215
212
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -219,21 +216,19 @@ const wordify = slug => {
219
216
  return _mapInstanceProperty__default["default"](_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
220
217
  };
221
218
  const resolveFilePathByExtension = requestedModule => {
222
- var _context3, _context5;
219
+ var _context3;
223
220
  const fileExtension = _findInstanceProperty__default["default"](_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
224
- var _context4;
225
- const filePath = _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, ext);
221
+ const filePath = `${requestedModule}${ext}`;
226
222
  return doesFileExist(filePath);
227
223
  });
228
- return _concatInstanceProperty__default["default"](_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
224
+ return `${requestedModule}${fileExtension}`;
229
225
  };
230
226
 
231
227
  const throwIfApplicationTypeIsNotSupported = applicationType => {
232
228
  var _context;
233
229
  const applicationTypesList = _Object$keys__default["default"](applicationTypes);
234
230
  if (!_includesInstanceProperty__default["default"](_context = _Object$values__default["default"](applicationTypesList)).call(_context, applicationType)) {
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\"."));
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".`);
237
232
  }
238
233
  };
239
234
  const throwIfTemplateIsNotSupported = templateName => {
@@ -243,22 +238,19 @@ const throwIfTemplateIsNotSupported = templateName => {
243
238
  break;
244
239
  default:
245
240
  {
246
- var _context3;
247
241
  const templateNamesList = _Object$keys__default["default"](availableTemplates).toString();
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\"."));
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".`);
249
243
  }
250
244
  }
251
245
  };
252
246
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
253
247
  if (doesFileExist(dirPath)) {
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."));
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.`);
256
249
  }
257
250
  };
258
251
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
259
252
  if (!doesFileExist(templateFolderPath)) {
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"));
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`);
262
254
  }
263
255
  // In case the version is semver (usually release tags) we check that
264
256
  // the cloned repository contains the template matching the given version
@@ -268,52 +260,48 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
268
260
  }));
269
261
  const versionAsNumber = versionToCheck.replace('v', '');
270
262
  if (templatePackageJson.version !== versionAsNumber) {
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"));
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`);
273
264
  }
274
265
  }
275
266
  };
276
267
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
277
268
  if (!initialProjectKey) {
278
- throw new Error("Provide a valid project key that you have access to.");
269
+ throw new Error(`Provide a valid project key that you have access to.`);
279
270
  }
280
271
  };
281
272
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
282
273
  const hasValidNodeVersion = semver__default["default"].satisfies(currentNodeVersion, expectedVersionRange);
283
274
  if (!hasValidNodeVersion) {
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."));
275
+ throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
286
276
  }
287
277
  };
288
278
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
289
279
  const allowedCloudIdentifiers = _Object$values__default["default"](applicationConfig.CLOUD_IDENTIFIERS);
290
280
  if (!_includesInstanceProperty__default["default"](allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
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(', '), "."));
281
+ throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
293
282
  }
294
283
  };
295
284
 
296
285
  const question = (rl, value) => new _Promise__default["default"](resolve => rl.question(value, resolve));
297
286
  const getEntryPointUriPath = async (rl, options) => {
298
- var _context;
299
287
  if (options.applicationType === applicationTypes['custom-view']) {
300
288
  return;
301
289
  }
302
290
  if (options.entryPointUriPath) {
303
291
  return options.entryPointUriPath;
304
292
  }
305
- const randomEntryPointUriPath = _concatInstanceProperty__default["default"](_context = "".concat(options.template, "-")).call(_context, crypto__default["default"].randomBytes(3).toString('hex'));
293
+ const randomEntryPointUriPath = `${options.template}-${crypto__default["default"].randomBytes(3).toString('hex')}`;
306
294
  if (options.yes) {
307
295
  return randomEntryPointUriPath;
308
296
  }
309
- const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
297
+ const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
310
298
  return answerEntryPointUriPath || randomEntryPointUriPath;
311
299
  };
312
300
  const getInitialProjectKey = async (rl, options) => {
313
301
  if (options.initialProjectKey) {
314
302
  return options.initialProjectKey;
315
303
  }
316
- const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
304
+ const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
317
305
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
318
306
  return initialProjectKey;
319
307
  };
@@ -340,7 +328,7 @@ async function processOptions(projectDirectoryName, options) {
340
328
 
341
329
  // Parse options
342
330
  let tagOrBranchVersion = options.templateVersion || 'main';
343
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
331
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
344
332
  const templateName = options.template;
345
333
 
346
334
  // Validate options
@@ -385,16 +373,15 @@ function downloadTemplate(options) {
385
373
  return {
386
374
  title: 'Downloading template',
387
375
  task: () => {
388
- var _context;
389
376
  const clonedRepositoryPath = options.clonedRepositoryPath;
390
377
  const tmpDir = path__default["default"].dirname(clonedRepositoryPath);
391
378
  const tmpFolderNameForClonedRepository = path__default["default"].basename(clonedRepositoryPath);
392
379
  const templateFolderPath = path__default["default"].join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
393
380
  return new listr2.Listr([{
394
- title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
381
+ title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
395
382
  task: async () => {
396
383
  // Shallow clone repository
397
- const result = await execa__default["default"]('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
384
+ const result = await execa__default["default"]('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
398
385
  cwd: tmpDir,
399
386
  encoding: 'utf-8'
400
387
  });
@@ -405,7 +392,7 @@ function downloadTemplate(options) {
405
392
  return result.stdout;
406
393
  }
407
394
  }, {
408
- title: _concatInstanceProperty__default["default"](_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
395
+ title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
409
396
  task: async () => {
410
397
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
411
398
  const result = await execa__default["default"](command, [templateFolderPath,
@@ -418,12 +405,12 @@ function downloadTemplate(options) {
418
405
  }
419
406
  const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
420
407
  if (!doesFileExist(templatePackageJsonPath)) {
421
- throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
408
+ throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
422
409
  }
423
410
  return result.stdout;
424
411
  }
425
412
  }, {
426
- title: "Cleaning up project directory",
413
+ title: `Cleaning up project directory`,
427
414
  task: async () => {
428
415
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
429
416
  const result = await execa__default["default"](command, _mapInstanceProperty__default["default"](filesToBeRemoved).call(filesToBeRemoved, filePath => path__default["default"].join(options.projectDirectoryPath, filePath)), {
@@ -462,7 +449,7 @@ function installDependencies(options) {
462
449
  }
463
450
 
464
451
  function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
465
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
452
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
466
453
 
467
454
  // Catalog references in workspace package.json files point at entries in
468
455
  // pnpm-workspace.yaml. They have to be flattened to concrete version
@@ -474,14 +461,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
474
461
  // share one code path.
475
462
 
476
463
  function parseCatalogs(yamlText) {
477
- var _parseYaml;
478
- const doc = (_parseYaml = yaml.parse(yamlText)) !== null && _parseYaml !== void 0 ? _parseYaml : {};
464
+ const doc = yaml.parse(yamlText) ?? {};
479
465
  const out = new _Map__default["default"]();
480
466
  if (doc.catalog) {
481
467
  out.set('default', new _Map__default["default"](_Object$entries__default["default"](doc.catalog)));
482
468
  }
483
- for (const _ref of _Object$entries__default["default"]((_doc$catalogs = doc.catalogs) !== null && _doc$catalogs !== void 0 ? _doc$catalogs : {})) {
484
- var _doc$catalogs;
469
+ for (const _ref of _Object$entries__default["default"](doc.catalogs ?? {})) {
485
470
  var _ref2 = _slicedToArray(_ref, 2);
486
471
  const name = _ref2[0];
487
472
  const entries = _ref2[1];
@@ -495,8 +480,8 @@ function parseCatalogs(yamlText) {
495
480
  // logic — extend the table to handle new protocol additions.
496
481
  const WORKSPACE_REWRITERS = {
497
482
  'workspace:*': v => v,
498
- 'workspace:^': v => "^".concat(v),
499
- 'workspace:~': v => "~".concat(v)
483
+ 'workspace:^': v => `^${v}`,
484
+ 'workspace:~': v => `~${v}`
500
485
  };
501
486
 
502
487
  /**
@@ -513,14 +498,12 @@ function resolveCatalogRef(spec, depName, catalogs) {
513
498
  const name = spec === 'catalog:' || spec === 'catalog:default' ? 'default' : _sliceInstanceProperty__default["default"](spec).call(spec, 'catalog:'.length);
514
499
  const block = catalogs.get(name);
515
500
  if (!block) {
516
- var _context, _context2;
517
- throw new Error(_concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context2, depName, "\": catalog \"")).call(_context, name, "\" is not declared in the template's pnpm-workspace.yaml."));
501
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": catalog "${name}" is not declared in the template's pnpm-workspace.yaml.`);
518
502
  }
519
503
  const resolved = block.get(depName);
520
504
  if (!resolved) {
521
- var _context3, _context4;
522
- const where = name === 'default' ? 'the default catalog' : "catalogs.".concat(name);
523
- throw new Error(_concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context4, depName, "\": dep is not declared under ")).call(_context3, where, " in the template's pnpm-workspace.yaml."));
505
+ const where = name === 'default' ? 'the default catalog' : `catalogs.${name}`;
506
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": dep is not declared under ${where} in the template's pnpm-workspace.yaml.`);
524
507
  }
525
508
  return resolved;
526
509
  }
@@ -600,8 +583,7 @@ function updatePackageJson(options, releaseVersion) {
600
583
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
601
584
  const result = core.transformFileSync(filePath, {
602
585
  plugins: [function replaceConfig() {
603
- var _options$entryPointUr;
604
- const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
586
+ const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
605
587
  return {
606
588
  visitor: {
607
589
  Identifier(nodePath) {
@@ -636,9 +618,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
636
618
  }],
637
619
  retainLines: true
638
620
  });
639
- if (result !== null && result !== void 0 && result.code) {
621
+ if (result?.code) {
640
622
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
641
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
623
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
642
624
  fs__default["default"].writeFileSync(filePath, formattedData, {
643
625
  encoding: 'utf8'
644
626
  });
@@ -651,7 +633,7 @@ function getApplicationConfigName(options) {
651
633
  case applicationTypes['custom-view']:
652
634
  return 'custom-view-config';
653
635
  default:
654
- throw new Error("Unknown application type ".concat(options.applicationType));
636
+ throw new Error(`Unknown application type ${options.applicationType}`);
655
637
  }
656
638
  }
657
639
  function updateApplicationConfig(options) {
@@ -679,9 +661,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
679
661
  }],
680
662
  retainLines: true
681
663
  });
682
- if (result !== null && result !== void 0 && result.code) {
664
+ if (result?.code) {
683
665
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
684
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
666
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
685
667
  fs__default["default"].writeFileSync(filePath, formattedData, {
686
668
  encoding: 'utf8'
687
669
  });
@@ -718,7 +700,7 @@ const messagesByApplicationType = {
718
700
  const run = () => {
719
701
  // Default command
720
702
  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) => {
721
- var _context, _context2;
703
+ var _context;
722
704
  const releaseVersion = await getLatestReleaseVersion();
723
705
  hintOutdatedVersion(pkgJson.version, releaseVersion);
724
706
  const taskOptions = await processOptions(projectDirectory, options);
@@ -733,16 +715,16 @@ const run = () => {
733
715
  await taskList.run();
734
716
  const packageManager = getPreferredPackageManager(taskOptions);
735
717
  console.log('');
736
- 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."));
718
+ console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
737
719
  console.log('');
738
- console.log("To get started:");
739
- console.log("$ cd ".concat(taskOptions.projectDirectoryName));
720
+ console.log(`To get started:`);
721
+ console.log(`$ cd ${taskOptions.projectDirectoryName}`);
740
722
  if (!shouldInstallDependencies) {
741
- console.log("$ ".concat(packageManager, " install"));
723
+ console.log(`$ ${packageManager} install`);
742
724
  }
743
- console.log("$ ".concat(packageManager, " start"));
725
+ console.log(`$ ${packageManager} start`);
744
726
  console.log('');
745
- console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
727
+ console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
746
728
  });
747
729
  commander.program.parse();
748
730
  };
@@ -3,7 +3,6 @@
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');
7
6
  var commander = require('commander');
8
7
  var listr2 = require('listr2');
9
8
  var execa = require('execa');
@@ -42,7 +41,6 @@ var prettier = require('prettier');
42
41
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
43
42
 
44
43
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
45
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
46
44
  var execa__default = /*#__PURE__*/_interopDefault(execa);
47
45
  var semver__default = /*#__PURE__*/_interopDefault(semver);
48
46
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
@@ -73,7 +71,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
73
71
 
74
72
  var pkgJson = {
75
73
  name: "@commercetools-frontend/create-mc-app",
76
- version: "27.9.1",
74
+ version: "27.9.2",
77
75
  description: "Create Merchant Center applications to quickly get up and running",
78
76
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
79
77
  repository: {
@@ -138,11 +136,10 @@ async function getLatestReleaseVersion() {
138
136
  function hintOutdatedVersion(currentVersion, releaseVersion) {
139
137
  var _context;
140
138
  const hasBeenReleastedInLatestTag = semver__default["default"].gt(releaseVersion, currentVersion);
141
- const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
139
+ const hintNewerVersions = _filterInstanceProperty__default["default"](_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
142
140
  if (hintNewerVersions.length > 0) {
143
- var _context2;
144
141
  console.log('');
145
- console.log(_concatInstanceProperty__default["default"](_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
142
+ console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
146
143
  console.log('');
147
144
  }
148
145
  }
@@ -209,7 +206,7 @@ const getInstallCommand = options => {
209
206
  case 'npm':
210
207
  return 'npm install --legacy-peer-deps';
211
208
  default:
212
- return "".concat(packageManager, " install");
209
+ return `${packageManager} install`;
213
210
  }
214
211
  };
215
212
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -219,21 +216,19 @@ const wordify = slug => {
219
216
  return _mapInstanceProperty__default["default"](_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
220
217
  };
221
218
  const resolveFilePathByExtension = requestedModule => {
222
- var _context3, _context5;
219
+ var _context3;
223
220
  const fileExtension = _findInstanceProperty__default["default"](_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
224
- var _context4;
225
- const filePath = _concatInstanceProperty__default["default"](_context4 = "".concat(requestedModule)).call(_context4, ext);
221
+ const filePath = `${requestedModule}${ext}`;
226
222
  return doesFileExist(filePath);
227
223
  });
228
- return _concatInstanceProperty__default["default"](_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
224
+ return `${requestedModule}${fileExtension}`;
229
225
  };
230
226
 
231
227
  const throwIfApplicationTypeIsNotSupported = applicationType => {
232
228
  var _context;
233
229
  const applicationTypesList = _Object$keys__default["default"](applicationTypes);
234
230
  if (!_includesInstanceProperty__default["default"](_context = _Object$values__default["default"](applicationTypesList)).call(_context, applicationType)) {
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\"."));
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".`);
237
232
  }
238
233
  };
239
234
  const throwIfTemplateIsNotSupported = templateName => {
@@ -243,22 +238,19 @@ const throwIfTemplateIsNotSupported = templateName => {
243
238
  break;
244
239
  default:
245
240
  {
246
- var _context3;
247
241
  const templateNamesList = _Object$keys__default["default"](availableTemplates).toString();
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\"."));
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".`);
249
243
  }
250
244
  }
251
245
  };
252
246
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
253
247
  if (doesFileExist(dirPath)) {
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."));
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.`);
256
249
  }
257
250
  };
258
251
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
259
252
  if (!doesFileExist(templateFolderPath)) {
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"));
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`);
262
254
  }
263
255
  // In case the version is semver (usually release tags) we check that
264
256
  // the cloned repository contains the template matching the given version
@@ -268,52 +260,48 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
268
260
  }));
269
261
  const versionAsNumber = versionToCheck.replace('v', '');
270
262
  if (templatePackageJson.version !== versionAsNumber) {
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"));
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`);
273
264
  }
274
265
  }
275
266
  };
276
267
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
277
268
  if (!initialProjectKey) {
278
- throw new Error("Provide a valid project key that you have access to.");
269
+ throw new Error(`Provide a valid project key that you have access to.`);
279
270
  }
280
271
  };
281
272
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
282
273
  const hasValidNodeVersion = semver__default["default"].satisfies(currentNodeVersion, expectedVersionRange);
283
274
  if (!hasValidNodeVersion) {
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."));
275
+ throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
286
276
  }
287
277
  };
288
278
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
289
279
  const allowedCloudIdentifiers = _Object$values__default["default"](applicationConfig.CLOUD_IDENTIFIERS);
290
280
  if (!_includesInstanceProperty__default["default"](allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
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(', '), "."));
281
+ throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
293
282
  }
294
283
  };
295
284
 
296
285
  const question = (rl, value) => new _Promise__default["default"](resolve => rl.question(value, resolve));
297
286
  const getEntryPointUriPath = async (rl, options) => {
298
- var _context;
299
287
  if (options.applicationType === applicationTypes['custom-view']) {
300
288
  return;
301
289
  }
302
290
  if (options.entryPointUriPath) {
303
291
  return options.entryPointUriPath;
304
292
  }
305
- const randomEntryPointUriPath = _concatInstanceProperty__default["default"](_context = "".concat(options.template, "-")).call(_context, crypto__default["default"].randomBytes(3).toString('hex'));
293
+ const randomEntryPointUriPath = `${options.template}-${crypto__default["default"].randomBytes(3).toString('hex')}`;
306
294
  if (options.yes) {
307
295
  return randomEntryPointUriPath;
308
296
  }
309
- const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
297
+ const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
310
298
  return answerEntryPointUriPath || randomEntryPointUriPath;
311
299
  };
312
300
  const getInitialProjectKey = async (rl, options) => {
313
301
  if (options.initialProjectKey) {
314
302
  return options.initialProjectKey;
315
303
  }
316
- const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
304
+ const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
317
305
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
318
306
  return initialProjectKey;
319
307
  };
@@ -340,7 +328,7 @@ async function processOptions(projectDirectoryName, options) {
340
328
 
341
329
  // Parse options
342
330
  let tagOrBranchVersion = options.templateVersion || 'main';
343
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
331
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty__default["default"](tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
344
332
  const templateName = options.template;
345
333
 
346
334
  // Validate options
@@ -385,16 +373,15 @@ function downloadTemplate(options) {
385
373
  return {
386
374
  title: 'Downloading template',
387
375
  task: () => {
388
- var _context;
389
376
  const clonedRepositoryPath = options.clonedRepositoryPath;
390
377
  const tmpDir = path__default["default"].dirname(clonedRepositoryPath);
391
378
  const tmpFolderNameForClonedRepository = path__default["default"].basename(clonedRepositoryPath);
392
379
  const templateFolderPath = path__default["default"].join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
393
380
  return new listr2.Listr([{
394
- title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
381
+ title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
395
382
  task: async () => {
396
383
  // Shallow clone repository
397
- const result = await execa__default["default"]('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
384
+ const result = await execa__default["default"]('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
398
385
  cwd: tmpDir,
399
386
  encoding: 'utf-8'
400
387
  });
@@ -405,7 +392,7 @@ function downloadTemplate(options) {
405
392
  return result.stdout;
406
393
  }
407
394
  }, {
408
- title: _concatInstanceProperty__default["default"](_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
395
+ title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
409
396
  task: async () => {
410
397
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
411
398
  const result = await execa__default["default"](command, [templateFolderPath,
@@ -418,12 +405,12 @@ function downloadTemplate(options) {
418
405
  }
419
406
  const templatePackageJsonPath = path__default["default"].join(options.projectDirectoryPath, 'package.json');
420
407
  if (!doesFileExist(templatePackageJsonPath)) {
421
- throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
408
+ throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
422
409
  }
423
410
  return result.stdout;
424
411
  }
425
412
  }, {
426
- title: "Cleaning up project directory",
413
+ title: `Cleaning up project directory`,
427
414
  task: async () => {
428
415
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
429
416
  const result = await execa__default["default"](command, _mapInstanceProperty__default["default"](filesToBeRemoved).call(filesToBeRemoved, filePath => path__default["default"].join(options.projectDirectoryPath, filePath)), {
@@ -462,7 +449,7 @@ function installDependencies(options) {
462
449
  }
463
450
 
464
451
  function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
465
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
452
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
466
453
 
467
454
  // Catalog references in workspace package.json files point at entries in
468
455
  // pnpm-workspace.yaml. They have to be flattened to concrete version
@@ -474,14 +461,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
474
461
  // share one code path.
475
462
 
476
463
  function parseCatalogs(yamlText) {
477
- var _parseYaml;
478
- const doc = (_parseYaml = yaml.parse(yamlText)) !== null && _parseYaml !== void 0 ? _parseYaml : {};
464
+ const doc = yaml.parse(yamlText) ?? {};
479
465
  const out = new _Map__default["default"]();
480
466
  if (doc.catalog) {
481
467
  out.set('default', new _Map__default["default"](_Object$entries__default["default"](doc.catalog)));
482
468
  }
483
- for (const _ref of _Object$entries__default["default"]((_doc$catalogs = doc.catalogs) !== null && _doc$catalogs !== void 0 ? _doc$catalogs : {})) {
484
- var _doc$catalogs;
469
+ for (const _ref of _Object$entries__default["default"](doc.catalogs ?? {})) {
485
470
  var _ref2 = _slicedToArray(_ref, 2);
486
471
  const name = _ref2[0];
487
472
  const entries = _ref2[1];
@@ -495,8 +480,8 @@ function parseCatalogs(yamlText) {
495
480
  // logic — extend the table to handle new protocol additions.
496
481
  const WORKSPACE_REWRITERS = {
497
482
  'workspace:*': v => v,
498
- 'workspace:^': v => "^".concat(v),
499
- 'workspace:~': v => "~".concat(v)
483
+ 'workspace:^': v => `^${v}`,
484
+ 'workspace:~': v => `~${v}`
500
485
  };
501
486
 
502
487
  /**
@@ -513,14 +498,12 @@ function resolveCatalogRef(spec, depName, catalogs) {
513
498
  const name = spec === 'catalog:' || spec === 'catalog:default' ? 'default' : _sliceInstanceProperty__default["default"](spec).call(spec, 'catalog:'.length);
514
499
  const block = catalogs.get(name);
515
500
  if (!block) {
516
- var _context, _context2;
517
- throw new Error(_concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context2, depName, "\": catalog \"")).call(_context, name, "\" is not declared in the template's pnpm-workspace.yaml."));
501
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": catalog "${name}" is not declared in the template's pnpm-workspace.yaml.`);
518
502
  }
519
503
  const resolved = block.get(depName);
520
504
  if (!resolved) {
521
- var _context3, _context4;
522
- const where = name === 'default' ? 'the default catalog' : "catalogs.".concat(name);
523
- throw new Error(_concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context4, depName, "\": dep is not declared under ")).call(_context3, where, " in the template's pnpm-workspace.yaml."));
505
+ const where = name === 'default' ? 'the default catalog' : `catalogs.${name}`;
506
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": dep is not declared under ${where} in the template's pnpm-workspace.yaml.`);
524
507
  }
525
508
  return resolved;
526
509
  }
@@ -600,8 +583,7 @@ function updatePackageJson(options, releaseVersion) {
600
583
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
601
584
  const result = core.transformFileSync(filePath, {
602
585
  plugins: [function replaceConfig() {
603
- var _options$entryPointUr;
604
- const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
586
+ const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
605
587
  return {
606
588
  visitor: {
607
589
  Identifier(nodePath) {
@@ -636,9 +618,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
636
618
  }],
637
619
  retainLines: true
638
620
  });
639
- if (result !== null && result !== void 0 && result.code) {
621
+ if (result?.code) {
640
622
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
641
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
623
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
642
624
  fs__default["default"].writeFileSync(filePath, formattedData, {
643
625
  encoding: 'utf8'
644
626
  });
@@ -651,7 +633,7 @@ function getApplicationConfigName(options) {
651
633
  case applicationTypes['custom-view']:
652
634
  return 'custom-view-config';
653
635
  default:
654
- throw new Error("Unknown application type ".concat(options.applicationType));
636
+ throw new Error(`Unknown application type ${options.applicationType}`);
655
637
  }
656
638
  }
657
639
  function updateApplicationConfig(options) {
@@ -679,9 +661,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
679
661
  }],
680
662
  retainLines: true
681
663
  });
682
- if (result !== null && result !== void 0 && result.code) {
664
+ if (result?.code) {
683
665
  const prettierConfig = prettier__default["default"].resolveConfig.sync(options.projectDirectoryPath);
684
- const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
666
+ const formattedData = prettier__default["default"].format(result.code + os__default["default"].EOL, prettierConfig ?? undefined);
685
667
  fs__default["default"].writeFileSync(filePath, formattedData, {
686
668
  encoding: 'utf8'
687
669
  });
@@ -718,7 +700,7 @@ const messagesByApplicationType = {
718
700
  const run = () => {
719
701
  // Default command
720
702
  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) => {
721
- var _context, _context2;
703
+ var _context;
722
704
  const releaseVersion = await getLatestReleaseVersion();
723
705
  hintOutdatedVersion(pkgJson.version, releaseVersion);
724
706
  const taskOptions = await processOptions(projectDirectory, options);
@@ -733,16 +715,16 @@ const run = () => {
733
715
  await taskList.run();
734
716
  const packageManager = getPreferredPackageManager(taskOptions);
735
717
  console.log('');
736
- 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."));
718
+ console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
737
719
  console.log('');
738
- console.log("To get started:");
739
- console.log("$ cd ".concat(taskOptions.projectDirectoryName));
720
+ console.log(`To get started:`);
721
+ console.log(`$ cd ${taskOptions.projectDirectoryName}`);
740
722
  if (!shouldInstallDependencies) {
741
- console.log("$ ".concat(packageManager, " install"));
723
+ console.log(`$ ${packageManager} install`);
742
724
  }
743
- console.log("$ ".concat(packageManager, " start"));
725
+ console.log(`$ ${packageManager} start`);
744
726
  console.log('');
745
- console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
727
+ console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
746
728
  });
747
729
  commander.program.parse();
748
730
  };
@@ -1,5 +1,4 @@
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';
3
2
  import { program } from 'commander';
4
3
  import { Listr } from 'listr2';
5
4
  import execa from 'execa';
@@ -37,7 +36,7 @@ import prettier from 'prettier';
37
36
 
38
37
  var pkgJson = {
39
38
  name: "@commercetools-frontend/create-mc-app",
40
- version: "27.9.1",
39
+ version: "27.9.2",
41
40
  description: "Create Merchant Center applications to quickly get up and running",
42
41
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
43
42
  repository: {
@@ -102,11 +101,10 @@ async function getLatestReleaseVersion() {
102
101
  function hintOutdatedVersion(currentVersion, releaseVersion) {
103
102
  var _context;
104
103
  const hasBeenReleastedInLatestTag = semver.gt(releaseVersion, currentVersion);
105
- const hintNewerVersions = _filterInstanceProperty(_context = [hasBeenReleastedInLatestTag && "".concat(releaseVersion)]).call(_context, Boolean).join(', ');
104
+ const hintNewerVersions = _filterInstanceProperty(_context = [hasBeenReleastedInLatestTag && `${releaseVersion}`]).call(_context, Boolean).join(', ');
106
105
  if (hintNewerVersions.length > 0) {
107
- var _context2;
108
106
  console.log('');
109
- console.log(_concatInstanceProperty(_context2 = "New version available! ".concat(currentVersion, " -> ")).call(_context2, hintNewerVersions));
107
+ console.log(`New version available! ${currentVersion} -> ${hintNewerVersions}`);
110
108
  console.log('');
111
109
  }
112
110
  }
@@ -173,7 +171,7 @@ const getInstallCommand = options => {
173
171
  case 'npm':
174
172
  return 'npm install --legacy-peer-deps';
175
173
  default:
176
- return "".concat(packageManager, " install");
174
+ return `${packageManager} install`;
177
175
  }
178
176
  };
179
177
  const slugify = name => name.toLowerCase().replace(/_/gi, '-');
@@ -183,21 +181,19 @@ const wordify = slug => {
183
181
  return _mapInstanceProperty(_context2 = slug.split('-')).call(_context2, word => upperFirst(word)).join(' ');
184
182
  };
185
183
  const resolveFilePathByExtension = requestedModule => {
186
- var _context3, _context5;
184
+ var _context3;
187
185
  const fileExtension = _findInstanceProperty(_context3 = ['.js', '.ts', '.mjs', '.cjs']).call(_context3, ext => {
188
- var _context4;
189
- const filePath = _concatInstanceProperty(_context4 = "".concat(requestedModule)).call(_context4, ext);
186
+ const filePath = `${requestedModule}${ext}`;
190
187
  return doesFileExist(filePath);
191
188
  });
192
- return _concatInstanceProperty(_context5 = "".concat(requestedModule)).call(_context5, fileExtension);
189
+ return `${requestedModule}${fileExtension}`;
193
190
  };
194
191
 
195
192
  const throwIfApplicationTypeIsNotSupported = applicationType => {
196
193
  var _context;
197
194
  const applicationTypesList = _Object$keys(applicationTypes);
198
195
  if (!_includesInstanceProperty(_context = _Object$values(applicationTypesList)).call(_context, applicationType)) {
199
- var _context2;
200
- 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
+ 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".`);
201
197
  }
202
198
  };
203
199
  const throwIfTemplateIsNotSupported = templateName => {
@@ -207,22 +203,19 @@ const throwIfTemplateIsNotSupported = templateName => {
207
203
  break;
208
204
  default:
209
205
  {
210
- var _context3;
211
206
  const templateNamesList = _Object$keys(availableTemplates).toString();
212
- 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
+ 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".`);
213
208
  }
214
209
  }
215
210
  };
216
211
  const throwIfProjectDirectoryExists = (dirName, dirPath) => {
217
212
  if (doesFileExist(dirPath)) {
218
- var _context4;
219
- 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
+ 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.`);
220
214
  }
221
215
  };
222
216
  const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, versionToCheck) => {
223
217
  if (!doesFileExist(templateFolderPath)) {
224
- var _context5;
225
- 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
+ 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`);
226
219
  }
227
220
  // In case the version is semver (usually release tags) we check that
228
221
  // the cloned repository contains the template matching the given version
@@ -232,52 +225,48 @@ const throwIfTemplateVersionDoesNotExist = (templateName, templateFolderPath, ve
232
225
  }));
233
226
  const versionAsNumber = versionToCheck.replace('v', '');
234
227
  if (templatePackageJson.version !== versionAsNumber) {
235
- var _context6, _context7;
236
- 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
+ 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`);
237
229
  }
238
230
  }
239
231
  };
240
232
  const throwIfInitialProjectKeyIsMissing = initialProjectKey => {
241
233
  if (!initialProjectKey) {
242
- throw new Error("Provide a valid project key that you have access to.");
234
+ throw new Error(`Provide a valid project key that you have access to.`);
243
235
  }
244
236
  };
245
237
  const throwIfNodeVersionIsNotSupported = (currentNodeVersion, expectedVersionRange) => {
246
238
  const hasValidNodeVersion = semver.satisfies(currentNodeVersion, expectedVersionRange);
247
239
  if (!hasValidNodeVersion) {
248
- var _context8;
249
- 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
+ throw new Error(`You are running Node ${currentNodeVersion} but create-mc-app requires Node ${expectedVersionRange}. Please update your version of Node.`);
250
241
  }
251
242
  };
252
243
  const throwIfCloudIdentifierIsNotSupported = cloudIdentifier => {
253
244
  const allowedCloudIdentifiers = _Object$values(CLOUD_IDENTIFIERS);
254
245
  if (!_includesInstanceProperty(allowedCloudIdentifiers).call(allowedCloudIdentifiers, cloudIdentifier)) {
255
- var _context9;
256
- throw new Error(_concatInstanceProperty(_context9 = "The cloud region \"".concat(cloudIdentifier, "\" is not supported. Supported regions are: ")).call(_context9, allowedCloudIdentifiers.join(', '), "."));
246
+ throw new Error(`The cloud region "${cloudIdentifier}" is not supported. Supported regions are: ${allowedCloudIdentifiers.join(', ')}.`);
257
247
  }
258
248
  };
259
249
 
260
250
  const question = (rl, value) => new _Promise(resolve => rl.question(value, resolve));
261
251
  const getEntryPointUriPath = async (rl, options) => {
262
- var _context;
263
252
  if (options.applicationType === applicationTypes['custom-view']) {
264
253
  return;
265
254
  }
266
255
  if (options.entryPointUriPath) {
267
256
  return options.entryPointUriPath;
268
257
  }
269
- const randomEntryPointUriPath = _concatInstanceProperty(_context = "".concat(options.template, "-")).call(_context, crypto.randomBytes(3).toString('hex'));
258
+ const randomEntryPointUriPath = `${options.template}-${crypto.randomBytes(3).toString('hex')}`;
270
259
  if (options.yes) {
271
260
  return randomEntryPointUriPath;
272
261
  }
273
- const answerEntryPointUriPath = await question(rl, "Provide the Custom Application entryPointUriPath (default \"".concat(randomEntryPointUriPath, "\"): "));
262
+ const answerEntryPointUriPath = await question(rl, `Provide the Custom Application entryPointUriPath (default "${randomEntryPointUriPath}"): `);
274
263
  return answerEntryPointUriPath || randomEntryPointUriPath;
275
264
  };
276
265
  const getInitialProjectKey = async (rl, options) => {
277
266
  if (options.initialProjectKey) {
278
267
  return options.initialProjectKey;
279
268
  }
280
- const initialProjectKey = await question(rl, "Provide the initial project key for local development: ");
269
+ const initialProjectKey = await question(rl, `Provide the initial project key for local development: `);
281
270
  throwIfInitialProjectKeyIsMissing(initialProjectKey);
282
271
  return initialProjectKey;
283
272
  };
@@ -304,7 +293,7 @@ async function processOptions(projectDirectoryName, options) {
304
293
 
305
294
  // Parse options
306
295
  let tagOrBranchVersion = options.templateVersion || 'main';
307
- tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty(tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? "v".concat(tagOrBranchVersion) : tagOrBranchVersion;
296
+ tagOrBranchVersion = isSemVer(tagOrBranchVersion) && !_startsWithInstanceProperty(tagOrBranchVersion).call(tagOrBranchVersion, 'v') ? `v${tagOrBranchVersion}` : tagOrBranchVersion;
308
297
  const templateName = options.template;
309
298
 
310
299
  // Validate options
@@ -349,16 +338,15 @@ function downloadTemplate(options) {
349
338
  return {
350
339
  title: 'Downloading template',
351
340
  task: () => {
352
- var _context;
353
341
  const clonedRepositoryPath = options.clonedRepositoryPath;
354
342
  const tmpDir = path.dirname(clonedRepositoryPath);
355
343
  const tmpFolderNameForClonedRepository = path.basename(clonedRepositoryPath);
356
344
  const templateFolderPath = path.join(clonedRepositoryPath, options.applicationType === applicationTypes['custom-view'] ? 'custom-views-templates' : 'application-templates', options.templateName);
357
345
  return new Listr([{
358
- title: "Cloning repository using branch ".concat(options.tagOrBranchVersion),
346
+ title: `Cloning repository using branch ${options.tagOrBranchVersion}`,
359
347
  task: async () => {
360
348
  // Shallow clone repository
361
- const result = await execa('git', ['clone', "--branch=".concat(options.tagOrBranchVersion), '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
349
+ const result = await execa('git', ['clone', `--branch=${options.tagOrBranchVersion}`, '--depth=1', 'https://github.com/commercetools/merchant-center-application-kit.git', tmpFolderNameForClonedRepository], {
362
350
  cwd: tmpDir,
363
351
  encoding: 'utf-8'
364
352
  });
@@ -369,7 +357,7 @@ function downloadTemplate(options) {
369
357
  return result.stdout;
370
358
  }
371
359
  }, {
372
- title: _concatInstanceProperty(_context = "Copying template ".concat(options.templateName, " into project directory ")).call(_context, options.projectDirectoryPath),
360
+ title: `Copying template ${options.templateName} into project directory ${options.projectDirectoryPath}`,
373
361
  task: async () => {
374
362
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'move' : 'mv';
375
363
  const result = await execa(command, [templateFolderPath,
@@ -382,12 +370,12 @@ function downloadTemplate(options) {
382
370
  }
383
371
  const templatePackageJsonPath = path.join(options.projectDirectoryPath, 'package.json');
384
372
  if (!doesFileExist(templatePackageJsonPath)) {
385
- throw new Error("Unable to verify that the template application has a package.json at \"".concat(templatePackageJsonPath, "\""));
373
+ throw new Error(`Unable to verify that the template application has a package.json at "${templatePackageJsonPath}"`);
386
374
  }
387
375
  return result.stdout;
388
376
  }
389
377
  }, {
390
- title: "Cleaning up project directory",
378
+ title: `Cleaning up project directory`,
391
379
  task: async () => {
392
380
  const command = process.platform === 'win32' || process.platform === 'cygwin' ? 'del' : 'rm';
393
381
  const result = await execa(command, _mapInstanceProperty(filesToBeRemoved).call(filesToBeRemoved, filePath => path.join(options.projectDirectoryPath, filePath)), {
@@ -426,7 +414,7 @@ function installDependencies(options) {
426
414
  }
427
415
 
428
416
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
429
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
417
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
430
418
 
431
419
  // Catalog references in workspace package.json files point at entries in
432
420
  // pnpm-workspace.yaml. They have to be flattened to concrete version
@@ -438,14 +426,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
438
426
  // share one code path.
439
427
 
440
428
  function parseCatalogs(yamlText) {
441
- var _parseYaml;
442
- const doc = (_parseYaml = parse(yamlText)) !== null && _parseYaml !== void 0 ? _parseYaml : {};
429
+ const doc = parse(yamlText) ?? {};
443
430
  const out = new _Map();
444
431
  if (doc.catalog) {
445
432
  out.set('default', new _Map(_Object$entries(doc.catalog)));
446
433
  }
447
- for (const _ref of _Object$entries((_doc$catalogs = doc.catalogs) !== null && _doc$catalogs !== void 0 ? _doc$catalogs : {})) {
448
- var _doc$catalogs;
434
+ for (const _ref of _Object$entries(doc.catalogs ?? {})) {
449
435
  var _ref2 = _slicedToArray(_ref, 2);
450
436
  const name = _ref2[0];
451
437
  const entries = _ref2[1];
@@ -459,8 +445,8 @@ function parseCatalogs(yamlText) {
459
445
  // logic — extend the table to handle new protocol additions.
460
446
  const WORKSPACE_REWRITERS = {
461
447
  'workspace:*': v => v,
462
- 'workspace:^': v => "^".concat(v),
463
- 'workspace:~': v => "~".concat(v)
448
+ 'workspace:^': v => `^${v}`,
449
+ 'workspace:~': v => `~${v}`
464
450
  };
465
451
 
466
452
  /**
@@ -477,14 +463,12 @@ function resolveCatalogRef(spec, depName, catalogs) {
477
463
  const name = spec === 'catalog:' || spec === 'catalog:default' ? 'default' : _sliceInstanceProperty(spec).call(spec, 'catalog:'.length);
478
464
  const block = catalogs.get(name);
479
465
  if (!block) {
480
- var _context, _context2;
481
- throw new Error(_concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context2, depName, "\": catalog \"")).call(_context, name, "\" is not declared in the template's pnpm-workspace.yaml."));
466
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": catalog "${name}" is not declared in the template's pnpm-workspace.yaml.`);
482
467
  }
483
468
  const resolved = block.get(depName);
484
469
  if (!resolved) {
485
- var _context3, _context4;
486
- const where = name === 'default' ? 'the default catalog' : "catalogs.".concat(name);
487
- throw new Error(_concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "Unable to resolve catalog reference \"".concat(spec, "\" for \"")).call(_context4, depName, "\": dep is not declared under ")).call(_context3, where, " in the template's pnpm-workspace.yaml."));
470
+ const where = name === 'default' ? 'the default catalog' : `catalogs.${name}`;
471
+ throw new Error(`Unable to resolve catalog reference "${spec}" for "${depName}": dep is not declared under ${where} in the template's pnpm-workspace.yaml.`);
488
472
  }
489
473
  return resolved;
490
474
  }
@@ -564,8 +548,7 @@ function updatePackageJson(options, releaseVersion) {
564
548
  function replaceApplicationInfoInApplicationConfig(filePath, options) {
565
549
  const result = transformFileSync(filePath, {
566
550
  plugins: [function replaceConfig() {
567
- var _options$entryPointUr;
568
- const appName = wordify((_options$entryPointUr = options.entryPointUriPath) !== null && _options$entryPointUr !== void 0 ? _options$entryPointUr : options.projectDirectoryName);
551
+ const appName = wordify(options.entryPointUriPath ?? options.projectDirectoryName);
569
552
  return {
570
553
  visitor: {
571
554
  Identifier(nodePath) {
@@ -600,9 +583,9 @@ function replaceApplicationInfoInApplicationConfig(filePath, options) {
600
583
  }],
601
584
  retainLines: true
602
585
  });
603
- if (result !== null && result !== void 0 && result.code) {
586
+ if (result?.code) {
604
587
  const prettierConfig = prettier.resolveConfig.sync(options.projectDirectoryPath);
605
- const formattedData = prettier.format(result.code + os.EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
588
+ const formattedData = prettier.format(result.code + os.EOL, prettierConfig ?? undefined);
606
589
  fs.writeFileSync(filePath, formattedData, {
607
590
  encoding: 'utf8'
608
591
  });
@@ -615,7 +598,7 @@ function getApplicationConfigName(options) {
615
598
  case applicationTypes['custom-view']:
616
599
  return 'custom-view-config';
617
600
  default:
618
- throw new Error("Unknown application type ".concat(options.applicationType));
601
+ throw new Error(`Unknown application type ${options.applicationType}`);
619
602
  }
620
603
  }
621
604
  function updateApplicationConfig(options) {
@@ -643,9 +626,9 @@ function replaceEntryPointUriPathInConstants(filePath, options) {
643
626
  }],
644
627
  retainLines: true
645
628
  });
646
- if (result !== null && result !== void 0 && result.code) {
629
+ if (result?.code) {
647
630
  const prettierConfig = prettier.resolveConfig.sync(options.projectDirectoryPath);
648
- const formattedData = prettier.format(result.code + os.EOL, prettierConfig !== null && prettierConfig !== void 0 ? prettierConfig : undefined);
631
+ const formattedData = prettier.format(result.code + os.EOL, prettierConfig ?? undefined);
649
632
  fs.writeFileSync(filePath, formattedData, {
650
633
  encoding: 'utf8'
651
634
  });
@@ -682,7 +665,7 @@ const messagesByApplicationType = {
682
665
  const run = () => {
683
666
  // Default command
684
667
  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) => {
685
- var _context, _context2;
668
+ var _context;
686
669
  const releaseVersion = await getLatestReleaseVersion();
687
670
  hintOutdatedVersion(pkgJson.version, releaseVersion);
688
671
  const taskOptions = await processOptions(projectDirectory, options);
@@ -697,16 +680,16 @@ const run = () => {
697
680
  await taskList.run();
698
681
  const packageManager = getPreferredPackageManager(taskOptions);
699
682
  console.log('');
700
- console.log(_concatInstanceProperty(_context2 = "\uD83C\uDF89 \uD83C\uDF89 \uD83C\uDF89 The ".concat(messages.featureName, " has been created in the \"")).call(_context2, taskOptions.projectDirectoryName, "\" folder."));
683
+ console.log(`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`);
701
684
  console.log('');
702
- console.log("To get started:");
703
- console.log("$ cd ".concat(taskOptions.projectDirectoryName));
685
+ console.log(`To get started:`);
686
+ console.log(`$ cd ${taskOptions.projectDirectoryName}`);
704
687
  if (!shouldInstallDependencies) {
705
- console.log("$ ".concat(packageManager, " install"));
688
+ console.log(`$ ${packageManager} install`);
706
689
  }
707
- console.log("$ ".concat(packageManager, " start"));
690
+ console.log(`$ ${packageManager} start`);
708
691
  console.log('');
709
- console.log("Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ".concat(messages.featureName, ". Enjoy \uD83D\uDE80"));
692
+ console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
710
693
  });
711
694
  program.parse();
712
695
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/create-mc-app",
3
- "version": "27.9.1",
3
+ "version": "27.9.2",
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": {
@@ -33,7 +33,7 @@
33
33
  "prettier": "2.8.8",
34
34
  "semver": "7.8.5",
35
35
  "yaml": "^2.6.1",
36
- "@commercetools-frontend/application-config": "^27.9.1"
36
+ "@commercetools-frontend/application-config": "^27.9.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node24": "^24.0.0",