@commercetools-frontend/mc-scripts 22.2.1 → 22.3.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 (62) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +51 -41
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +51 -41
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +51 -41
  4. package/dist/{build-72d9896f.esm.js → build-7993cea9.esm.js} +22 -31
  5. package/dist/{build-0ef080b9.cjs.prod.js → build-8c9e8a8b.cjs.prod.js} +22 -31
  6. package/dist/{build-4773d61a.cjs.dev.js → build-94dc48cd.cjs.dev.js} +22 -31
  7. package/dist/{build-vite-2dc2b366.cjs.prod.js → build-vite-1ba28dd8.cjs.prod.js} +18 -19
  8. package/dist/{build-vite-290aaf04.esm.js → build-vite-9de4820c.esm.js} +18 -19
  9. package/dist/{build-vite-b5c7ac91.cjs.dev.js → build-vite-e7a6315c.cjs.dev.js} +18 -19
  10. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -3
  11. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -3
  12. package/dist/commercetools-frontend-mc-scripts.esm.js +2 -3
  13. package/dist/{compile-html-41195e35.cjs.dev.js → compile-html-079067bd.cjs.prod.js} +1 -7
  14. package/dist/{compile-html-5abd78aa.cjs.prod.js → compile-html-3ff2fed0.cjs.dev.js} +1 -7
  15. package/dist/{compile-html-f9de842c.esm.js → compile-html-606b302e.esm.js} +1 -7
  16. package/dist/{config-sync-54299066.esm.js → config-sync-15f35d05.esm.js} +83 -194
  17. package/dist/{config-sync-c914ca7a.cjs.dev.js → config-sync-782033fb.cjs.dev.js} +83 -194
  18. package/dist/{config-sync-8e8e18a9.cjs.prod.js → config-sync-8f0326af.cjs.prod.js} +81 -193
  19. package/dist/{create-postcss-config-6277233e.cjs.prod.js → create-postcss-config-254aa0d9.cjs.prod.js} +9 -13
  20. package/dist/{create-postcss-config-a0659cf5.cjs.dev.js → create-postcss-config-aaff8b1e.cjs.dev.js} +9 -13
  21. package/dist/{create-postcss-config-f39f54b5.esm.js → create-postcss-config-e44b5231.esm.js} +9 -13
  22. package/dist/{create-webpack-config-for-development-9539f804.esm.js → create-webpack-config-for-development-12d3233c.esm.js} +46 -37
  23. package/dist/{create-webpack-config-for-development-9aa85081.cjs.dev.js → create-webpack-config-for-development-30914bb4.cjs.dev.js} +46 -37
  24. package/dist/{create-webpack-config-for-development-629a8982.cjs.prod.js → create-webpack-config-for-development-c90350a7.cjs.prod.js} +46 -37
  25. package/dist/{create-webpack-config-for-production-0fac47e1.cjs.dev.js → create-webpack-config-for-production-410e4748.cjs.dev.js} +37 -32
  26. package/dist/{create-webpack-config-for-production-4476fc5f.esm.js → create-webpack-config-for-production-487aa17d.esm.js} +37 -32
  27. package/dist/{create-webpack-config-for-production-84e2db7d.cjs.prod.js → create-webpack-config-for-production-48ef18fc.cjs.prod.js} +37 -32
  28. package/dist/{credentials-storage-da0754c9.cjs.dev.js → credentials-storage-935d3ca1.cjs.prod.js} +3 -15
  29. package/dist/{credentials-storage-fc0c59c3.cjs.prod.js → credentials-storage-a0ea2ecc.cjs.dev.js} +3 -15
  30. package/dist/{credentials-storage-5939dd35.esm.js → credentials-storage-beb854dd.esm.js} +3 -15
  31. package/dist/declarations/src/generated/settings.d.ts +90 -1172
  32. package/dist/{has-jsx-runtime-0b03b72e.cjs.prod.js → has-jsx-runtime-aa5d21ee.cjs.dev.js} +0 -2
  33. package/dist/{has-jsx-runtime-3d4bb633.cjs.dev.js → has-jsx-runtime-c3202df5.cjs.prod.js} +0 -2
  34. package/dist/{has-jsx-runtime-8314226e.esm.js → has-jsx-runtime-e3ecb09b.esm.js} +0 -2
  35. package/dist/{login-9f821336.cjs.dev.js → login-7b8b5027.cjs.prod.js} +12 -23
  36. package/dist/{login-d1c2268a.esm.js → login-c806579c.esm.js} +12 -23
  37. package/dist/{login-f747390f.cjs.prod.js → login-ceb541f1.cjs.dev.js} +12 -23
  38. package/dist/{package-83202e32.cjs.prod.js → package-4276a7a9.cjs.prod.js} +15 -13
  39. package/dist/{package-cc5b8665.cjs.dev.js → package-70894b4c.cjs.dev.js} +15 -13
  40. package/dist/{package-e6713e98.esm.js → package-834453bb.esm.js} +15 -13
  41. package/dist/{paths-284c77fb.cjs.prod.js → paths-854af5ef.cjs.prod.js} +8 -12
  42. package/dist/{paths-db35ac0f.cjs.dev.js → paths-d1febc82.cjs.dev.js} +8 -12
  43. package/dist/{paths-55c5d5a2.esm.js → paths-ded20ae1.esm.js} +8 -12
  44. package/dist/{serve-b8063204.cjs.dev.js → serve-12571b42.cjs.prod.js} +1 -2
  45. package/dist/{serve-660e2ee0.esm.js → serve-65b5a149.esm.js} +1 -2
  46. package/dist/{serve-41077dad.cjs.prod.js → serve-7339c495.cjs.dev.js} +1 -2
  47. package/dist/{start-33fd6d70.cjs.dev.js → start-03683a4d.cjs.dev.js} +26 -34
  48. package/dist/{start-f93c62f9.cjs.prod.js → start-763b3477.cjs.prod.js} +26 -34
  49. package/dist/{start-93205b87.esm.js → start-d3e82b50.esm.js} +26 -34
  50. package/dist/{start-vite-8f03b0df.cjs.dev.js → start-vite-3966d625.cjs.dev.js} +18 -17
  51. package/dist/{start-vite-324af14d.cjs.prod.js → start-vite-5c78605b.cjs.prod.js} +18 -17
  52. package/dist/{start-vite-7d10ae71.esm.js → start-vite-cf0213a1.esm.js} +18 -17
  53. package/dist/{vite-plugin-svgr-f17db78a.esm.js → vite-plugin-svgr-5c953fe7.esm.js} +1 -6
  54. package/dist/{vite-plugin-svgr-fdb37ccf.cjs.dev.js → vite-plugin-svgr-5eb1c511.cjs.dev.js} +1 -6
  55. package/dist/{vite-plugin-svgr-9a4e7f77.cjs.prod.js → vite-plugin-svgr-a732f8df.cjs.prod.js} +1 -6
  56. package/package.json +31 -17
  57. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  58. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  59. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  60. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +6 -6
  61. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +6 -6
  62. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +6 -6
