@commercetools-frontend/mc-scripts 21.5.0 → 21.8.0

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 (144) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -42
  3. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +1 -0
  4. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
  5. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
  6. package/{build/config/application-runtime.js → application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js} +2 -2
  7. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
  8. package/application-runtime/package.json +4 -0
  9. package/bin/cli.js +1 -1
  10. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +1 -0
  11. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +354 -0
  12. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
  13. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +354 -0
  14. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +338 -0
  15. package/cli/package.json +4 -0
  16. package/config/create-webpack-config-for-development.js +7 -1
  17. package/config/create-webpack-config-for-production.js +7 -1
  18. package/config/vendors-to-transpile.js +5 -1
  19. package/dist/build-8582b673.esm.js +209 -0
  20. package/dist/build-9395925a.cjs.prod.js +224 -0
  21. package/dist/build-97278377.cjs.dev.js +224 -0
  22. package/dist/build-vite-6c987a60.cjs.dev.js +109 -0
  23. package/dist/build-vite-76d44332.cjs.prod.js +109 -0
  24. package/dist/build-vite-a9602b19.esm.js +97 -0
  25. package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +1 -0
  26. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +30 -0
  27. package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
  28. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +30 -0
  29. package/dist/commercetools-frontend-mc-scripts.esm.js +22 -0
  30. package/dist/compile-html-0c588a89.cjs.dev.js +93 -0
  31. package/dist/compile-html-4832f8c5.esm.js +83 -0
  32. package/dist/compile-html-7654b5e6.cjs.prod.js +93 -0
  33. package/dist/config-sync-20bc05e8.esm.js +868 -0
  34. package/dist/config-sync-62824317.cjs.prod.js +887 -0
  35. package/dist/config-sync-d52e73f6.cjs.dev.js +892 -0
  36. package/dist/create-postcss-config-4cbe10ab.cjs.dev.js +90 -0
  37. package/dist/create-postcss-config-8ea16440.cjs.prod.js +90 -0
  38. package/{build/config/create-postcss-config.js → dist/create-postcss-config-c1aa3525.esm.js} +27 -25
  39. package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-8a8b84d6.esm.js} +92 -56
  40. package/dist/create-webpack-config-for-development-a5e73092.cjs.prod.js +418 -0
  41. package/dist/create-webpack-config-for-development-e2735e02.cjs.dev.js +418 -0
  42. package/dist/create-webpack-config-for-production-4e7b56c0.cjs.prod.js +468 -0
  43. package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-7dc669e5.esm.js} +117 -52
  44. package/dist/create-webpack-config-for-production-d9bf281c.cjs.dev.js +468 -0
  45. package/dist/declarations/src/application-runtime.d.ts +1 -0
  46. package/dist/declarations/src/cli.d.ts +4 -0
  47. package/dist/declarations/src/commands/build-vite.d.ts +2 -0
  48. package/dist/declarations/src/commands/build.d.ts +2 -0
  49. package/dist/declarations/src/commands/compile-html.d.ts +3 -0
  50. package/dist/declarations/src/commands/config-sync.d.ts +3 -0
  51. package/dist/declarations/src/commands/login.d.ts +2 -0
  52. package/dist/declarations/src/commands/serve.d.ts +2 -0
  53. package/dist/declarations/src/commands/start-vite.d.ts +2 -0
  54. package/dist/declarations/src/commands/start.d.ts +2 -0
  55. package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
  56. package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
  57. package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
  58. package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
  59. package/dist/declarations/src/config/paths.d.ts +12 -0
  60. package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
  61. package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
  62. package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
  63. package/dist/declarations/src/generated/core.d.ts +710 -0
  64. package/dist/declarations/src/generated/settings.d.ts +2383 -0
  65. package/dist/declarations/src/index.d.ts +3 -0
  66. package/dist/declarations/src/postcss.d.ts +1 -0
  67. package/dist/declarations/src/types.d.ts +82 -0
  68. package/dist/declarations/src/utils/auth.d.ts +6 -0
  69. package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
  70. package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
  71. package/dist/declarations/src/utils/graphql-requests.d.ts +80 -0
  72. package/dist/declarations/src/utils/user-agent.d.ts +2 -0
  73. package/dist/declarations/src/version.d.ts +2 -0
  74. package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
  75. package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
  76. package/dist/declarations/src/webpack.d.ts +2 -0
  77. package/dist/has-jsx-runtime-0b03b72e.cjs.prod.js +17 -0
  78. package/dist/has-jsx-runtime-3d4bb633.cjs.dev.js +17 -0
  79. package/{build/config/has-jsx-runtime.js → dist/has-jsx-runtime-8314226e.esm.js} +1 -3
  80. package/dist/login-706ccc9a.cjs.prod.js +165 -0
  81. package/dist/login-779552b7.cjs.dev.js +165 -0
  82. package/dist/login-7d94659e.esm.js +155 -0
  83. package/dist/package-a98de907.esm.js +133 -0
  84. package/dist/package-aaf61bf0.cjs.dev.js +135 -0
  85. package/dist/package-b5c040f3.cjs.prod.js +135 -0
  86. package/dist/paths-16823f56.cjs.dev.js +55 -0
  87. package/dist/paths-76b66e74.cjs.prod.js +55 -0
  88. package/dist/paths-ed23d5a1.esm.js +46 -0
  89. package/dist/serve-12de323b.cjs.dev.js +70 -0
  90. package/dist/serve-784f4fcd.cjs.prod.js +70 -0
  91. package/dist/serve-d6b437b1.esm.js +62 -0
  92. package/dist/start-2b953ab0.cjs.dev.js +209 -0
  93. package/dist/start-e3ccd672.cjs.prod.js +209 -0
  94. package/dist/start-e924bd5d.esm.js +194 -0
  95. package/dist/start-vite-737bacca.cjs.dev.js +149 -0
  96. package/dist/start-vite-b0f58ae4.cjs.prod.js +149 -0
  97. package/dist/start-vite-ec5d40b5.esm.js +136 -0
  98. package/dist/user-agent-5da1830b.cjs.dev.js +106 -0
  99. package/dist/user-agent-8044acd6.esm.js +94 -0
  100. package/dist/user-agent-d18809af.cjs.prod.js +106 -0
  101. package/dist/vendors-to-transpile-367e0ba8.cjs.prod.js +5 -0
  102. package/dist/vendors-to-transpile-68e03526.esm.js +3 -0
  103. package/dist/vendors-to-transpile-b51af5d3.cjs.dev.js +5 -0
  104. package/package.json +50 -48
  105. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +1 -0
  106. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +14 -0
  107. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
  108. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +14 -0
  109. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +6 -0
  110. package/postcss/package.json +4 -0
  111. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +1 -0
  112. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +51 -0
  113. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
  114. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +51 -0
  115. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +42 -0
  116. package/webpack/package.json +4 -0
  117. package/build/bin/cli.js +0 -260
  118. package/build/commands/build-vite.js +0 -95
  119. package/build/commands/build.js +0 -140
  120. package/build/commands/compile-html.js +0 -53
  121. package/build/commands/config-sync.js +0 -171
  122. package/build/commands/login.js +0 -60
  123. package/build/commands/serve.js +0 -37
  124. package/build/commands/start-vite.js +0 -142
  125. package/build/commands/start.js +0 -108
  126. package/build/config/paths.js +0 -38
  127. package/build/config/vendors-to-transpile.js +0 -3
  128. package/build/config/webpack-dev-server.config.js +0 -71
  129. package/build/index.js +0 -16
  130. package/build/utils/auth.js +0 -34
  131. package/build/utils/auth.spec.js +0 -61
  132. package/build/utils/create-custom-application.settings.graphql +0 -8
  133. package/build/utils/credentials-storage.js +0 -72
  134. package/build/utils/credentials-storage.spec.js +0 -69
  135. package/build/utils/fetch-custom-application.settings.graphql +0 -35
  136. package/build/utils/fetch-user-organizations.core.graphql +0 -9
  137. package/build/utils/graphql-requests.js +0 -105
  138. package/build/utils/graphql-requests.spec.js +0 -159
  139. package/build/utils/require-graphql.js +0 -15
  140. package/build/utils/update-application-id-in-custom-application-config.js +0 -60
  141. package/build/utils/update-custom-application.settings.graphql +0 -13
  142. package/build/utils/user-agent.js +0 -15
  143. package/build/webpack-plugins/final-stats-writer-plugin.js +0 -50
  144. package/build/webpack-plugins/local-html-webpack-plugin.js +0 -38
