@commercetools-frontend/mc-scripts 23.2.0 → 23.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +36 -50
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +36 -50
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +36 -50
  4. package/dist/{build-6c787c77.cjs.dev.js → build-360f081d.cjs.dev.js} +3 -3
  5. package/dist/{build-f0ae22aa.cjs.prod.js → build-6bd0ac22.cjs.prod.js} +3 -3
  6. package/dist/{build-fac1279e.esm.js → build-d10bc41b.esm.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-ea04f13b.esm.js → config-sync-1b8ae40b.esm.js} +3 -3
  11. package/dist/{config-sync-cec9f617.cjs.dev.js → config-sync-482a69fe.cjs.dev.js} +3 -3
  12. package/dist/{config-sync-b549b77d.cjs.prod.js → config-sync-d53518fd.cjs.prod.js} +3 -3
  13. package/dist/{create-postcss-config-7e5f585d.cjs.prod.js → create-postcss-config-5e470fa7.cjs.prod.js} +1 -1
  14. package/dist/{create-postcss-config-d68c3110.esm.js → create-postcss-config-c5cf6d30.esm.js} +1 -1
  15. package/dist/{create-postcss-config-df76b34c.cjs.dev.js → create-postcss-config-fe0eda38.cjs.dev.js} +1 -1
  16. package/dist/{create-webpack-config-for-development-7c6d9633.cjs.prod.js → create-webpack-config-for-development-48c400cd.cjs.prod.js} +1 -1
  17. package/dist/{create-webpack-config-for-development-917b2d2b.esm.js → create-webpack-config-for-development-bde94f6a.esm.js} +1 -1
  18. package/dist/{create-webpack-config-for-development-19418674.cjs.dev.js → create-webpack-config-for-development-ea1e020f.cjs.dev.js} +1 -1
  19. package/dist/{create-webpack-config-for-production-dac2ceaa.cjs.prod.js → create-webpack-config-for-production-03fb373c.cjs.prod.js} +1 -1
  20. package/dist/{create-webpack-config-for-production-a160d3dc.esm.js → create-webpack-config-for-production-98949ba8.esm.js} +1 -1
  21. package/dist/{create-webpack-config-for-production-96a338d6.cjs.dev.js → create-webpack-config-for-production-c5364376.cjs.dev.js} +1 -1
  22. package/dist/{credentials-storage-c2371770.cjs.dev.js → credentials-storage-8246aab4.cjs.dev.js} +1 -1
  23. package/dist/{credentials-storage-c7353ede.cjs.prod.js → credentials-storage-8cf72194.cjs.prod.js} +1 -1
  24. package/dist/{credentials-storage-8521189d.esm.js → credentials-storage-caf1c2ad.esm.js} +1 -1
  25. package/dist/declarations/src/types.d.ts +0 -1
  26. package/dist/{deployment-previews-set-2298680c.cjs.dev.js → deployment-previews-set-14da3831.cjs.dev.js} +3 -3
  27. package/dist/{deployment-previews-set-6b08140c.cjs.prod.js → deployment-previews-set-b2dc5c83.cjs.prod.js} +3 -3
  28. package/dist/{deployment-previews-set-ff4443ed.esm.js → deployment-previews-set-b6c92418.esm.js} +3 -3
  29. package/dist/{graphql-requests-64d730d3.cjs.dev.js → graphql-requests-02024fb9.cjs.dev.js} +1 -1
  30. package/dist/{graphql-requests-390af877.esm.js → graphql-requests-9b0cf79b.esm.js} +1 -1
  31. package/dist/{graphql-requests-1486cf2a.cjs.prod.js → graphql-requests-a42d578d.cjs.prod.js} +1 -1
  32. package/dist/{login-d15d9fc4.esm.js → login-35a7c23c.esm.js} +2 -2
  33. package/dist/{login-d153f908.cjs.dev.js → login-ecf933dc.cjs.dev.js} +2 -2
  34. package/dist/{login-e8e4a971.cjs.prod.js → login-f13ca0a8.cjs.prod.js} +2 -2
  35. package/dist/{package-cb608407.cjs.dev.js → package-68bccd43.cjs.dev.js} +9 -9
  36. package/dist/{package-d3324da3.cjs.prod.js → package-9161a458.cjs.prod.js} +9 -9
  37. package/dist/{package-2ea64053.esm.js → package-fdee3971.esm.js} +9 -9
  38. package/dist/{start-b43eeb78.esm.js → start-13e3a0ba.esm.js} +3 -3
  39. package/dist/{start-2c5dcb3a.cjs.prod.js → start-5dc189f3.cjs.prod.js} +3 -3
  40. package/dist/{start-c59c72cb.cjs.dev.js → start-be2ffdfc.cjs.dev.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-68bccd43.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,7 @@ 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]', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