@@ -10,7 +10,7 @@ var path = require('path');
10
10
  var cac = require('cac');
11
11
  var dotenv = require('dotenv');
12
12
  var dotenvExpand = require('dotenv-expand');
13
- var _package = require('../../dist/package-cc5b8665.cjs.dev.js');
13
+ var _package = require('../../dist/package-70894b4c.cjs.dev.js');
14
14
 
15
15
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
16
16
 
@@ -22,117 +22,126 @@ var path__default = /*#__PURE__*/_interopDefault(path);
22
22
  var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
23
23
  var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
24
24
 
25
- const cli = cac.cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
25
+ const cli = cac.cac('mc-scripts');
26
+
27
+ // Makes the script crash on unhandled rejections instead of silently
26
28
  // ignoring them. In the future, promise rejections that are not handled will
27
29
  // terminate the Node.js process with a non-zero exit code.
28
-
29
30
  process.on('unhandledRejection', err => {
30
31
  throw err;
31
- }); // Get the current directory where the CLI is executed from. Usually this is the application folder.
32
+ });
32
33
 
34
+ // Get the current directory where the CLI is executed from. Usually this is the application folder.
33
35
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
34
-
35
36
  async function run() {
36
- cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed."); // Default command
37
+ cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.");
37
38
 
39
+ // Default command
38
40
  cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
39
41
  cli.outputHelp();
40
- }); // Command: start
42
+ });
41
43
 
