@commercetools-frontend/mc-scripts 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.
Files changed (50) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +38 -50
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +38 -50
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +38 -50
  4. package/dist/{build-f0ae22aa.cjs.prod.js → build-23ba93f5.cjs.prod.js} +3 -3
  5. package/dist/{build-fac1279e.esm.js → build-d2c49158.esm.js} +3 -3
  6. package/dist/{build-6c787c77.cjs.dev.js → build-ea1eb31b.cjs.dev.js} +3 -3
  7. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  8. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  9. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  10. package/dist/{config-sync-b549b77d.cjs.prod.js → config-sync-641f7736.cjs.prod.js} +3 -3
  11. package/dist/{config-sync-cec9f617.cjs.dev.js → config-sync-c5387ea1.cjs.dev.js} +3 -3
  12. package/dist/{config-sync-ea04f13b.esm.js → config-sync-dce7e388.esm.js} +3 -3
  13. package/dist/{create-postcss-config-d68c3110.esm.js → create-postcss-config-09aeda02.esm.js} +1 -1
  14. package/dist/{create-postcss-config-df76b34c.cjs.dev.js → create-postcss-config-1db4f5a2.cjs.dev.js} +1 -1
  15. package/dist/{create-postcss-config-7e5f585d.cjs.prod.js → create-postcss-config-defe4e25.cjs.prod.js} +1 -1
  16. package/dist/{create-webpack-config-for-development-19418674.cjs.dev.js → create-webpack-config-for-development-65aa2e73.cjs.dev.js} +1 -1
  17. package/dist/{create-webpack-config-for-development-7c6d9633.cjs.prod.js → create-webpack-config-for-development-70e7a61c.cjs.prod.js} +1 -1
  18. package/dist/{create-webpack-config-for-development-917b2d2b.esm.js → create-webpack-config-for-development-f3c104f2.esm.js} +1 -1
  19. package/dist/{create-webpack-config-for-production-96a338d6.cjs.dev.js → create-webpack-config-for-production-1bb4262f.cjs.dev.js} +1 -1
  20. package/dist/{create-webpack-config-for-production-a160d3dc.esm.js → create-webpack-config-for-production-755dc4da.esm.js} +1 -1
  21. package/dist/{create-webpack-config-for-production-dac2ceaa.cjs.prod.js → create-webpack-config-for-production-907e8ec6.cjs.prod.js} +1 -1
  22. package/dist/{credentials-storage-c2371770.cjs.dev.js → credentials-storage-39862f66.cjs.dev.js} +1 -1
  23. package/dist/{credentials-storage-8521189d.esm.js → credentials-storage-57d95049.esm.js} +1 -1
  24. package/dist/{credentials-storage-c7353ede.cjs.prod.js → credentials-storage-f8eb8edb.cjs.prod.js} +1 -1
  25. package/dist/declarations/src/types.d.ts +0 -1
  26. package/dist/{deployment-previews-set-6b08140c.cjs.prod.js → deployment-previews-set-3f7ec87b.cjs.prod.js} +3 -3
  27. package/dist/{deployment-previews-set-ff4443ed.esm.js → deployment-previews-set-55477df5.esm.js} +3 -3
  28. package/dist/{deployment-previews-set-2298680c.cjs.dev.js → deployment-previews-set-a84299d3.cjs.dev.js} +3 -3
  29. package/dist/{graphql-requests-390af877.esm.js → graphql-requests-3902d074.esm.js} +1 -1
  30. package/dist/{graphql-requests-1486cf2a.cjs.prod.js → graphql-requests-976664ab.cjs.prod.js} +1 -1
  31. package/dist/{graphql-requests-64d730d3.cjs.dev.js → graphql-requests-ef7ef6ff.cjs.dev.js} +1 -1
  32. package/dist/{login-e8e4a971.cjs.prod.js → login-57876e96.cjs.prod.js} +2 -2
  33. package/dist/{login-d15d9fc4.esm.js → login-a06d99c7.esm.js} +2 -2
  34. package/dist/{login-d153f908.cjs.dev.js → login-d2c53007.cjs.dev.js} +2 -2
  35. package/dist/{package-2ea64053.esm.js → package-0de23cb8.esm.js} +9 -9
  36. package/dist/{package-cb608407.cjs.dev.js → package-18f19ff1.cjs.prod.js} +9 -9
  37. package/dist/{package-d3324da3.cjs.prod.js → package-2dd76676.cjs.dev.js} +9 -9
  38. package/dist/{start-b43eeb78.esm.js → start-2db80683.esm.js} +3 -3
  39. package/dist/{start-c59c72cb.cjs.dev.js → start-3ae22fdb.cjs.dev.js} +3 -3
  40. package/dist/{start-2c5dcb3a.cjs.prod.js → start-58854d7f.cjs.prod.js} +3 -3
  41. package/dist/{start-vite-5e28ac6c.cjs.prod.js → start-vite-7b4df74e.cjs.prod.js} +3 -1
  42. package/dist/{start-vite-f09d98ea.esm.js → start-vite-91fe1256.esm.js} +3 -1
  43. package/dist/{start-vite-ae22e3a0.cjs.dev.js → start-vite-b93c91c5.cjs.dev.js} +3 -1
  44. package/package.json +9 -9
  45. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  46. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  47. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  48. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
  49. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
  50. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