28
28
 
29
29
  // Makes the script crash on unhandled rejections instead of silently
30
30
  // ignoring them. In the future, promise rejections that are not handled will
@@ -36,19 +36,13 @@ process.on('unhandledRejection', err => {
36
36
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
37
37
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
38
38
  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
39
  // 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 => {
40
+ commander.program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
41
+ const globalOptions = commander.program.opts();
42
+
49
43
  // Load dotenv files into the process environment.
50
44
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
51
- loadDotEnvFiles(options);
45
+ loadDotEnvFiles(globalOptions);
52
46
 
53
47
  // Do this as the first thing so that any code reading it knows the right env.
54
48
  process.env.BABEL_ENV = 'development';
@@ -58,18 +52,16 @@ async function run() {
58
52
  console.log('Experimental Vite bundler enabled! 🚀');
59
53
  console.log('');
60
54
  }
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'); });
55
+ 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-be2ffdfc.cjs.dev.js'); });
62
56
  await startCommand.default();
63
57
  });
64
58
 
65
59
  // 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 => {
60
+ 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 => {
61
+ const globalOptions = commander.program.opts();
70
62
  // Load dotenv files into the process environment.
71
63
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
72
- loadDotEnvFiles(options);
64
+ loadDotEnvFiles(globalOptions);
73
65
 
74
66
  // Do this as the first thing so that any code reading it knows the right env.
75
67
  process.env.BABEL_ENV = 'production';
@@ -79,7 +71,7 @@ async function run() {
79
71
  console.log('Experimental Vite bundler enabled! 🚀');
80
72
  console.log('');
81
73
  }
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'); });
74
+ 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-360f081d.cjs.dev.js'); });
83
75
  await buildCommand.default();
84
76
  const shouldAlsoCompile = !options.buildOnly;
85
77
  if (shouldAlsoCompile) {
@@ -92,13 +84,12 @@ async function run() {
92
84
  });
93
85
 
94
86
  // 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 => {
87
+ 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 => {
88
+ const globalOptions = commander.program.opts();
89
+
99
90
  // Load dotenv files into the process environment.
100
91
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
101
- loadDotEnvFiles(options);
92
+ loadDotEnvFiles(globalOptions);
102
93
 
103
94
  // Do this as the first thing so that any code reading it knows the right env.
104
95
  process.env.NODE_ENV = 'production';
@@ -107,11 +98,12 @@ async function run() {
107
98
  });
108
99
 
109
100
  // 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 => {
101
+ commander.program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
102
+ const globalOptions = commander.program.opts();
103
+
112
104
  // Load dotenv files into the process environment.
113
105
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
114
- loadDotEnvFiles(options);
106
+ loadDotEnvFiles(globalOptions);
115
107
 
116
108
  // Do this as the first thing so that any code reading it knows the right env.
117
109
  process.env.NODE_ENV = 'production';
@@ -120,53 +112,47 @@ async function run() {
120
112
  });
121
113
 
122
114
  // 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 => {
115
+ 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 () => {
116
+ const globalOptions = commander.program.opts();
117
+
125
118
  // Load dotenv files into the process environment.
126
119
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
127
- loadDotEnvFiles(options);
120
+ loadDotEnvFiles(globalOptions);
128
121
 
129
122
  // Do this as the first thing so that any code reading it knows the right env.
130
123
  process.env.NODE_ENV = 'production';
131
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-d153f908.cjs.dev.js'); });
124
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-ecf933dc.cjs.dev.js'); });
132
125
  await loginCommand.default();
133
126
  });
134
127
 
135
128
  // 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 => {
129
+ 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 => {
130
+ const globalOptions = commander.program.opts();
131
+
140
132
  // Load dotenv files into the process environment.
141
133
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
142
- loadDotEnvFiles(options);
134
+ loadDotEnvFiles(globalOptions);
143
135
 
144
136
  // Do this as the first thing so that any code reading it knows the right env.
145
137
  process.env.NODE_ENV = 'production';
146
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-cec9f617.cjs.dev.js'); });
138
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-482a69fe.cjs.dev.js'); });
147
139
  await configSyncCommand.default(options);
148
140
  });