44
+ // Command: start
42
45
  const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
43
46
  cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action(async options => {
44
47
  // Load dotenv files into the process environment.
45
48
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
46
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
49
+ loadDotEnvFiles(options);
47
50
 
51
+ // Do this as the first thing so that any code reading it knows the right env.
48
52
  process.env.BABEL_ENV = 'development';
49
53
  process.env.NODE_ENV = 'development';
50
54
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
51
-
52
55
  if (shouldUseExperimentalBundler) {
53
56
  console.log('Experimental Vite bundler enabled! 🚀');
54
57
  console.log('');
55
58
  }
56
-
57
- const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-8f03b0df.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-33fd6d70.cjs.dev.js'); });
59
+ const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-3966d625.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-03683a4d.cjs.dev.js'); });
58
60
  await startCommand.default();
59
- }); // Command: build
61
+ });
60
62
 
63
+ // Command: build
61
64
  const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
62
65
  cli.command('build', usageBuild).usage("\n\n ".concat(usageBuild)).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
63
66
  default: false
64
67
  }).action(async options => {
65
68
  // Load dotenv files into the process environment.
66
69
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
67
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
70
+ loadDotEnvFiles(options);
68
71
 
72
+ // Do this as the first thing so that any code reading it knows the right env.
69
73
  process.env.BABEL_ENV = 'production';
70
74
  process.env.NODE_ENV = 'production';
71
75
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
72
-
73
76
  if (shouldUseExperimentalBundler) {
74
77
  console.log('Experimental Vite bundler enabled! 🚀');
75
78
  console.log('');
76
79
  }
77
-
78
- const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-b5c7ac91.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-4773d61a.cjs.dev.js'); });
80
+ const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-e7a6315c.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-94dc48cd.cjs.dev.js'); });
79
81
  await buildCommand.default();
80
82
  const shouldAlsoCompile = !options.buildOnly;
81
-
82
83
  if (shouldAlsoCompile) {
83
84
  console.log('');
84
- const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-41195e35.cjs.dev.js'); });
85
+ const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-3ff2fed0.cjs.dev.js'); });
85
86
  await compileHtmlCommand.default({
86
87
  printSecurityHeaders: false
87
88
  });
88
89
  }
89
- }); // Command: compile-html
90
+ });
90
91
 
92
+ // Command: compile-html
91
93
  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".';
92
94
  cli.command('compile-html', usageCompileHtml).usage("\n\n ".concat(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.', {
93
95
  default: false
94
96
  }).action(async options => {
95
97
  // Load dotenv files into the process environment.
96
98
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
97
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
99
+ loadDotEnvFiles(options);
98
100
 
101
+ // Do this as the first thing so that any code reading it knows the right env.
99
102
  process.env.NODE_ENV = 'production';
100
- const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-41195e35.cjs.dev.js'); });
103
+ const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-3ff2fed0.cjs.dev.js'); });
101
104
  await compileHtmlCommand.default(options);
102
- }); // Command: serve
105
+ });
103
106
 
107
+ // Command: serve
104
108
  const usageServe = 'Serves previously built and compiled application from the "public" folder.';
105
109
  cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action(async options => {
106
110
  // Load dotenv files into the process environment.
107
111
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
108
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
112
+ loadDotEnvFiles(options);
109
113
 
114
+ // Do this as the first thing so that any code reading it knows the right env.
110
115
  process.env.NODE_ENV = 'production';
111
- const serveCommand = await Promise.resolve().then(function () { return require('../../dist/serve-b8063204.cjs.dev.js'); });
116
+ const serveCommand = await Promise.resolve().then(function () { return require('../../dist/serve-7339c495.cjs.dev.js'); });
112
117
  await serveCommand.default();
113
- }); // Command: login
118
+ });
114
119
 
120
+ // Command: login
115
121
  const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Custom Application config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
116
122
  cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action(async options => {
117
123
  // Load dotenv files into the process environment.
118
124
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
119
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
125
+ loadDotEnvFiles(options);
120
126
 
127
+ // Do this as the first thing so that any code reading it knows the right env.
121
128
  process.env.NODE_ENV = 'production';
122
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-9f821336.cjs.dev.js'); });
129
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-ceb541f1.cjs.dev.js'); });
123
130
  await loginCommand.default();
124
- }); // Command: config:sync
131
+ });
125
132
 
