@commercetools-frontend/create-mc-app 23.2.0 → 23.2.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,23 @@
1
1
  # @commercetools-frontend/create-mc-app
2
2
 
3
+ ## 23.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3749](https://github.com/commercetools/merchant-center-application-kit/pull/3749) [`e9cd323`](https://github.com/commercetools/merchant-center-application-kit/commit/e9cd3235c235304809bf3cfe336c3e3e3ab85468) Thanks [@emmenko](https://github.com/emmenko)! - Fix parsing of CLI arguments
8
+
9
+ - Updated dependencies []:
10
+ - @commercetools-frontend/application-config@23.2.2
11
+
12
+ ## 23.2.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#3739](https://github.com/commercetools/merchant-center-application-kit/pull/3739) [`9dba306`](https://github.com/commercetools/merchant-center-application-kit/commit/9dba306fd920a53a027e1a4ded112c1a09eaefc3) Thanks [@emmenko](https://github.com/emmenko)! - Migrate CLI program to `commander`.
17
+
18
+ - Updated dependencies []:
19
+ - @commercetools-frontend/application-config@23.2.1
20
+
3
21
  ## 23.2.0
4
22
 
5
23
  ### Patch Changes
@@ -3,7 +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 cac = require('cac');
6
+ var commander = require('commander');
7
7
  var listr2 = require('listr2');
8
8
  var execa = require('execa');
9
9
  var semver = require('semver');
@@ -70,7 +70,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
70
70
 
71
71
  var pkgJson = {
72
72
  name: "@commercetools-frontend/create-mc-app",
73
- version: "23.2.0",
73
+ version: "23.2.2",
74
74
  description: "Create Merchant Center applications to quickly get up and running",
75
75
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
76
76
  repository: {
@@ -96,10 +96,10 @@ var pkgJson = {
96
96
  "@babel/core": "^7.22.17",
97
97
  "@babel/runtime": "^7.22.15",
98
98
  "@babel/runtime-corejs3": "^7.22.15",
99
- "@commercetools-frontend/application-config": "^23.2.0",
99
+ "@commercetools-frontend/application-config": "^23.2.2",
100
100
  "@types/babel__core": "^7.20.1",
101
101
  "@types/semver": "^7.5.1",
102
- cac: "6.7.14",
102
+ commander: "^13.1.0",
103
103
  execa: "5.1.1",
104
104
  listr2: "5.0.8",
105
105
  prettier: "2.8.8",
@@ -551,7 +551,7 @@ function updateApplicationConstants(options) {
551
551
  }
552
552
 
553
553
  throwIfNodeVersionIsNotSupported(process.versions.node, pkgJson.engines.node);
554
- const cli = cac.cac('create-mc-app');
554
+ commander.program.name('create-mc-app').description('CLI to create a new Merchant Center customizations project based on the pre-defined templates.').version(pkgJson.version);
555
555
 
556
556
  // Makes the script crash on unhandled rejections instead of silently
557
557
  // ignoring them. In the future, promise rejections that are not handled will
@@ -569,22 +569,8 @@ const messagesByApplicationType = {
569
569
  };
570
570
  const run = () => {
571
571
  // Default command
572
- cli.command('[project-directory]').usage('[project-directory]\n\n Bootstraps a new project using one of the predefined templates.').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', {
573
- default: applicationTypes['custom-application']
574
- }).option('--template <name>', '(optional) The name of the template to install.', {
575
- default: availableTemplates.starter
576
- }).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).', {
577
- default: 'main'
578
- }).option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', {
579
- default: false
580
- }).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', {
581
- default: false
582
- }).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. (default: gcp-eu)').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
572
+ 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) => {
583
573
  var _context;
584
- if (!projectDirectory) {
585
- cli.outputHelp();
586
- return;
587
- }
588
574
  const releaseVersion = await getLatestReleaseVersion();
589
575
  hintOutdatedVersion(pkgJson.version, releaseVersion);
590
576
  const taskOptions = await processOptions(projectDirectory, options);
@@ -610,9 +596,7 @@ const run = () => {
610
596
  console.log('');
611
597
  console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
612
598
  });
613
- cli.help();
614
- cli.version(pkgJson.version);
615
- cli.parse();
599
+ commander.program.parse();
616
600
  };
617
601
 
618
602
  exports.cli = run;
@@ -3,7 +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 cac = require('cac');
6
+ var commander = require('commander');
7
7
  var listr2 = require('listr2');
8
8
  var execa = require('execa');
9
9
  var semver = require('semver');
@@ -70,7 +70,7 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
70
70
 