149
141
 
150
142
  // 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 => {
143
+ 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 => {
144
+ const globalOptions = commander.program.opts();
145
+
155
146
  // Load dotenv files into the process environment.
156
147
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
157
- loadDotEnvFiles(options);
148
+ loadDotEnvFiles(globalOptions);
158
149
 
159
150
  // Do this as the first thing so that any code reading it knows the right env.
160
151
  process.env.NODE_ENV = 'production';
161
- const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-2298680c.cjs.dev.js'); });
152
+ const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-14da3831.cjs.dev.js'); });
162
153
  await deploymentsSetCommand.default(options);
163
154
  });
164
- cli.help();
165
- cli.version(_package.pkgJson.version);
166
- cli.parse(process.argv, {
167
- run: false
168
- });
169
- await cli.runMatchedCommand();
155
+ commander.program.parse();
170
156
  }
171
157
 
172
158
  // 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-9161a458.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,7 @@ 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]', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
28
28
 
29
29
  // Makes the script crash on unhandled rejections instead of silently
30
30
  // ignoring them. In the future, promise rejections that are not handled will
@@ -36,19 +36,13 @@ process.on('unhandledRejection', err => {
36
36
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
37
37
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
38
38
  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
39
  // 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 => {
40
+ commander.program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
41
+ const globalOptions = commander.program.opts();
42
+
49
43
  // Load dotenv files into the process environment.
50
44
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
51
- loadDotEnvFiles(options);
45
+ loadDotEnvFiles(globalOptions);
52
46
 
53
47
  // Do this as the first thing so that any code reading it knows the right env.
54
48
  process.env.BABEL_ENV = 'development';
@@ -58,18 +52,16 @@ async function run() {
58
52
  console.log('Experimental Vite bundler enabled! 🚀');
59
53
  console.log('');
60
54
  }
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'); });
55
+ 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-5dc189f3.cjs.prod.js'); });
62
56
  await startCommand.default();
63
57
  });
64
58
 
65
59
  // 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 => {
60
+ 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 => {
61
+ const globalOptions = commander.program.opts();
70
62
  // Load dotenv files into the process environment.
71
63
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
72
- loadDotEnvFiles(options);
64
+ loadDotEnvFiles(globalOptions);
73
65
 
74
66
  // Do this as the first thing so that any code reading it knows the right env.
75
67
  process.env.BABEL_ENV = 'production';
@@ -79,7 +71,7 @@ async function run() {
79
71
  console.log('Experimental Vite bundler enabled! 🚀');
80
72
  console.log('');
81
73
  }
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'); });
74
+ 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-6bd0ac22.cjs.prod.js'); });
83
75
  await buildCommand.default();
84
76
  const shouldAlsoCompile = !options.buildOnly;
85
77
  if (shouldAlsoCompile) {
@@ -92,13 +84,12 @@ async function run() {
92
84
  });
93
85
 
94
86
  // 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 => {
87
+ 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 => {
88
+ const globalOptions = commander.program.opts();
89
+
99
90
  // Load dotenv files into the process environment.
100
91
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
101
- loadDotEnvFiles(options);
92
+ loadDotEnvFiles(globalOptions);
102
93
 
103
94
  // Do this as the first thing so that any code reading it knows the right env.
104
95
  process.env.NODE_ENV = 'production';
@@ -107,11 +98,12 @@ async function run() {
107
98
  });
108
99
 
109
100
  // 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 => {
101
+ commander.program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
102
+ const globalOptions = commander.program.opts();
103
+
112
104
  // Load dotenv files into the process environment.
113
105
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
114
- loadDotEnvFiles(options);
106
+ loadDotEnvFiles(globalOptions);
115
107
 
116
108
  // Do this as the first thing so that any code reading it knows the right env.
117
109
  process.env.NODE_ENV = 'production';
@@ -120,53 +112,47 @@ async function run() {
120
112
  });
121
113
 
122
114
  // 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 => {