133
+ // Command: config:sync
126
134
  const usageConfigSync = 'Synchronizes the local Custom Application config with the Merchant Center. A new Custom Application will be created if none existed, otherwise it will be updated.';
127
135
  cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
128
136
  default: false
129
137
  }).action(async options => {
130
138
  // Load dotenv files into the process environment.
131
139
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
132
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
140
+ loadDotEnvFiles(options);
133
141
 
142
+ // Do this as the first thing so that any code reading it knows the right env.
134
143
  process.env.NODE_ENV = 'production';
135
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-c914ca7a.cjs.dev.js'); });
144
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-782033fb.cjs.dev.js'); });
136
145
  await configSyncCommand.default(options);
137
146
  });
138
147
  cli.help();
@@ -141,37 +150,38 @@ async function run() {
141
150
  run: false
142
151
  });
143
152
  await cli.runMatchedCommand();
144
- } // Load dotenv files into the process environment.
153
+ }
154
+
155
+ // Load dotenv files into the process environment.
145
156
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
146
157
  // Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
147
-
148
-
149
158
  function loadDotEnvFiles(globalOptions) {
150
159
  var _context;
151
-
152
160
  const environment = process.env.MC_APP_ENV || process.env.NODE_ENV;
153
- const dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
161
+ const dotenvFiles = [];
154
162
 
163
+ // Custom dotenv files specified by the `--env` option takes precedence.
155
164
  if (typeof globalOptions.env === 'string') {
156
165
  dotenvFiles.push(globalOptions.env);
157
166
  } else if (_Array$isArray__default["default"](globalOptions.env)) {
158
167
  // Multiple `--env` options are allowed.
159
168
  dotenvFiles.push(...globalOptions.env);
160
- } // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
161
-
169
+ }
162
170
 
163
- dotenvFiles.push(..._filterInstanceProperty__default["default"](_context = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
171
+ // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
172
+ dotenvFiles.push(..._filterInstanceProperty__default["default"](_context = [".env.".concat(environment, ".local"),
173
+ // Don't include `.env.local` for `test` environment
164
174
  // since normally you expect tests to produce the same
165
175
  // results for everyone
166
- process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean)); // Load environment variables from .env* files. Suppress warnings using silent
176
+ process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean));
177
+
178
+ // Load environment variables from .env* files. Suppress warnings using silent
167
179
  // if this file is missing. dotenv will never modify any environment variables
168
180
  // that have already been set. Variable expansion is supported in .env files.
169
181
  // https://github.com/motdotla/dotenv
170
182
  // https://github.com/motdotla/dotenv-expand
171
-
172
183
  _forEachInstanceProperty__default["default"](dotenvFiles).call(dotenvFiles, dotenvFile => {
173
184
  const dotenvFilePath = path__default["default"].resolve(path__default["default"].join(applicationDirectory, dotenvFile));
174
-
175
185
  if (fs__default["default"].existsSync(dotenvFilePath)) {
176
186
  dotenvExpand__default["default"].expand(dotenv__default["default"].config({
177
187
  path: dotenvFilePath
@@ -10,7 +10,7 @@ var path = require('path');
10
10
  var cac = require('cac');
11
11
  var dotenv = require('dotenv');
12
12
  var dotenvExpand = require('dotenv-expand');
13
- var _package = require('../../dist/package-83202e32.cjs.prod.js');
13
+ var _package = require('../../dist/package-4276a7a9.cjs.prod.js');
14
14
 
15
15
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
16
16
 
@@ -22,117 +22,126 @@ var path__default = /*#__PURE__*/_interopDefault(path);
22
22
  var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
23
23
  var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
24
24
 
25
- const cli = cac.cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
25
+ const cli = cac.cac('mc-scripts');
26
+
27
+ // Makes the script crash on unhandled rejections instead of silently
26
28
  // ignoring them. In the future, promise rejections that are not handled will
27
29
  // terminate the Node.js process with a non-zero exit code.
28
-
29
30
  process.on('unhandledRejection', err => {
30
31
  throw err;
31
- }); // Get the current directory where the CLI is executed from. Usually this is the application folder.
32
+ });
32
33
 
34
+ // Get the current directory where the CLI is executed from. Usually this is the application folder.
33
35
  const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
34
-
35
36
  async function run() {
36
- cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed."); // Default command
37
+ cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.");
37
38
 
39
+ // Default command
38
40
  cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
39
41
  cli.outputHelp();
40
- }); // Command: start
42
+ });
41
43
 
44
+ // Command: start
42
45
  const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
43
46
  cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action(async options => {
44
47
  // Load dotenv files into the process environment.
45
48
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
46
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
49
+ loadDotEnvFiles(options);
47
50
 
51
+ // Do this as the first thing so that any code reading it knows the right env.
48
52
  process.env.BABEL_ENV = 'development';
49
53
  process.env.NODE_ENV = 'development';
50
54
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
51
-
52
55
  if (shouldUseExperimentalBundler) {
53
56
  console.log('Experimental Vite bundler enabled! 🚀');
54
57
  console.log('');
55
58
  }
56
-
57
- const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-324af14d.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-f93c62f9.cjs.prod.js'); });
59
+ const startCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/start-vite-5c78605b.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/start-763b3477.cjs.prod.js'); });
58
60
  await startCommand.default();
59
- }); // Command: build
61
+ });
60
62
 