71
71
  var pkgJson = {
72
72
  name: "@commercetools-frontend/create-mc-app",
73
- version: "23.2.0",
73
+ version: "23.2.2",
74
74
  description: "Create Merchant Center applications to quickly get up and running",
75
75
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
76
76
  repository: {
@@ -96,10 +96,10 @@ var pkgJson = {
96
96
  "@babel/core": "^7.22.17",
97
97
  "@babel/runtime": "^7.22.15",
98
98
  "@babel/runtime-corejs3": "^7.22.15",
99
- "@commercetools-frontend/application-config": "^23.2.0",
99
+ "@commercetools-frontend/application-config": "^23.2.2",
100
100
  "@types/babel__core": "^7.20.1",
101
101
  "@types/semver": "^7.5.1",
102
- cac: "6.7.14",
102
+ commander: "^13.1.0",
103
103
  execa: "5.1.1",
104
104
  listr2: "5.0.8",
105
105
  prettier: "2.8.8",
@@ -551,7 +551,7 @@ function updateApplicationConstants(options) {
551
551
  }
552
552
 
553
553
  throwIfNodeVersionIsNotSupported(process.versions.node, pkgJson.engines.node);
554
- const cli = cac.cac('create-mc-app');
554
+ commander.program.name('create-mc-app').description('CLI to create a new Merchant Center customizations project based on the pre-defined templates.').version(pkgJson.version);
555
555
 
556
556
  // Makes the script crash on unhandled rejections instead of silently
557
557
  // ignoring them. In the future, promise rejections that are not handled will
@@ -569,22 +569,8 @@ const messagesByApplicationType = {
569
569
  };
570
570
  const run = () => {
571
571
  // Default command
572
- cli.command('[project-directory]').usage('[project-directory]\n\n Bootstraps a new project using one of the predefined templates.').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', {
573
- default: applicationTypes['custom-application']
574
- }).option('--template <name>', '(optional) The name of the template to install.', {
575
- default: availableTemplates.starter
576
- }).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).', {
577
- default: 'main'
578
- }).option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', {
579
- default: false
580
- }).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', {
581
- default: false
582
- }).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. (default: gcp-eu)').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
572
+ 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) => {
583
573
  var _context;
584
- if (!projectDirectory) {
585
- cli.outputHelp();
586
- return;
587
- }
588
574
  const releaseVersion = await getLatestReleaseVersion();
589
575
  hintOutdatedVersion(pkgJson.version, releaseVersion);
590
576
  const taskOptions = await processOptions(projectDirectory, options);
@@ -610,9 +596,7 @@ const run = () => {
610
596
  console.log('');
611
597
  console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
612
598
  });
613
- cli.help();
614
- cli.version(pkgJson.version);
615
- cli.parse();
599
+ commander.program.parse();
616
600
  };
617
601
 
618
602
  exports.cli = run;
@@ -1,5 +1,5 @@
1
1
  import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
2
- import { cac } from 'cac';
2
+ import { program } from 'commander';
3
3
  import { Listr } from 'listr2';
4
4
  import execa from 'execa';
5
5
  import semver from 'semver';
@@ -35,7 +35,7 @@ import prettier from 'prettier';
35
35
 
36
36
  var pkgJson = {
37
37
  name: "@commercetools-frontend/create-mc-app",
38
- version: "23.2.0",
38
+ version: "23.2.2",
39
39
  description: "Create Merchant Center applications to quickly get up and running",
40
40
  bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
41
41
  repository: {
@@ -61,10 +61,10 @@ var pkgJson = {
61
61
  "@babel/core": "^7.22.17",
62
62
  "@babel/runtime": "^7.22.15",
63
63
  "@babel/runtime-corejs3": "^7.22.15",
64
- "@commercetools-frontend/application-config": "^23.2.0",
64
+ "@commercetools-frontend/application-config": "^23.2.2",
65
65
  "@types/babel__core": "^7.20.1",
66
66
  "@types/semver": "^7.5.1",
67
- cac: "6.7.14",
67
+ commander: "^13.1.0",
68
68
  execa: "5.1.1",
69
69
  listr2: "5.0.8",
70
70
  prettier: "2.8.8",
@@ -516,7 +516,7 @@ function updateApplicationConstants(options) {
516
516
  }
517
517
 
518
518
  throwIfNodeVersionIsNotSupported(process.versions.node, pkgJson.engines.node);
519
- const cli = cac('create-mc-app');
519
+ program.name('create-mc-app').description('CLI to create a new Merchant Center customizations project based on the pre-defined templates.').version(pkgJson.version);
520
520
 
521
521
  // Makes the script crash on unhandled rejections instead of silently
522
522
  // ignoring them. In the future, promise rejections that are not handled will
@@ -534,22 +534,8 @@ const messagesByApplicationType = {
534
534
  };
535
535
  const run = () => {
536
536
  // Default command
537
- cli.command('[project-directory]').usage('[project-directory]\n\n Bootstraps a new project using one of the predefined templates.').option('--application-type <type>', '(optional) The type of the application to create: custom-application (default) or custom-view.', {
538
- default: applicationTypes['custom-application']
539
- }).option('--template <name>', '(optional) The name of the template to install.', {
540
- default: availableTemplates.starter
541
- }).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).', {
542
- default: 'main'
543
- }).option('--skip-install', '(optional) Skip installing the dependencies after cloning the template.', {
544
- default: false
545
- }).option('--yes', '(optional) If set, the prompt options with default values will be skipped.', {
546
- default: false
547
- }).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. (default: gcp-eu)').option('--package-manager <value>', '(optional) The preferred package manager to use: npm, yarn, pnpm.').action(async (projectDirectory, options) => {
537
+ 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) => {
548
538
  var _context;
549
- if (!projectDirectory) {
550
- cli.outputHelp();
551
- return;
552
- }
553
539
  const releaseVersion = await getLatestReleaseVersion();
554
540
  hintOutdatedVersion(pkgJson.version, releaseVersion);
555
541
  const taskOptions = await processOptions(projectDirectory, options);
@@ -575,9 +561,7 @@ const run = () => {
575
561
  console.log('');
576
562
  console.log(`Visit https://docs.commercetools.com/merchant-center-customizations/ for more info about developing ${messages.featureName}. Enjoy 🚀`);
577
563
  });