115
+ 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 () => {
116
+ const globalOptions = commander.program.opts();
117
+
125
118
  // Load dotenv files into the process environment.
126
119
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
127
- loadDotEnvFiles(options);
120
+ loadDotEnvFiles(globalOptions);
128
121
 
129
122
  // Do this as the first thing so that any code reading it knows the right env.
130
123
  process.env.NODE_ENV = 'production';
131
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-e8e4a971.cjs.prod.js'); });
124
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-f13ca0a8.cjs.prod.js'); });
132
125
  await loginCommand.default();
133
126
  });
134
127
 
135
128
  // 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 => {
129
+ 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 => {
130
+ const globalOptions = commander.program.opts();
131
+
140
132
  // Load dotenv files into the process environment.
141
133
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
142
- loadDotEnvFiles(options);
134
+ loadDotEnvFiles(globalOptions);
143
135
 
144
136
  // Do this as the first thing so that any code reading it knows the right env.
145
137
  process.env.NODE_ENV = 'production';
146
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-b549b77d.cjs.prod.js'); });
138
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-d53518fd.cjs.prod.js'); });
147
139
  await configSyncCommand.default(options);
148
140
  });
149
141
 
150
142
  // 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 => {
143
+ 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 => {
144
+ const globalOptions = commander.program.opts();
145
+
155
146
  // Load dotenv files into the process environment.
156
147
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
157
- loadDotEnvFiles(options);
148
+ loadDotEnvFiles(globalOptions);
158
149
 
159
150
  // Do this as the first thing so that any code reading it knows the right env.
160
151
  process.env.NODE_ENV = 'production';
161
- const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-6b08140c.cjs.prod.js'); });
152
+ const deploymentsSetCommand = await Promise.resolve().then(function () { return require('../../dist/deployment-previews-set-b2dc5c83.cjs.prod.js'); });
162
153
  await deploymentsSetCommand.default(options);
163
154
  });
164
- cli.help();
165
- cli.version(_package.pkgJson.version);
166
- cli.parse(process.argv, {
167
- run: false
168
- });
169
- await cli.runMatchedCommand();
155
+ commander.program.parse();
170
156
  }
171
157
 
172
158
  // Load dotenv files into the process environment.
@@ -3,14 +3,14 @@ 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-fdee3971.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]', `(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.`);
14
14
 
15
15
  // Makes the script crash on unhandled rejections instead of silently
16
16
  // ignoring them. In the future, promise rejections that are not handled will