63
+ // Command: build
61
64
  const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
62
65
  cli.command('build', usageBuild).usage("\n\n ".concat(usageBuild)).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
63
66
  default: false
64
67
  }).action(async options => {
65
68
  // Load dotenv files into the process environment.
66
69
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
67
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
70
+ loadDotEnvFiles(options);
68
71
 
72
+ // Do this as the first thing so that any code reading it knows the right env.
69
73
  process.env.BABEL_ENV = 'production';
70
74
  process.env.NODE_ENV = 'production';
71
75
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
72
-
73
76
  if (shouldUseExperimentalBundler) {
74
77
  console.log('Experimental Vite bundler enabled! 🚀');
75
78
  console.log('');
76
79
  }
77
-
78
- const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-2dc2b366.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-0ef080b9.cjs.prod.js'); });
80
+ const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-1ba28dd8.cjs.prod.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-8c9e8a8b.cjs.prod.js'); });
79
81
  await buildCommand.default();
80
82
  const shouldAlsoCompile = !options.buildOnly;
81
-
82
83
  if (shouldAlsoCompile) {
83
84
  console.log('');
84
- const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-5abd78aa.cjs.prod.js'); });
85
+ const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-079067bd.cjs.prod.js'); });
85
86
  await compileHtmlCommand.default({
86
87
  printSecurityHeaders: false
87
88
  });
88
89
  }
89
- }); // Command: compile-html
90
+ });
90
91
 
92
+ // Command: compile-html
91
93
  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".';
92
94
  cli.command('compile-html', usageCompileHtml).usage("\n\n ".concat(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.', {
93
95
  default: false
94
96
  }).action(async options => {
95
97
  // Load dotenv files into the process environment.
96
98
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
97
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
99
+ loadDotEnvFiles(options);
98
100
 
101
+ // Do this as the first thing so that any code reading it knows the right env.
99
102
  process.env.NODE_ENV = 'production';
100
- const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-5abd78aa.cjs.prod.js'); });
103
+ const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-079067bd.cjs.prod.js'); });
101
104
  await compileHtmlCommand.default(options);
102
- }); // Command: serve
105
+ });
103
106
 
107
+ // Command: serve
104
108
  const usageServe = 'Serves previously built and compiled application from the "public" folder.';
105
109
  cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action(async options => {
106
110
  // Load dotenv files into the process environment.
107
111
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
108
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
112
+ loadDotEnvFiles(options);
109
113
 
114
+ // Do this as the first thing so that any code reading it knows the right env.
110
115
  process.env.NODE_ENV = 'production';
111
- const serveCommand = await Promise.resolve().then(function () { return require('../../dist/serve-41077dad.cjs.prod.js'); });
116
+ const serveCommand = await Promise.resolve().then(function () { return require('../../dist/serve-12571b42.cjs.prod.js'); });
112
117
  await serveCommand.default();
113
- }); // Command: login
118
+ });
114
119
 
120
+ // Command: login
115
121
  const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Custom Application config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