@@ -7,10 +7,10 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
7
7
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
8
  var fs = require('fs');
9
9
  var path = require('path');
10
- var cac = require('cac');
10
+ var commander = require('commander');
11
11
  var dotenv = require('dotenv');
12
12
  var dotenvExpand = require('dotenv-expand');
13
- var _package = require('../../dist/package-cb608407.cjs.dev.js');
13
+ var _package = require('../../dist/package-2dd76676.cjs.dev.js');
14
14
  var doesFileExist = require('../../dist/does-file-exist-eb86baca.cjs.dev.js');
15
15
  require('node:fs');
16
16
 
@@ -24,7 +24,9 @@ var path__default = /*#__PURE__*/_interopDefault(path);
24
24
  var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
25
25
  var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
26
26
 
27
- const cli = cac.cac('mc-scripts');
27
+ commander.program.name('mc-scripts').description('CLI to develop and build Merchant Center customizations.').version(_package.pkgJson.version).option('--env <path...>',
28
+ // Variadic option. It allows multiple `--env` options to be provided.
29
+ `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
28
30
 
29
31
  // Makes the script crash on unhandled rejections instead of silently
30
32
  // ignoring them. In the future, promise rejections that are not handled will
@@ -36,19 +38,13 @@ process.on('unhandledRejection', err => {
36
38
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
37
39
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
38
40
  async function run() {
39
- cli.option('--env <path>', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
40
-
41
- // Default command
42
- cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
43
- cli.outputHelp();
44
- });
45
-
46
41
  // Command: start
47
- const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
48
- cli.command('start', usageStart).usage(`\n\n ${usageStart}`).alias('dev').action(async options => {
42
+ commander.program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
43
+ const globalOptions = commander.program.opts();
44
+
49
45
  // Load dotenv files into the process environment.
50
46
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
51
- loadDotEnvFiles(options);
47
+ loadDotEnvFiles(globalOptions);
52
48
 
53
49
  // Do this as the first thing so that any code reading it knows the right env.
54
50
  process.env.BABEL_ENV = 'development';
@@ -58,18 +54,16 @@ async function run() {
58
54
  console.log('Experimental Vite bundler enabled! 🚀');
59
55
  console.log('');
60
56
  }
61
- const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-ae22e3a0.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-c59c72cb.cjs.dev.js'); });
57
+ const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-b93c91c5.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-3ae22fdb.cjs.dev.js'); });
62
58
  await startCommand.default();
63
59
  });
64
60
 
65
61
  // Command: build
66
- const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
67
- cli.command('build', usageBuild).usage(`\n\n ${usageBuild}`).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
68
- default: false
69
- }).action(async options => {
62
+ commander.program.command('build').description('Bundles the application in production mode. Outputs a "public" folder.').option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', false).action(async options => {
63
+ const globalOptions = commander.program.opts();
70
64
  // Load dotenv files into the process environment.
71
65
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
72
- loadDotEnvFiles(options);
66
+ loadDotEnvFiles(globalOptions);
73
67
 
74
68
  // Do this as the first thing so that any code reading it knows the right env.
75
69
  process.env.BABEL_ENV = 'production';
@@ -79,7 +73,7 @@ async function run() {
79
73
  console.log('Experimental Vite bundler enabled! 🚀');
80
74
  console.log('');
81
75
  }
82
- const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-8131eae2.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-6c787c77.cjs.dev.js'); });
76
+ const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-8131eae2.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-ea1eb31b.cjs.dev.js'); });
83
77
  await buildCommand.default();
84
78
  const shouldAlsoCompile = !options.buildOnly;
85
79
  if (shouldAlsoCompile) {
@@ -92,13 +86,12 @@ async function run() {
92
86
  });
93
87
 
94
88
  // Command: compile-html
95
- const usageCompileHtml = 'Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".';
96
- cli.command('compile-html', usageCompileHtml).usage(`\n\n ${usageCompileHtml}`).option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', {
97
- default: false
98
- }).action(async options => {
89
+ commander.program.command('compile-html').description('Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".').option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', false).action(async options => {
90
+ const globalOptions = commander.program.opts();
91
+
99
92
  // Load dotenv files into the process environment.
100
93
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
101
- loadDotEnvFiles(options);
94
+ loadDotEnvFiles(globalOptions);
102
95
 
103
96
  // Do this as the first thing so that any code reading it knows the right env.
104
97
  process.env.NODE_ENV = 'production';
@@ -107,11 +100,12 @@ async function run() {
107
100
  });
108
101
 
109
102
  // Command: serve
110
- const usageServe = 'Serves previously built and compiled application from the "public" folder.';
111
- cli.command('serve', usageServe).usage(`\n\n ${usageServe}`).action(async options => {
103
+ commander.program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
104
+ const globalOptions = commander.program.opts();
105
+
112
106
  // Load dotenv files into the process environment.
113
107
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
114
- loadDotEnvFiles(options);
108
+ loadDotEnvFiles(globalOptions);
115
109
 
116
110
  // Do this as the first thing so that any code reading it knows the right env.
117
111
  process.env.NODE_ENV = 'production';
@@ -120,53 +114,47 @@ async function run() {
120
114
  });
121
115
 
122
116
  // Command: login
123
- const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
124
- cli.command('login', usageLogin).usage(`\n\n ${usageLogin}`).action(async options => {
117
+ commander.program.command('login').description('Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.').action(async () => {
118
+ const globalOptions = commander.program.opts();
119
+
125
120
  // Load dotenv files into the process environment.
126
121
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
127
- loadDotEnvFiles(options);
122
+ loadDotEnvFiles(globalOptions);
128
123
 
129
124
  // Do this as the first thing so that any code reading it knows the right env.
130
125
  process.env.NODE_ENV = 'production';
131
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-d153f908.cjs.dev.js'); });
126
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-d2c53007.cjs.dev.js'); });
132
127
  await loginCommand.default();
133
128
  });
134
129
 
135
130
  // Command: config:sync
136
- const usageConfigSync = 'Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.';
137
- cli.command('config:sync', usageConfigSync).usage(`\n\n ${usageConfigSync}`).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
138
- default: false
139
- }).action(async options => {
131
+ commander.program.command('config:sync').description('Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.').option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
132
+ const globalOptions = commander.program.opts();
133
+
140
134
  // Load dotenv files into the process environment.
141
135
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
142
- loadDotEnvFiles(options);
136
+ loadDotEnvFiles(globalOptions);
143
137
 
144
138
  // Do this as the first thing so that any code reading it knows the right env.
145
139
  process.env.NODE_ENV = 'production';
146
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-cec9f617.cjs.dev.js'); });
140
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-c5387ea1.cjs.dev.js'); });
147
141
  await configSyncCommand.default(options);
148
142
  });
149
143
 
150
144
  // Command: deployment-previews:set
151
- const usageDeploymentPreviewsSet = 'Creates or updates a deployment preview for the Custom Application.';
152
- cli.command('deployment-previews:set', usageDeploymentPreviewsSet).usage(`\n\n ${usageDeploymentPreviewsSet}`).option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
153
- default: false
154
- }).action(async options => {
145
+ commander.program.command('deployment-previews:set').description('Creates or updates a deployment preview for the Custom Application.').option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
146
+ const globalOptions = commander.program.opts();
147
+
155
148
  // Load dotenv files into the process environment.
156
149
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
157
- loadDotEnvFiles(options);
150
+ loadDotEnvFiles(globalOptions);
158
151
 
159
152
  // Do this as the first thing so that any code reading it knows the right env.
160
153
  process.env.NODE_ENV = 'production';
161
- const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-2298680c.cjs.dev.js'); });
154
+ const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-a84299d3.cjs.dev.js'); });
162
155
  await deploymentsSetCommand.default(options);
163
156
  });
164
- cli.help();
165
- cli.version(_package.pkgJson.version);
166
- cli.parse(process.argv, {
167
- run: false
168
- });
169
- await cli.runMatchedCommand();
157
+ commander.program.parse();
170
158
  }
171
159
 
172
160
  // Load dotenv files into the process environment.
@@ -7,10 +7,10 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
7
7
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
8
  var fs = require('fs');
9
9
  var path = require('path');
10
- var cac = require('cac');
10
+ var commander = require('commander');
11
11
  var dotenv = require('dotenv');
12
12
  var dotenvExpand = require('dotenv-expand');
13
- var _package = require('../../dist/package-d3324da3.cjs.prod.js');
13
+ var _package = require('../../dist/package-18f19ff1.cjs.prod.js');
14
14
  var doesFileExist = require('../../dist/does-file-exist-be53305d.cjs.prod.js');
15
15
  require('node:fs');
16
16
 
@@ -24,7 +24,9 @@ var path__default = /*#__PURE__*/_interopDefault(path);
24
24
  var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
25
25
  var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
26
26
 
27
- const cli = cac.cac('mc-scripts');
27
+ commander.program.name('mc-scripts').description('CLI to develop and build Merchant Center customizations.').version(_package.pkgJson.version).option('--env <path...>',
28
+ // Variadic option. It allows multiple `--env` options to be provided.
29
+ `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
28
30
 
29
31
  // Makes the script crash on unhandled rejections instead of silently
30
32
  // ignoring them. In the future, promise rejections that are not handled will
@@ -36,19 +38,13 @@ process.on('unhandledRejection', err => {
36
38
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
37
39
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
38
40
  async function run() {
39
- cli.option('--env <path>', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
40
-
41
- // Default command
42
- cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
43
- cli.outputHelp();
44
- });
45
-
46
41
  // Command: start
47
- const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
48
- cli.command('start', usageStart).usage(`\n\n ${usageStart}`).alias('dev').action(async options => {
42
+ commander.program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
43
+ const globalOptions = commander.program.opts();
44
+
49
45
  // Load dotenv files into the process environment.
50
46
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
51
- loadDotEnvFiles(options);
47
+ loadDotEnvFiles(globalOptions);
52
48
 
53
49
  // Do this as the first thing so that any code reading it knows the right env.
54
50
  process.env.BABEL_ENV = 'development';
@@ -58,18 +54,16 @@ async function run() {
58
54
  console.log('Experimental Vite bundler enabled! 🚀');
59
55
  console.log('');
60
56
  }
61
- const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-5e28ac6c.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-2c5dcb3a.cjs.prod.js'); });
57
+ const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-7b4df74e.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-58854d7f.cjs.prod.js'); });
62
58
  await startCommand.default();
63
59
  });
64
60
 
65
61
  // Command: build
66
- const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
67
- cli.command('build', usageBuild).usage(`\n\n ${usageBuild}`).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
68
- default: false
69
- }).action(async options => {
62
+ commander.program.command('build').description('Bundles the application in production mode. Outputs a "public" folder.').option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', false).action(async options => {
63
+ const globalOptions = commander.program.opts();
70
64
  // Load dotenv files into the process environment.
71
65
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
72
- loadDotEnvFiles(options);
66
+ loadDotEnvFiles(globalOptions);
73
67
 
74
68
  // Do this as the first thing so that any code reading it knows the right env.
75
69
  process.env.BABEL_ENV = 'production';
@@ -79,7 +73,7 @@ async function run() {
79
73
  console.log('Experimental Vite bundler enabled! 🚀');
80
74
  console.log('');
81
75
  }
82
- const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-44c5100f.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-f0ae22aa.cjs.prod.js'); });
76
+ const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-44c5100f.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-23ba93f5.cjs.prod.js'); });
83
77
  await buildCommand.default();
84
78
  const shouldAlsoCompile = !options.buildOnly;
85
79
  if (shouldAlsoCompile) {
@@ -92,13 +86,12 @@ async function run() {
92
86
  });
93
87
 
94
88
  // Command: compile-html
95
- const usageCompileHtml = 'Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".';
96
- cli.command('compile-html', usageCompileHtml).usage(`\n\n ${usageCompileHtml}`).option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', {
97
- default: false
98
- }).action(async options => {
89
+ commander.program.command('compile-html').description('Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".').option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', false).action(async options => {
90
+ const globalOptions = commander.program.opts();
91
+
99
92
  // Load dotenv files into the process environment.
100
93
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
101
- loadDotEnvFiles(options);
94
+ loadDotEnvFiles(globalOptions);
102
95
 
103
96
  // Do this as the first thing so that any code reading it knows the right env.
104
97
  process.env.NODE_ENV = 'production';
@@ -107,11 +100,12 @@ async function run() {
107
100
  });
108
101
 
109
102
  // Command: serve
110
- const usageServe = 'Serves previously built and compiled application from the "public" folder.';
111
- cli.command('serve', usageServe).usage(`\n\n ${usageServe}`).action(async options => {
103
+ commander.program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
104
+ const globalOptions = commander.program.opts();
105
+
112
106
  // Load dotenv files into the process environment.
113
107
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
114
- loadDotEnvFiles(options);
108
+ loadDotEnvFiles(globalOptions);
115
109
 
116
110
  // Do this as the first thing so that any code reading it knows the right env.
117
111
  process.env.NODE_ENV = 'production';
@@ -120,53 +114,47 @@ async function run() {
120
114
  });
121
115
 
122
116
  // Command: login
123
- const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
124
- cli.command('login', usageLogin).usage(`\n\n ${usageLogin}`).action(async options => {
117
+ commander.program.command('login').description('Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.').action(async () => {
118
+ const globalOptions = commander.program.opts();
119
+
125
120
  // Load dotenv files into the process environment.
126
121
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
127
- loadDotEnvFiles(options);
122
+ loadDotEnvFiles(globalOptions);
128
123
 
129
124
  // Do this as the first thing so that any code reading it knows the right env.
130
125
  process.env.NODE_ENV = 'production';
131
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-e8e4a971.cjs.prod.js'); });
126
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-57876e96.cjs.prod.js'); });
132
127
  await loginCommand.default();
133
128
  });
134
129
 
135
130
  // Command: config:sync
136
- const usageConfigSync = 'Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.';
137
- cli.command('config:sync', usageConfigSync).usage(`\n\n ${usageConfigSync}`).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
138
- default: false
139
- }).action(async options => {
131
+ commander.program.command('config:sync').description('Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.').option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
132
+ const globalOptions = commander.program.opts();
133
+
140
134
  // Load dotenv files into the process environment.
141
135
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
142
- loadDotEnvFiles(options);
136
+ loadDotEnvFiles(globalOptions);
143
137
 
144
138
  // Do this as the first thing so that any code reading it knows the right env.
145
139
  process.env.NODE_ENV = 'production';
146
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-b549b77d.cjs.prod.js'); });
140
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-641f7736.cjs.prod.js'); });
147
141
  await configSyncCommand.default(options);
148
142
  });
149
143
 
150
144
  // Command: deployment-previews:set
151
- const usageDeploymentPreviewsSet = 'Creates or updates a deployment preview for the Custom Application.';
152
- cli.command('deployment-previews:set', usageDeploymentPreviewsSet).usage(`\n\n ${usageDeploymentPreviewsSet}`).option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
153
- default: false
154
- }).action(async options => {
145
+ commander.program.command('deployment-previews:set').description('Creates or updates a deployment preview for the Custom Application.').option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
146
+ const globalOptions = commander.program.opts();
147
+
155
148
  // Load dotenv files into the process environment.
156
149
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
157
- loadDotEnvFiles(options);
150
+ loadDotEnvFiles(globalOptions);
158
151
 
159
152
  // Do this as the first thing so that any code reading it knows the right env.
160
153
  process.env.NODE_ENV = 'production';
161
- const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-6b08140c.cjs.prod.js'); });
154
+ const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-3f7ec87b.cjs.prod.js'); });
162
155
  await deploymentsSetCommand.default(options);
163
156
  });
164
- cli.help();
165
- cli.version(_package.pkgJson.version);
166
- cli.parse(process.argv, {
167
- run: false
168
- });
169
- await cli.runMatchedCommand();
157
+ commander.program.parse();
170
158
  }