@@ -22,19 +22,13 @@ process.on('unhandledRejection', err => {
22
22
  // Get the current directory where the CLI is executed from. Usually this is the application folder.
23
23
  const applicationDirectory = fs.realpathSync(process.cwd());
24
24
  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
25
  // 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 => {
26
+ program.command('start').alias('dev').description('Starts the application in development mode using Webpack Dev Server.').action(async () => {
27
+ const globalOptions = program.opts();
28
+
35
29
  // Load dotenv files into the process environment.
36
30
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
37
- loadDotEnvFiles(options);
31
+ loadDotEnvFiles(globalOptions);
38
32
 
39
33
  // Do this as the first thing so that any code reading it knows the right env.
40
34
  process.env.BABEL_ENV = 'development';
@@ -44,18 +38,16 @@ async function run() {
44
38
  console.log('Experimental Vite bundler enabled! 🚀');
45
39
  console.log('');
46
40
  }
47
- const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-f09d98ea.esm.js') : await import('../../dist/start-b43eeb78.esm.js');
41
+ const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-91fe1256.esm.js') : await import('../../dist/start-13e3a0ba.esm.js');
48
42
  await startCommand.default();
49
43
  });
50
44
 
51
45
  // 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 => {
46
+ 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 => {
47
+ const globalOptions = program.opts();
56
48
  // Load dotenv files into the process environment.
57
49
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
58
- loadDotEnvFiles(options);
50
+ loadDotEnvFiles(globalOptions);
59
51
 
60
52
  // Do this as the first thing so that any code reading it knows the right env.
61
53
  process.env.BABEL_ENV = 'production';
@@ -65,7 +57,7 @@ async function run() {
65
57
  console.log('Experimental Vite bundler enabled! 🚀');
66
58
  console.log('');
67
59
  }
68
- const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-23f6852c.esm.js') : await import('../../dist/build-fac1279e.esm.js');
60
+ const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-23f6852c.esm.js') : await import('../../dist/build-d10bc41b.esm.js');
69
61
  await buildCommand.default();
70
62
  const shouldAlsoCompile = !options.buildOnly;
71
63
  if (shouldAlsoCompile) {
@@ -78,13 +70,12 @@ async function run() {
78
70
  });
79
71
 
80
72
  // 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 => {
73
+ 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 => {
74
+ const globalOptions = program.opts();
75
+
85
76
  // Load dotenv files into the process environment.
86
77
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
87
- loadDotEnvFiles(options);
78
+ loadDotEnvFiles(globalOptions);
88
79
 
89
80
  // Do this as the first thing so that any code reading it knows the right env.
90
81
  process.env.NODE_ENV = 'production';
@@ -93,11 +84,12 @@ async function run() {
93
84
  });
94
85
 
95
86
  // 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 => {
87
+ program.command('serve').description('Serves previously built and compiled application from the "public" folder.').action(async () => {
88
+ const globalOptions = program.opts();
89
+
98
90
  // Load dotenv files into the process environment.
99
91
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
100
- loadDotEnvFiles(options);
92
+ loadDotEnvFiles(globalOptions);
101
93
 
102
94
  // Do this as the first thing so that any code reading it knows the right env.
103
95
  process.env.NODE_ENV = 'production';
@@ -106,53 +98,47 @@ async function run() {
106
98
  });
107
99
 
108
100
  // 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 => {
101
+ 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 () => {
102
+ const globalOptions = program.opts();
103
+
111
104
  // Load dotenv files into the process environment.
112
105
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
113
- loadDotEnvFiles(options);
106
+ loadDotEnvFiles(globalOptions);
114
107
 
115
108
  // Do this as the first thing so that any code reading it knows the right env.
116
109
  process.env.NODE_ENV = 'production';
117
- const loginCommand = await import('../../dist/login-d15d9fc4.esm.js');
110
+ const loginCommand = await import('../../dist/login-35a7c23c.esm.js');
118
111
  await loginCommand.default();
119
112
  });
120
113
 
121
114
  // 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 => {
115
+ 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 => {
116
+ const globalOptions = program.opts();
117
+
126
118
  // Load dotenv files into the process environment.
127
119
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
128
- loadDotEnvFiles(options);
120
+ loadDotEnvFiles(globalOptions);
129
121
 
130
122
  // Do this as the first thing so that any code reading it knows the right env.
131
123
  process.env.NODE_ENV = 'production';
132
- const configSyncCommand = await import('../../dist/config-sync-ea04f13b.esm.js');
124
+ const configSyncCommand = await import('../../dist/config-sync-1b8ae40b.esm.js');
133
125
  await configSyncCommand.default(options);
134
126
  });
135
127
 
136
128
  // 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 => {
129
+ 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 => {
130
+ const globalOptions = program.opts();
131
+
141
132
  // Load dotenv files into the process environment.
142
133
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
143
- loadDotEnvFiles(options);
134
+ loadDotEnvFiles(globalOptions);
144
135
 
145
136
  // Do this as the first thing so that any code reading it knows the right env.
146
137
  process.env.NODE_ENV = 'production';
147
- const deploymentsSetCommand = await import('../../dist/deployment-previews-set-ff4443ed.esm.js');
138
+ const deploymentsSetCommand = await import('../../dist/deployment-previews-set-b6c92418.esm.js');
148
139
  await deploymentsSetCommand.default(options);
149
140
  });
150
- cli.help();
151
- cli.version(pkgJson.version);
152
- cli.parse(process.argv, {
153
- run: false
154
- });
155
- await cli.runMatchedCommand();
141
+ program.parse();
156
142
  }
157
143
 
158
144
  // 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-96a338d6.cjs.dev.js');
13
+ var createWebpackConfigForProduction = require('./create-webpack-config-for-production-c5364376.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-fe0eda38.cjs.dev.js');
44
44
  require('@babel/runtime-corejs3/helpers/slicedToArray');
45
- require('./package-cb608407.cjs.dev.js');
45
+ require('./package-68bccd43.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');
@@ -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-03fb373c.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-5e470fa7.cjs.prod.js');
44
44
  require('@babel/runtime-corejs3/helpers/slicedToArray');
45
- require('./package-d3324da3.cjs.prod.js');
45
+ require('./package-9161a458.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-98949ba8.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-c5cf6d30.esm.js';
42
42
  import '@babel/runtime-corejs3/helpers/slicedToArray';
43
- import './package-2ea64053.esm.js';
43
+ import './package-fdee3971.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';