116
122
  cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action(async options => {
117
123
  // Load dotenv files into the process environment.
118
124
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
119
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
125
+ loadDotEnvFiles(options);
120
126
 
127
+ // Do this as the first thing so that any code reading it knows the right env.
121
128
  process.env.NODE_ENV = 'production';
122
- const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-f747390f.cjs.prod.js'); });
129
+ const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-7b8b5027.cjs.prod.js'); });
123
130
  await loginCommand.default();
124
- }); // Command: config:sync
131
+ });
125
132
 
133
+ // Command: config:sync
126
134
  const usageConfigSync = 'Synchronizes the local Custom Application config with the Merchant Center. A new Custom Application will be created if none existed, otherwise it will be updated.';
127
135
  cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
128
136
  default: false
129
137
  }).action(async options => {
130
138
  // Load dotenv files into the process environment.
131
139
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
132
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
140
+ loadDotEnvFiles(options);
133
141
 
142
+ // Do this as the first thing so that any code reading it knows the right env.
134
143
  process.env.NODE_ENV = 'production';
135
- const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-8e8e18a9.cjs.prod.js'); });
144
+ const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-8f0326af.cjs.prod.js'); });
136
145
  await configSyncCommand.default(options);
137
146
  });
138
147
  cli.help();
@@ -141,37 +150,38 @@ async function run() {
141
150
  run: false
142
151
  });
143
152
  await cli.runMatchedCommand();
144
- } // Load dotenv files into the process environment.
153
+ }
154
+
155
+ // Load dotenv files into the process environment.
145
156
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
146
157
  // Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
147
-
148
-
149
158
  function loadDotEnvFiles(globalOptions) {
150
159
  var _context;
151
-
152
160
  const environment = process.env.MC_APP_ENV || "production";
153
- const dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
161
+ const dotenvFiles = [];
154
162
 
163
+ // Custom dotenv files specified by the `--env` option takes precedence.
155
164
  if (typeof globalOptions.env === 'string') {
156
165
  dotenvFiles.push(globalOptions.env);
157
166
  } else if (_Array$isArray__default["default"](globalOptions.env)) {
158
167
  // Multiple `--env` options are allowed.
159
168
  dotenvFiles.push(...globalOptions.env);
160
- } // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
161
-
169
+ }
162
170
 
163
- dotenvFiles.push(..._filterInstanceProperty__default["default"](_context = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
171
+ // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
172
+ dotenvFiles.push(..._filterInstanceProperty__default["default"](_context = [".env.".concat(environment, ".local"),
173
+ // Don't include `.env.local` for `test` environment
164
174
  // since normally you expect tests to produce the same
165
175
  // results for everyone
166
- ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean)); // Load environment variables from .env* files. Suppress warnings using silent
176
+ ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean));
177
+
178
+ // Load environment variables from .env* files. Suppress warnings using silent
167
179
  // if this file is missing. dotenv will never modify any environment variables
168
180
  // that have already been set. Variable expansion is supported in .env files.
169
181
  // https://github.com/motdotla/dotenv
170
182
  // https://github.com/motdotla/dotenv-expand
171
-
172
183
  _forEachInstanceProperty__default["default"](dotenvFiles).call(dotenvFiles, dotenvFile => {
173
184
  const dotenvFilePath = path__default["default"].resolve(path__default["default"].join(applicationDirectory, dotenvFile));
174
-
175
185
  if (fs__default["default"].existsSync(dotenvFilePath)) {
176
186
  dotenvExpand__default["default"].expand(dotenv__default["default"].config({
177
187
  path: dotenvFilePath
@@ -6,119 +6,128 @@ import path from 'path';
6
6
  import { cac } from 'cac';
7
7
  import dotenv from 'dotenv';
8
8
  import dotenvExpand from 'dotenv-expand';
9
- import { p as pkgJson } from '../../dist/package-e6713e98.esm.js';
9
+ import { p as pkgJson } from '../../dist/package-834453bb.esm.js';
10
10
 
11
- const cli = cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
11
+ const cli = cac('mc-scripts');
12
+
13
+ // Makes the script crash on unhandled rejections instead of silently
12
14
  // ignoring them. In the future, promise rejections that are not handled will
13
15
  // terminate the Node.js process with a non-zero exit code.
14
-
15
16
  process.on('unhandledRejection', err => {
16
17
  throw err;
17
- }); // Get the current directory where the CLI is executed from. Usually this is the application folder.
18
+ });
18
19
 
20
+ // Get the current directory where the CLI is executed from. Usually this is the application folder.
19
21
  const applicationDirectory = fs.realpathSync(process.cwd());
20
-
21
22
  async function run() {
22
- cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed."); // Default command
23
+ cli.option('--env <path>', "(optional) Parses the file path as a dotenv file and adds the variables to the environment. Multiple flags are allowed.");
23
24
 
25
+ // Default command
24
26
  cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
25
27
  cli.outputHelp();
26
- }); // Command: start
28
+ });
27
29
 
30
+ // Command: start
28
31
  const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
29
32
  cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action(async options => {
30
33
  // Load dotenv files into the process environment.
31
34
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
32
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
35
+ loadDotEnvFiles(options);
33
36
 
37
+ // Do this as the first thing so that any code reading it knows the right env.
34
38
  process.env.BABEL_ENV = 'development';
35
39
  process.env.NODE_ENV = 'development';
36
40
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
37
-
38
41
  if (shouldUseExperimentalBundler) {
39
42
  console.log('Experimental Vite bundler enabled! 🚀');
40
43
  console.log('');
41
44
  }
42
-
43
- const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-7d10ae71.esm.js') : await import('../../dist/start-93205b87.esm.js');
45
+ const startCommand = shouldUseExperimentalBundler ? await import('../../dist/start-vite-cf0213a1.esm.js') : await import('../../dist/start-d3e82b50.esm.js');
44
46
  await startCommand.default();
45
- }); // Command: build
47
+ });
46
48
 