171
159
 
172
160
  // Load dotenv files into the process environment.
@@ -3,14 +3,16 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
3
3
  import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
- import { cac } from 'cac';
6
+ import { program } from 'commander';
7
7
  import dotenv from 'dotenv';
8
8
  import dotenvExpand from 'dotenv-expand';
9
- import { p as pkgJson } from '../../dist/package-2ea64053.esm.js';
9
+ import { p as pkgJson } from '../../dist/package-0de23cb8.esm.js';
10
10
  import { d as doesFileExist } from '../../dist/does-file-exist-32618334.esm.js';
11
11
  import 'node:fs';
12
12
 
13
- const cli = cac('mc-scripts');
13
+ program.name('mc-scripts').description('CLI to develop and build Merchant Center customizations.').version(pkgJson.version).option('--env <path...>',
14
+ // Variadic option. It allows multiple `--env` options to be provided.
15
+ `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
14
16
 
15
17
  // Makes the script crash on unhandled rejections instead of silently
16
18
  // ignoring them. In the future, promise rejections that are not handled will
@@ -22,19 +24,13 @@ process.on('unhandledRejection', err => {
22
24
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
23
25
  const applicationDirectory = fs.realpathSync(process.cwd());
24
26
  async function run() {
25
- cli.option('--env <path>', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
26
-
27
- // Default command
28
- cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
29
- cli.outputHelp();
30
- });
31
-
32
27
  // Command: start
33
- const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
34
- cli.command('start', usageStart).usage(`\n\n ${usageStart}`).alias('dev').action(async options => {
28
+ program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
29
+ const globalOptions = program.opts();
30
+
35
31
  // Load dotenv files into the process environment.
36
32
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
37
- loadDotEnvFiles(options);
33
+ loadDotEnvFiles(globalOptions);
38
34
 
39
35
  // Do this as the first thing so that any code reading it knows the right env.
40
36
  process.env.BABEL_ENV = 'development';
@@ -44,18 +40,16 @@ async function run() {
44
40
  console.log('Experimental Vite bundler enabled! 🚀');
45
41
  console.log('');
46
42
  }
47
- const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-f09d98ea.esm.js') : await import('../../dist/start-b43eeb78.esm.js');
43
+ const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-91fe1256.esm.js') : await import('../../dist/start-2db80683.esm.js');
48
44
  await startCommand.default();
49
45
  });
50
46
 
51
47
  // Command: build
52
- const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
53
- cli.command('build', usageBuild).usage(`\n\n ${usageBuild}`).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
54
- default: false
55
- }).action(async options => {
48
+ program.command('build').description('Bundles the application in production mode. Outputs a "public" folder.').option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', false).action(async options => {
49
+ const globalOptions = program.opts();
56
50
  // Load dotenv files into the process environment.
57
51
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
58
- loadDotEnvFiles(options);
52
+ loadDotEnvFiles(globalOptions);
59
53
 
60
54
  // Do this as the first thing so that any code reading it knows the right env.
61
55
  process.env.BABEL_ENV = 'production';
@@ -65,7 +59,7 @@ async function run() {
65
59
  console.log('Experimental Vite bundler enabled! 🚀');
66
60
  console.log('');
67
61
  }
68
- const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-23f6852c.esm.js') : await import('../../dist/build-fac1279e.esm.js');
62
+ const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-23f6852c.esm.js') : await import('../../dist/build-d2c49158.esm.js');
69
63
  await buildCommand.default();
70
64
  const shouldAlsoCompile = !options.buildOnly;
71
65
  if (shouldAlsoCompile) {
@@ -78,13 +72,12 @@ async function run() {
78
72
  });
79
73
 
80
74
  // Command: compile-html
81
- const usageCompileHtml = 'Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".';
82
- cli.command('compile-html', usageCompileHtml).usage(`\n\n ${usageCompileHtml}`).option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', {
83
- default: false
84
- }).action(async options => {
75
+ program.command('compile-html').description('Compiles "index.html.template" file into a "index.html" with all the required runtime configuration. The security headers are also compiled and injected into the "index.html".').option('--transformer <path>', '(optional) The path to a JS module that can be used to generate a configuration for a specific cloud provider (e.g. Vercel, Netlify).').option('--print-security-headers', '(optional) If defined, the compiled security headers are printed to stdout.', false).action(async options => {
76
+ const globalOptions = program.opts();
77
+
85
78
  // Load dotenv files into the process environment.
86
79
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
87
- loadDotEnvFiles(options);
80
+ loadDotEnvFiles(globalOptions);
88
81
 
89
82
  // Do this as the first thing so that any code reading it knows the right env.
90
83
  process.env.NODE_ENV = 'production';
@@ -93,11 +86,12 @@ async function run() {
93
86
  });
94
87
 
95
88
  // Command: serve
96
- const usageServe = 'Serves previously built and compiled application from the "public" folder.';
97
- cli.command('serve', usageServe).usage(`\n\n ${usageServe}`).action(async options => {
89
+ program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
90
+ const globalOptions = program.opts();
91
+
98
92
  // Load dotenv files into the process environment.
99
93
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
100
- loadDotEnvFiles(options);
94
+ loadDotEnvFiles(globalOptions);
101
95
 
102
96
  // Do this as the first thing so that any code reading it knows the right env.
103
97
  process.env.NODE_ENV = 'production';
@@ -106,53 +100,47 @@ async function run() {
106
100
  });
107
101
 
108
102
  // Command: login
109
- const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
110
- cli.command('login', usageLogin).usage(`\n\n ${usageLogin}`).action(async options => {
103
+ program.command('login').description('Log in to your Merchant Center account through the CLI, using the cloud environment information from the Merchant Center customization config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.').action(async () => {
104
+ const globalOptions = program.opts();
105
+
111
106
  // Load dotenv files into the process environment.
112
107
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
113
- loadDotEnvFiles(options);
108
+ loadDotEnvFiles(globalOptions);
114
109
 
115
110
  // Do this as the first thing so that any code reading it knows the right env.
116
111
  process.env.NODE_ENV = 'production';
117
- const loginCommand = await import('../../dist/login-d15d9fc4.esm.js');
112
+ const loginCommand = await import('../../dist/login-a06d99c7.esm.js');
118
113
  await loginCommand.default();
119
114
  });
120
115
 
121
116
  // Command: config:sync
122
- const usageConfigSync = 'Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.';
123
- cli.command('config:sync', usageConfigSync).usage(`\n\n ${usageConfigSync}`).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
124
- default: false
125
- }).action(async options => {
117
+ program.command('config:sync').description('Synchronizes the local Merchant Center customization config with the Merchant Center. A new Merchant Center customization will be created if none existed, otherwise it will be updated.').option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
118
+ const globalOptions = program.opts();
119
+
126
120
  // Load dotenv files into the process environment.
127
121
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
128
- loadDotEnvFiles(options);
122
+ loadDotEnvFiles(globalOptions);
129
123
 
130
124
  // Do this as the first thing so that any code reading it knows the right env.
131
125
  process.env.NODE_ENV = 'production';
132
- const configSyncCommand = await import('../../dist/config-sync-ea04f13b.esm.js');
126
+ const configSyncCommand = await import('../../dist/config-sync-dce7e388.esm.js');
133
127
  await configSyncCommand.default(options);
134
128
  });
135
129
 
136
130
  // Command: deployment-previews:set
137
- const usageDeploymentPreviewsSet = 'Creates or updates a deployment preview for the Custom Application.';
138
- cli.command('deployment-previews:set', usageDeploymentPreviewsSet).usage(`\n\n ${usageDeploymentPreviewsSet}`).option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
139
- default: false
140
- }).action(async options => {
131
+ program.command('deployment-previews:set').description('Creates or updates a deployment preview for the Custom Application.').option('--alias <deployment-preview-alias>', "(optional) Alias to be used for the deployment preview. If you don't provide an alias, the command will prompt you for it.").option('--url <deployment-preview-url>', "(optional) URL to be used for the deployment preview. If you don't provide a URL, the command will prompt you for it.").option('--dry-run', '(optional) Executes the command but does not send any mutation request.', false).action(async options => {
132
+ const globalOptions = program.opts();
133
+
141
134
  // Load dotenv files into the process environment.
142
135
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
143
- loadDotEnvFiles(options);
136
+ loadDotEnvFiles(globalOptions);
144
137
 
145
138
  // Do this as the first thing so that any code reading it knows the right env.
146
139
  process.env.NODE_ENV = 'production';
147
- const deploymentsSetCommand = await import('../../dist/deployment-previews-set-ff4443ed.esm.js');
140
+ const deploymentsSetCommand = await import('../../dist/deployment-previews-set-55477df5.esm.js');
148
141
  await deploymentsSetCommand.default(options);
149
142
  });
150
- cli.help();
151
- cli.version(pkgJson.version);
152
- cli.parse(process.argv, {
153
- run: false
154
- });
155
- await cli.runMatchedCommand();
143
+ program.parse();
156
144
  }
157
145
 
158
146
  // Load dotenv files into the process environment.
@@ -10,7 +10,7 @@ var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
10
10
  var printBuildError = require('react-dev-utils/printBuildError');
11
11
  var webpack = require('webpack');
12
12
  var assets = require('@commercetools-frontend/assets');
13
- var createWebpackConfigForProduction = require('./create-webpack-config-for-production-dac2ceaa.cjs.prod.js');
13
+ var createWebpackConfigForProduction = require('./create-webpack-config-for-production-907e8ec6.cjs.prod.js');
14
14
  var paths = require('./paths-7768b440.cjs.prod.js');
15
15
  var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
16
16
  require('@babel/runtime-corejs3/core-js-stable/object/keys');
@@ -40,9 +40,9 @@ require('@babel/runtime-corejs3/core-js-stable/instance/bind');
40
40
  require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
41
41
  require('@babel/runtime-corejs3/core-js-stable/object/assign');
42
42
  require('fs');
43
- require('./create-postcss-config-7e5f585d.cjs.prod.js');
43
+ require('./create-postcss-config-defe4e25.cjs.prod.js');
44
44
  require('@babel/runtime-corejs3/helpers/slicedToArray');
45
- require('./package-d3324da3.cjs.prod.js');
45
+ require('./package-18f19ff1.cjs.prod.js');
46
46
  require('./has-jsx-runtime-c3202df5.cjs.prod.js');
47
47
  require('./optimizations-fb93514f.cjs.prod.js');
48
48
  require('@babel/runtime-corejs3/core-js-stable/object/entries');
@@ -8,7 +8,7 @@ import formatWebpackMessages from 'react-dev-utils/formatWebpackMessages';
8
8
  import printBuildError from 'react-dev-utils/printBuildError';
9
9
  import webpack from 'webpack';
10
10
  import { packageLocation } from '@commercetools-frontend/assets';
11
- import { c as createWebpackConfigForProduction } from './create-webpack-config-for-production-a160d3dc.esm.js';
11
+ import { c as createWebpackConfigForProduction } from './create-webpack-config-for-production-755dc4da.esm.js';
12
12
  import { p as paths } from './paths-39f22b8b.esm.js';
13
13
  import { d as doesFileExist } from './does-file-exist-32618334.esm.js';
14
14
  import '@babel/runtime-corejs3/core-js-stable/object/keys';
@@ -38,9 +38,9 @@ import '@babel/runtime-corejs3/core-js-stable/instance/bind';
38
38
  import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
39
39
  import '@babel/runtime-corejs3/core-js-stable/object/assign';
40
40
  import 'fs';
41
- import './create-postcss-config-d68c3110.esm.js';
41
+ import './create-postcss-config-09aeda02.esm.js';
42
42
  import '@babel/runtime-corejs3/helpers/slicedToArray';
43
- import './package-2ea64053.esm.js';
43
+ import './package-0de23cb8.esm.js';
44
44
  import './has-jsx-runtime-e3ecb09b.esm.js';
45
45
  import './optimizations-bf991634.esm.js';
46
46
  import '@babel/runtime-corejs3/core-js-stable/object/entries';
@@ -10,7 +10,7 @@ var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
10
10
  var printBuildError = require('react-dev-utils/printBuildError');
11
11
  var webpack = require('webpack');
12
12
  var assets = require('@commercetools-frontend/assets');
13
- var createWebpackConfigForProduction = require('./create-webpack-config-for-production-96a338d6.cjs.dev.js');
13
+ var createWebpackConfigForProduction = require('./create-webpack-config-for-production-1bb4262f.cjs.dev.js');
14
14
  var paths = require('./paths-b76fc753.cjs.dev.js');
15
15
  var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
16
16
  require('@babel/runtime-corejs3/core-js-stable/object/keys');
@@ -40,9 +40,9 @@ require('@babel/runtime-corejs3/core-js-stable/instance/bind');
40
40
  require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
41
41
  require('@babel/runtime-corejs3/core-js-stable/object/assign');
42
42
  require('fs');
43
- require('./create-postcss-config-df76b34c.cjs.dev.js');
43
+ require('./create-postcss-config-1db4f5a2.cjs.dev.js');
44
44
  require('@babel/runtime-corejs3/helpers/slicedToArray');
45
- require('./package-cb608407.cjs.dev.js');
45
+ require('./package-2dd76676.cjs.dev.js');
46
46
  require('./has-jsx-runtime-aa5d21ee.cjs.dev.js');
47
47
  require('./optimizations-7789145e.cjs.dev.js');
48
48
  require('@babel/runtime-corejs3/core-js-stable/object/entries');