578
- cli.help();
579
- cli.version(pkgJson.version);
580
- cli.parse();
564
+ program.parse();
581
565
  };
582
566
 
583
567
  export { run as cli };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/create-mc-app",
3
- "version": "23.2.0",
3
+ "version": "23.2.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": {
@@ -26,10 +26,10 @@
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": "^23.2.0",
29
+ "@commercetools-frontend/application-config": "^23.2.2",
30
30
  "@types/babel__core": "^7.20.1",
31
31
  "@types/semver": "^7.5.1",
32
- "cac": "6.7.14",
32
+ "commander": "^13.1.0",
33
33
  "execa": "5.1.1",
34
34
  "listr2": "5.0.8",
35
35
  "prettier": "2.8.8",
package/src/cli.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { cac } from 'cac';
1
+ import { program } from 'commander';
2
2
  import { Listr, type ListrTask } from 'listr2';
3
3
  import pkgJson from '../package.json';
4
4
  import { applicationTypes, availableTemplates } from './constants';
@@ -12,7 +12,12 @@ import { throwIfNodeVersionIsNotSupported } from './validations';
12
12
 
13
13
  throwIfNodeVersionIsNotSupported(process.versions.node, pkgJson.engines.node);
14
14
 
15
- const cli = cac('create-mc-app');
15
+ program
16
+ .name('create-mc-app')
17
+ .description(
18
+ 'CLI to create a new Merchant Center customizations project based on the pre-defined templates.'
19
+ )
20
+ .version(pkgJson.version);
16
21
 
17
22
  // Makes the script crash on unhandled rejections instead of silently
18
23
  // ignoring them. In the future, promise rejections that are not handled will
@@ -32,35 +37,32 @@ const messagesByApplicationType = {
32
37
 
33
38
  const run = () => {
34
39
  // Default command
35
- cli
36
- .command('[project-directory]')
37
- .usage(
38
- '[project-directory]\n\n Bootstraps a new project using one of the predefined templates.'
39
- )
40
+ program
41
+ .argument('<project-directory>')
40
42
  .option(
41
43
  '--application-type <type>',
42
44
  '(optional) The type of the application to create: custom-application (default) or custom-view.',
43
- { default: applicationTypes['custom-application'] }
45
+ applicationTypes['custom-application']
44
46
  )
45
47
  .option(
46
48
  '--template <name>',
47
49
  '(optional) The name of the template to install.',
48
- { default: availableTemplates.starter }
50
+ availableTemplates.starter
49
51
  )
50
52
  .option(
51
53
  '--template-version <version>',
52
54
  '(optional) The version of the template to install (either a git tag or a git branch of the "commercetools/merchant-center-application-kit" repository).',
53
- { default: 'main' }
55
+ 'main'
54
56
  )
55
57
  .option(
56
58
  '--skip-install',
57
59
  '(optional) Skip installing the dependencies after cloning the template.',
58
- { default: false }
60
+ false
59
61
  )
60
62
  .option(
61
63
  '--yes',
62
64
  '(optional) If set, the prompt options with default values will be skipped.',
63
- { default: false }
65
+ false
64
66
  )
65
67
  .option(
66
68
  '--entry-point-uri-path <value>',
@@ -72,18 +74,13 @@ const run = () => {
72
74
  )
73
75
  .option(
74
76
  '--cloud-identifier <value>',
75
- '(optional) Cloud region identifier. (default: gcp-eu)'
77
+ '(optional) Cloud region identifier. By default, the value is prompted in the terminal'
76
78
  )
77
79
  .option(
78
80
  '--package-manager <value>',
79
81
  '(optional) The preferred package manager to use: npm, yarn, pnpm.'
80
82
  )
81
- .action(async (projectDirectory, options: TCliCommandOptions) => {
82
- if (!projectDirectory) {
83
- cli.outputHelp();
84
- return;
85
- }
86
-
83
+ .action(async (projectDirectory: string, options: TCliCommandOptions) => {
87
84
  const releaseVersion = await getLatestReleaseVersion();
88
85
 
89
86
  hintOutdatedVersion(pkgJson.version, releaseVersion);
@@ -132,10 +129,7 @@ const run = () => {
132
129
  );
133
130
  });
134
131
 
135
- cli.help();
136
- cli.version(pkgJson.version);
137
-
138
- cli.parse();
132
+ program.parse();
139
133
  };
140
134
 
141
135
  export default run;