49
+ // Command: build
47
50
  const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
48
51
  cli.command('build', usageBuild).usage("\n\n ".concat(usageBuild)).option('--build-only', '(optional) If defined, the command only creates the production bundles without compiling the "index.html".', {
49
52
  default: false
50
53
  }).action(async options => {
51
54
  // Load dotenv files into the process environment.
52
55
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
53
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
56
+ loadDotEnvFiles(options);
54
57
 
58
+ // Do this as the first thing so that any code reading it knows the right env.
55
59
  process.env.BABEL_ENV = 'production';
56
60
  process.env.NODE_ENV = 'production';
57
61
  const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
58
-
59
62
  if (shouldUseExperimentalBundler) {
60
63
  console.log('Experimental Vite bundler enabled! 🚀');
61
64
  console.log('');
62
65
  }
63
-
64
- const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-290aaf04.esm.js') : await import('../../dist/build-72d9896f.esm.js');
66
+ const buildCommand = shouldUseExperimentalBundler ? await import('../../dist/build-vite-9de4820c.esm.js') : await import('../../dist/build-7993cea9.esm.js');
65
67
  await buildCommand.default();
66
68
  const shouldAlsoCompile = !options.buildOnly;
67
-
68
69
  if (shouldAlsoCompile) {
69
70
  console.log('');
70
- const compileHtmlCommand = await import('../../dist/compile-html-f9de842c.esm.js');
71
+ const compileHtmlCommand = await import('../../dist/compile-html-606b302e.esm.js');
71
72
  await compileHtmlCommand.default({
72
73
  printSecurityHeaders: false
73
74
  });
74
75
  }
75
- }); // Command: compile-html
76
+ });
76
77
 
78
+ // Command: compile-html
77
79
  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".';
78
80
  cli.command('compile-html', usageCompileHtml).usage("\n\n ".concat(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.', {
79
81
  default: false
80
82
  }).action(async options => {
81
83
  // Load dotenv files into the process environment.
82
84
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
83
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
85
+ loadDotEnvFiles(options);
84
86
 
87
+ // Do this as the first thing so that any code reading it knows the right env.
85
88
  process.env.NODE_ENV = 'production';
86
- const compileHtmlCommand = await import('../../dist/compile-html-f9de842c.esm.js');
89
+ const compileHtmlCommand = await import('../../dist/compile-html-606b302e.esm.js');
87
90
  await compileHtmlCommand.default(options);
88
- }); // Command: serve
91
+ });
89
92
 
93
+ // Command: serve
90
94
  const usageServe = 'Serves previously built and compiled application from the "public" folder.';