@@ -0,0 +1,354 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
6
+ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
7
+ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
8
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
11
+ var fs = require('fs');
12
+ var path = require('path');
13
+ var cac = require('cac');
14
+ var dotenv = require('dotenv');
15
+ var dotenvExpand = require('dotenv-expand');
16
+ var _package = require('../../dist/package-b5c040f3.cjs.prod.js');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
19
+
20
+ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
21
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
22
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
23
+ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
24
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
25
+ var path__default = /*#__PURE__*/_interopDefault(path);
26
+ var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
27
+ var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
28
+
29
+ var cli = cac.cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
30
+ // ignoring them. In the future, promise rejections that are not handled will
31
+ // terminate the Node.js process with a non-zero exit code.
32
+
33
+ process.on('unhandledRejection', function (err) {
34
+ throw err;
35
+ }); // Get the current directory where the CLI is executed from. Usually this is the application folder.
36
+
37
+ var applicationDirectory = fs__default["default"].realpathSync(process.cwd());
38
+
39
+ var run = function run() {
40
+ cli.help();
41
+ cli.version(_package.pkgJson.version);
42
+ 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
43
+
44
+ cli.command('').action(function () {
45
+ cli.outputHelp();
46
+ }); // Command: start
47
+
48
+ cli.command('start', 'Starts the application in development mode using Webpack Dev Server.').alias('dev').action( /*#__PURE__*/function () {
49
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
50
+ var shouldUseExperimentalBundler, startCommand;
51
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
52
+ while (1) {
53
+ switch (_context.prev = _context.next) {
54
+ case 0:
55
+ // Load dotenv files into the process environment.
56
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
57
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
58
+
59
+ process.env.BABEL_ENV = 'development';
60
+ process.env.NODE_ENV = 'development';
61
+ shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
62
+
63
+ if (shouldUseExperimentalBundler) {
64
+ console.log('Experimental Vite bundler enabled! 🚀');
65
+ console.log('');
66
+ }
67
+
68
+ if (!shouldUseExperimentalBundler) {
69
+ _context.next = 11;
70
+ break;
71
+ }
72
+
73
+ _context.next = 8;
74
+ return Promise.resolve().then(function () { return require('../../dist/start-vite-b0f58ae4.cjs.prod.js'); });
75
+
76
+ case 8:
77
+ _context.t0 = _context.sent;
78
+ _context.next = 14;
79
+ break;
80
+
81
+ case 11:
82
+ _context.next = 13;
83
+ return Promise.resolve().then(function () { return require('../../dist/start-e3ccd672.cjs.prod.js'); });
84
+
85
+ case 13:
86
+ _context.t0 = _context.sent;
87
+
88
+ case 14:
89
+ startCommand = _context.t0;
90
+ _context.next = 17;
91
+ return startCommand.default();
92
+
93
+ case 17:
94
+ case "end":
95
+ return _context.stop();
96
+ }
97
+ }
98
+ }, _callee);
99
+ }));
100
+
101
+ return function (_x) {
102
+ return _ref.apply(this, arguments);
103
+ };
104
+ }()); // Command: build
105
+
106
+ cli.command('build', '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".').action( /*#__PURE__*/function () {
107
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(options) {
108
+ var shouldUseExperimentalBundler, buildCommand, shouldAlsoCompile, compileHtmlCommand;
109
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
110
+ while (1) {
111
+ switch (_context2.prev = _context2.next) {
112
+ case 0:
113
+ // Load dotenv files into the process environment.
114
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
115
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
116
+
117
+ process.env.BABEL_ENV = 'production';
118
+ process.env.NODE_ENV = 'production';
119
+ shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
120
+
121
+ if (shouldUseExperimentalBundler) {
122
+ console.log('Experimental Vite bundler enabled! 🚀');
123
+ console.warn('NOTE that the "cdnURL" value is not supported at the moment when using Vite.');
124
+ console.log('');
125
+ }
126
+
127
+ if (!shouldUseExperimentalBundler) {
128
+ _context2.next = 11;
129
+ break;
130
+ }
131
+
132
+ _context2.next = 8;
133
+ return Promise.resolve().then(function () { return require('../../dist/build-vite-76d44332.cjs.prod.js'); });
134
+
135
+ case 8:
136
+ _context2.t0 = _context2.sent;
137
+ _context2.next = 14;
138
+ break;
139
+
140
+ case 11:
141
+ _context2.next = 13;
142
+ return Promise.resolve().then(function () { return require('../../dist/build-9395925a.cjs.prod.js'); });
143
+
144
+ case 13:
145
+ _context2.t0 = _context2.sent;
146
+
147
+ case 14:
148
+ buildCommand = _context2.t0;
149
+ _context2.next = 17;
150
+ return buildCommand.default();
151
+
152
+ case 17:
153
+ shouldAlsoCompile = !options['build-only'];
154
+
155
+ if (!shouldAlsoCompile) {
156
+ _context2.next = 25;
157
+ break;
158
+ }
159
+
160
+ console.log('');
161
+ _context2.next = 22;
162
+ return Promise.resolve().then(function () { return require('../../dist/compile-html-7654b5e6.cjs.prod.js'); });
163
+
164
+ case 22:
165
+ compileHtmlCommand = _context2.sent;
166
+ _context2.next = 25;
167
+ return compileHtmlCommand.default();
168
+
169
+ case 25:
170
+ case "end":
171
+ return _context2.stop();
172
+ }
173
+ }
174
+ }, _callee2);
175
+ }));
176
+
177
+ return function (_x2) {
178
+ return _ref2.apply(this, arguments);
179
+ };
180
+ }()); // Command: compile-html
181
+
182
+ cli.command('compile-html', '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.').action( /*#__PURE__*/function () {
183
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(options) {
184
+ var compileHtmlCommand;
185
+ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
186
+ while (1) {
187
+ switch (_context3.prev = _context3.next) {
188
+ case 0:
189
+ // Load dotenv files into the process environment.
190
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
191
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
192
+
193
+ process.env.NODE_ENV = 'production';
194
+ _context3.next = 4;
195
+ return Promise.resolve().then(function () { return require('../../dist/compile-html-7654b5e6.cjs.prod.js'); });
196
+
197
+ case 4:
198
+ compileHtmlCommand = _context3.sent;
199
+ _context3.next = 7;
200
+ return compileHtmlCommand.default(options);
201
+
202
+ case 7:
203
+ case "end":
204
+ return _context3.stop();
205
+ }
206
+ }
207
+ }, _callee3);
208
+ }));
209
+
210
+ return function (_x3) {
211
+ return _ref3.apply(this, arguments);
212
+ };
213
+ }()); // Command: serve
214
+
215
+ cli.command('serve', 'Serves previously built and compiled application from the "public" folder.').action( /*#__PURE__*/function () {
216
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(options) {
217
+ var serveCommand;
218
+ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
219
+ while (1) {
220
+ switch (_context4.prev = _context4.next) {
221
+ case 0:
222
+ // Load dotenv files into the process environment.
223
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
224
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
225
+
226
+ process.env.NODE_ENV = 'production';
227
+ _context4.next = 4;
228
+ return Promise.resolve().then(function () { return require('../../dist/serve-784f4fcd.cjs.prod.js'); });
229
+
230
+ case 4:
231
+ serveCommand = _context4.sent;
232
+ _context4.next = 7;
233
+ return serveCommand.default();
234
+
235
+ case 7:
236
+ case "end":
237
+ return _context4.stop();
238
+ }
239
+ }
240
+ }, _callee4);
241
+ }));
242
+
243
+ return function (_x4) {
244
+ return _ref4.apply(this, arguments);
245
+ };
246
+ }()); // Command: login
247
+
248
+ cli.command('login', '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.').action( /*#__PURE__*/function () {
249
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(options) {
250
+ var loginCommand;
251
+ return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) {
252
+ while (1) {
253
+ switch (_context5.prev = _context5.next) {
254
+ case 0:
255
+ // Load dotenv files into the process environment.
256
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
257
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
258
+
259
+ process.env.NODE_ENV = 'production';
260
+ _context5.next = 4;
261
+ return Promise.resolve().then(function () { return require('../../dist/login-706ccc9a.cjs.prod.js'); });
262
+
263
+ case 4:
264
+ loginCommand = _context5.sent;
265
+ _context5.next = 7;
266
+ return loginCommand.default();
267
+
268
+ case 7:
269
+ case "end":
270
+ return _context5.stop();
271
+ }
272
+ }
273
+ }, _callee5);
274
+ }));
275
+
276
+ return function (_x5) {
277
+ return _ref5.apply(this, arguments);
278
+ };
279
+ }()); // Command: config:sync
280
+
281
+ cli.command('config:sync', '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.').option('--dry-run', '(optional) Executes the command but does not send any mutation request.').action( /*#__PURE__*/function () {
282
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(options) {
283
+ var configSyncCommand;
284
+ return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
285
+ while (1) {
286
+ switch (_context6.prev = _context6.next) {
287
+ case 0:
288
+ // Load dotenv files into the process environment.
289
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
290
+ loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
291
+
292
+ process.env.NODE_ENV = 'production';
293
+ _context6.next = 4;
294
+ return Promise.resolve().then(function () { return require('../../dist/config-sync-62824317.cjs.prod.js'); });
295
+
296
+ case 4:
297
+ configSyncCommand = _context6.sent;
298
+ _context6.next = 7;
299
+ return configSyncCommand.default(options);
300
+
301
+ case 7:
302
+ case "end":
303
+ return _context6.stop();
304
+ }
305
+ }
306
+ }, _callee6);
307
+ }));
308
+
309
+ return function (_x6) {
310
+ return _ref6.apply(this, arguments);
311
+ };
312
+ }());
313
+ cli.parse();
314
+ }; // Load dotenv files into the process environment.
315
+ // This is essentially what `dotenv-cli` does, but it's now built into this CLI.
316
+ // Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
317
+
318
+
319
+ function loadDotEnvFiles(globalOptions) {
320
+ var _context7;
321
+
322
+ var environment = process.env.MC_APP_ENV || "production";
323
+ var dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
324
+
325
+ if (typeof globalOptions.env === 'string') {
326
+ dotenvFiles.push(globalOptions.env);
327
+ } else if (_Array$isArray__default["default"](globalOptions.env)) {
328
+ // Multiple `--env` options are allowed.
329
+ dotenvFiles.push.apply(dotenvFiles, _toConsumableArray(globalOptions.env));
330
+ } // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
331
+
332
+
333
+ dotenvFiles.push.apply(dotenvFiles, _toConsumableArray(_filterInstanceProperty__default["default"](_context7 = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
334
+ // since normally you expect tests to produce the same
335
+ // results for everyone
336
+ ".env.local", ".env.".concat(environment), '.env']).call(_context7, Boolean))); // Load environment variables from .env* files. Suppress warnings using silent
337
+ // if this file is missing. dotenv will never modify any environment variables
338
+ // that have already been set. Variable expansion is supported in .env files.
339
+ // https://github.com/motdotla/dotenv
340
+ // https://github.com/motdotla/dotenv-expand
341
+
342
+ _forEachInstanceProperty__default["default"](dotenvFiles).call(dotenvFiles, function (dotenvFile) {
343
+ var dotenvFilePath = path__default["default"].resolve(path__default["default"].join(applicationDirectory, dotenvFile));
344
+
345
+ if (fs__default["default"].existsSync(dotenvFilePath)) {
346
+ dotenvExpand__default["default"].expand(dotenv__default["default"].config({
347
+ path: dotenvFilePath
348
+ }));
349
+ }
350
+ });
351
+ }
352
+
353
+ exports.loadDotEnvFiles = loadDotEnvFiles;
354
+ exports.run = run;