91
95
  cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action(async options => {
92
96
  // Load dotenv files into the process environment.
93
97
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
94
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
98
+ loadDotEnvFiles(options);
95
99
 
100
+ // Do this as the first thing so that any code reading it knows the right env.
96
101
  process.env.NODE_ENV = 'production';
97
- const serveCommand = await import('../../dist/serve-660e2ee0.esm.js');
102
+ const serveCommand = await import('../../dist/serve-65b5a149.esm.js');
98
103
  await serveCommand.default();
99
- }); // Command: login
104
+ });
100
105
 
106
+ // Command: login
101
107
  const usageLogin = 'Log in to your Merchant Center account through the CLI, using the cloud environment information from the Custom Application config file. An API token is generated and stored in a configuration file for the related cloud environment, and valid for 36 hours.';
102
108
  cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action(async options => {
103
109
  // Load dotenv files into the process environment.
104
110
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
105
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
111
+ loadDotEnvFiles(options);
106
112
 
113
+ // Do this as the first thing so that any code reading it knows the right env.
107
114
  process.env.NODE_ENV = 'production';
108
- const loginCommand = await import('../../dist/login-d1c2268a.esm.js');
115
+ const loginCommand = await import('../../dist/login-c806579c.esm.js');
109
116
  await loginCommand.default();
110
- }); // Command: config:sync
117
+ });
111
118
 
119
+ // Command: config:sync
112
120
  const usageConfigSync = 'Synchronizes the local Custom Application config with the Merchant Center. A new Custom Application will be created if none existed, otherwise it will be updated.';
113
121
  cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
114
122
  default: false
115
123
  }).action(async options => {
116
124
  // Load dotenv files into the process environment.
117
125
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
118
- loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
126
+ loadDotEnvFiles(options);
119
127
 
128
+ // Do this as the first thing so that any code reading it knows the right env.
120
129
  process.env.NODE_ENV = 'production';
121
- const configSyncCommand = await import('../../dist/config-sync-54299066.esm.js');
130
+ const configSyncCommand = await import('../../dist/config-sync-15f35d05.esm.js');
122
131
  await configSyncCommand.default(options);
123
132
  });
124
133
  cli.help();
@@ -127,37 +136,38 @@ async function run() {
127
136
  run: false
128
137
  });
129
138
  await cli.runMatchedCommand();
130
- } // Load dotenv files into the process environment.
139
+ }
140
+
141
+ // Load dotenv files into the process environment.
131
142
  // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
132
143
  // Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
133
-
134
-
135
144
  function loadDotEnvFiles(globalOptions) {
136
145
  var _context;
137
-
138
146
  const environment = process.env.MC_APP_ENV || process.env.NODE_ENV;
139
- const dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
147
+ const dotenvFiles = [];
140
148
 
149
+ // Custom dotenv files specified by the `--env` option takes precedence.
141
150
  if (typeof globalOptions.env === 'string') {
142
151
  dotenvFiles.push(globalOptions.env);
143
152
  } else if (_Array$isArray(globalOptions.env)) {
144
153
  // Multiple `--env` options are allowed.
145
154
  dotenvFiles.push(...globalOptions.env);
146
- } // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
147
-
155
+ }
148
156
 
149
- dotenvFiles.push(..._filterInstanceProperty(_context = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
157
+ // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
158
+ dotenvFiles.push(..._filterInstanceProperty(_context = [".env.".concat(environment, ".local"),
159
+ // Don't include `.env.local` for `test` environment
150
160
  // since normally you expect tests to produce the same
151
161
  // results for everyone
152
- process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean)); // Load environment variables from .env* files. Suppress warnings using silent
162
+ process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean));
163
+
164
+ // Load environment variables from .env* files. Suppress warnings using silent
153
165
  // if this file is missing. dotenv will never modify any environment variables
154
166
  // that have already been set. Variable expansion is supported in .env files.
155
167
  // https://github.com/motdotla/dotenv
156
168
  // https://github.com/motdotla/dotenv-expand
157
-
158
169
  _forEachInstanceProperty(dotenvFiles).call(dotenvFiles, dotenvFile => {
159
170
  const dotenvFilePath = path.resolve(path.join(applicationDirectory, dotenvFile));
160
-
161
171
  if (fs.existsSync(dotenvFilePath)) {
162
172
  dotenvExpand.expand(dotenv.config({
163
173
  path: dotenvFilePath