@commercetools-frontend/mc-scripts 21.18.0 → 21.19.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.
- package/bin/cli.js +6 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +318 -295
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +318 -295
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +317 -294
- package/dist/{build-70142b7e.esm.js → build-20d77feb.esm.js} +3 -3
- package/dist/{build-5fb0fc10.cjs.prod.js → build-b1030e29.cjs.prod.js} +3 -3
- package/dist/{build-6f94dc3b.cjs.dev.js → build-c1a3c8cd.cjs.dev.js} +3 -3
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
- package/dist/{config-sync-5987fd39.cjs.dev.js → config-sync-2263c2ec.cjs.dev.js} +259 -137
- package/dist/{config-sync-0844f13b.esm.js → config-sync-6a39d2e3.esm.js} +255 -134
- package/dist/{config-sync-27736a53.cjs.prod.js → config-sync-edec607e.cjs.prod.js} +259 -137
- package/dist/{create-postcss-config-9b9a988c.cjs.dev.js → create-postcss-config-3a117693.cjs.dev.js} +1 -1
- package/dist/{create-postcss-config-0c7dbb5c.esm.js → create-postcss-config-6dcc86ab.esm.js} +1 -1
- package/dist/{create-postcss-config-b8604cd6.cjs.prod.js → create-postcss-config-ef589644.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-development-5b4f9f05.cjs.dev.js → create-webpack-config-for-development-28510e96.cjs.dev.js} +1 -1
- package/dist/{create-webpack-config-for-development-10c389cd.esm.js → create-webpack-config-for-development-a29fdeee.esm.js} +1 -1
- package/dist/{create-webpack-config-for-development-bd88930a.cjs.prod.js → create-webpack-config-for-development-fa017d55.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-production-e80b6fc7.cjs.prod.js → create-webpack-config-for-production-15e6365d.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-production-2c77e9fe.esm.js → create-webpack-config-for-production-39453789.esm.js} +1 -1
- package/dist/{create-webpack-config-for-production-48ad7e6a.cjs.dev.js → create-webpack-config-for-production-dfcafa81.cjs.dev.js} +1 -1
- package/dist/declarations/src/cli.d.ts +1 -1
- package/dist/declarations/src/utils/graphql-requests.d.ts +4 -8
- package/dist/{login-ce9906f4.esm.js → login-bdc2976a.esm.js} +17 -15
- package/dist/{login-c7baca5e.cjs.prod.js → login-dad3f3b8.cjs.prod.js} +17 -15
- package/dist/{login-bf79b277.cjs.dev.js → login-ed5c7f5e.cjs.dev.js} +17 -15
- package/dist/{package-663c0f80.cjs.prod.js → package-19e5588c.cjs.dev.js} +9 -8
- package/dist/{package-3ac48b2d.esm.js → package-47ad699b.esm.js} +9 -8
- package/dist/{package-bec920c0.cjs.dev.js → package-bbd49c17.cjs.prod.js} +9 -8
- package/dist/{start-70f1d650.cjs.dev.js → start-31119852.cjs.dev.js} +3 -3
- package/dist/{start-598dab76.esm.js → start-7ca70f00.esm.js} +3 -3
- package/dist/{start-9d376be4.cjs.prod.js → start-a2641c71.cjs.prod.js} +3 -3
- package/dist/{user-agent-cf9eb504.esm.js → user-agent-0a7ca83a.esm.js} +1 -1
- package/dist/{user-agent-d9cc2dfa.cjs.prod.js → user-agent-4b9aa874.cjs.prod.js} +1 -1
- package/dist/{user-agent-56268751.cjs.dev.js → user-agent-ff2423ef.cjs.dev.js} +1 -1
- package/package.json +9 -8
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime-corejs3/helpers/esm/toConsumableArray';
|
|
2
2
|
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
3
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
4
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
4
5
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
6
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
6
|
-
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { cac } from 'cac';
|
|
10
10
|
import dotenv from 'dotenv';
|
|
11
11
|
import dotenvExpand from 'dotenv-expand';
|
|
12
|
-
import { p as pkgJson } from '../../dist/package-
|
|
12
|
+
import { p as pkgJson } from '../../dist/package-47ad699b.esm.js';
|
|
13
13
|
|
|
14
14
|
var cli = cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
|
|
15
15
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
@@ -21,301 +21,324 @@ process.on('unhandledRejection', function (err) {
|
|
|
21
21
|
|
|
22
22
|
var applicationDirectory = fs.realpathSync(process.cwd());
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
cli.command('').usage('\n\n Develop and build Custom Applications.').action(function () {
|
|
28
|
-
cli.outputHelp();
|
|
29
|
-
}); // Command: start
|
|
30
|
-
|
|
31
|
-
var usageStart = 'Starts the application in development mode using Webpack Dev Server.';
|
|
32
|
-
cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action( /*#__PURE__*/function () {
|
|
33
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
34
|
-
var shouldUseExperimentalBundler, startCommand;
|
|
35
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
|
-
while (1) {
|
|
37
|
-
switch (_context.prev = _context.next) {
|
|
38
|
-
case 0:
|
|
39
|
-
// Load dotenv files into the process environment.
|
|
40
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
41
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
42
|
-
|
|
43
|
-
process.env.BABEL_ENV = 'development';
|
|
44
|
-
process.env.NODE_ENV = 'development';
|
|
45
|
-
shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
46
|
-
|
|
47
|
-
if (shouldUseExperimentalBundler) {
|
|
48
|
-
console.log('Experimental Vite bundler enabled! 🚀');
|
|
49
|
-
console.log('');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!shouldUseExperimentalBundler) {
|
|
53
|
-
_context.next = 11;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
_context.next = 8;
|
|
58
|
-
return import('../../dist/start-vite-dc046cba.esm.js');
|
|
59
|
-
|
|
60
|
-
case 8:
|
|
61
|
-
_context.t0 = _context.sent;
|
|
62
|
-
_context.next = 14;
|
|
63
|
-
break;
|
|
64
|
-
|
|
65
|
-
case 11:
|
|
66
|
-
_context.next = 13;
|
|
67
|
-
return import('../../dist/start-598dab76.esm.js');
|
|
68
|
-
|
|
69
|
-
case 13:
|
|
70
|
-
_context.t0 = _context.sent;
|
|
71
|
-
|
|
72
|
-
case 14:
|
|
73
|
-
startCommand = _context.t0;
|
|
74
|
-
_context.next = 17;
|
|
75
|
-
return startCommand.default();
|
|
76
|
-
|
|
77
|
-
case 17:
|
|
78
|
-
case "end":
|
|
79
|
-
return _context.stop();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}));
|
|
84
|
-
|
|
85
|
-
return function (_x) {
|
|
86
|
-
return _ref.apply(this, arguments);
|
|
87
|
-
};
|
|
88
|
-
}()); // Command: build
|
|
89
|
-
|
|
90
|
-
var usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
|
|
91
|
-
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".', {
|
|
92
|
-
default: false
|
|
93
|
-
}).action( /*#__PURE__*/function () {
|
|
94
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
95
|
-
var shouldUseExperimentalBundler, buildCommand, shouldAlsoCompile, compileHtmlCommand;
|
|
96
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
97
|
-
while (1) {
|
|
98
|
-
switch (_context2.prev = _context2.next) {
|
|
99
|
-
case 0:
|
|
100
|
-
// Load dotenv files into the process environment.
|
|
101
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
102
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
103
|
-
|
|
104
|
-
process.env.BABEL_ENV = 'production';
|
|
105
|
-
process.env.NODE_ENV = 'production';
|
|
106
|
-
shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
107
|
-
|
|
108
|
-
if (shouldUseExperimentalBundler) {
|
|
109
|
-
console.log('Experimental Vite bundler enabled! 🚀');
|
|
110
|
-
console.log('');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (!shouldUseExperimentalBundler) {
|
|
114
|
-
_context2.next = 11;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_context2.next = 8;
|
|
119
|
-
return import('../../dist/build-vite-93abdc95.esm.js');
|
|
120
|
-
|
|
121
|
-
case 8:
|
|
122
|
-
_context2.t0 = _context2.sent;
|
|
123
|
-
_context2.next = 14;
|
|
124
|
-
break;
|
|
125
|
-
|
|
126
|
-
case 11:
|
|
127
|
-
_context2.next = 13;
|
|
128
|
-
return import('../../dist/build-70142b7e.esm.js');
|
|
129
|
-
|
|
130
|
-
case 13:
|
|
131
|
-
_context2.t0 = _context2.sent;
|
|
132
|
-
|
|
133
|
-
case 14:
|
|
134
|
-
buildCommand = _context2.t0;
|
|
135
|
-
_context2.next = 17;
|
|
136
|
-
return buildCommand.default();
|
|
137
|
-
|
|
138
|
-
case 17:
|
|
139
|
-
shouldAlsoCompile = !options.buildOnly;
|
|
140
|
-
|
|
141
|
-
if (!shouldAlsoCompile) {
|
|
142
|
-
_context2.next = 25;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
console.log('');
|
|
147
|
-
_context2.next = 22;
|
|
148
|
-
return import('../../dist/compile-html-4361a0b3.esm.js');
|
|
149
|
-
|
|
150
|
-
case 22:
|
|
151
|
-
compileHtmlCommand = _context2.sent;
|
|
152
|
-
_context2.next = 25;
|
|
153
|
-
return compileHtmlCommand.default({
|
|
154
|
-
printSecurityHeaders: false
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
case 25:
|
|
158
|
-
case "end":
|
|
159
|
-
return _context2.stop();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}, _callee2);
|
|
163
|
-
}));
|
|
164
|
-
|
|
165
|
-
return function (_x2) {
|
|
166
|
-
return _ref2.apply(this, arguments);
|
|
167
|
-
};
|
|
168
|
-
}()); // Command: compile-html
|
|
169
|
-
|
|
170
|
-
var 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".';
|
|
171
|
-
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.', {
|
|
172
|
-
default: false
|
|
173
|
-
}).action( /*#__PURE__*/function () {
|
|
174
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
175
|
-
var compileHtmlCommand;
|
|
176
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
177
|
-
while (1) {
|
|
178
|
-
switch (_context3.prev = _context3.next) {
|
|
179
|
-
case 0:
|
|
180
|
-
// Load dotenv files into the process environment.
|
|
181
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
182
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
183
|
-
|
|
184
|
-
process.env.NODE_ENV = 'production';
|
|
185
|
-
_context3.next = 4;
|
|
186
|
-
return import('../../dist/compile-html-4361a0b3.esm.js');
|
|
187
|
-
|
|
188
|
-
case 4:
|
|
189
|
-
compileHtmlCommand = _context3.sent;
|
|
190
|
-
_context3.next = 7;
|
|
191
|
-
return compileHtmlCommand.default(options);
|
|
192
|
-
|
|
193
|
-
case 7:
|
|
194
|
-
case "end":
|
|
195
|
-
return _context3.stop();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}, _callee3);
|
|
199
|
-
}));
|
|
200
|
-
|
|
201
|
-
return function (_x3) {
|
|
202
|
-
return _ref3.apply(this, arguments);
|
|
203
|
-
};
|
|
204
|
-
}()); // Command: serve
|
|
205
|
-
|
|
206
|
-
var usageServe = 'Serves previously built and compiled application from the "public" folder.';
|
|
207
|
-
cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action( /*#__PURE__*/function () {
|
|
208
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(options) {
|
|
209
|
-
var serveCommand;
|
|
210
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
211
|
-
while (1) {
|
|
212
|
-
switch (_context4.prev = _context4.next) {
|
|
213
|
-
case 0:
|
|
214
|
-
// Load dotenv files into the process environment.
|
|
215
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
216
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
217
|
-
|
|
218
|
-
process.env.NODE_ENV = 'production';
|
|
219
|
-
_context4.next = 4;
|
|
220
|
-
return import('../../dist/serve-d6b437b1.esm.js');
|
|
221
|
-
|
|
222
|
-
case 4:
|
|
223
|
-
serveCommand = _context4.sent;
|
|
224
|
-
_context4.next = 7;
|
|
225
|
-
return serveCommand.default();
|
|
226
|
-
|
|
227
|
-
case 7:
|
|
228
|
-
case "end":
|
|
229
|
-
return _context4.stop();
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}, _callee4);
|
|
233
|
-
}));
|
|
234
|
-
|
|
235
|
-
return function (_x4) {
|
|
236
|
-
return _ref4.apply(this, arguments);
|
|
237
|
-
};
|
|
238
|
-
}()); // Command: login
|
|
239
|
-
|
|
240
|
-
var 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.';
|
|
241
|
-
cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action( /*#__PURE__*/function () {
|
|
242
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(options) {
|
|
243
|
-
var loginCommand;
|
|
244
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
245
|
-
while (1) {
|
|
246
|
-
switch (_context5.prev = _context5.next) {
|
|
247
|
-
case 0:
|
|
248
|
-
// Load dotenv files into the process environment.
|
|
249
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
250
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
251
|
-
|
|
252
|
-
process.env.NODE_ENV = 'production';
|
|
253
|
-
_context5.next = 4;
|
|
254
|
-
return import('../../dist/login-ce9906f4.esm.js');
|
|
255
|
-
|
|
256
|
-
case 4:
|
|
257
|
-
loginCommand = _context5.sent;
|
|
258
|
-
_context5.next = 7;
|
|
259
|
-
return loginCommand.default();
|
|
260
|
-
|
|
261
|
-
case 7:
|
|
262
|
-
case "end":
|
|
263
|
-
return _context5.stop();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, _callee5);
|
|
267
|
-
}));
|
|
268
|
-
|
|
269
|
-
return function (_x5) {
|
|
270
|
-
return _ref5.apply(this, arguments);
|
|
271
|
-
};
|
|
272
|
-
}()); // Command: config:sync
|
|
273
|
-
|
|
274
|
-
var 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.';
|
|
275
|
-
cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
|
|
276
|
-
default: false
|
|
277
|
-
}).action( /*#__PURE__*/function () {
|
|
278
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
|
|
279
|
-
var configSyncCommand;
|
|
280
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
281
|
-
while (1) {
|
|
282
|
-
switch (_context6.prev = _context6.next) {
|
|
283
|
-
case 0:
|
|
284
|
-
// Load dotenv files into the process environment.
|
|
285
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
286
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
287
|
-
|
|
288
|
-
process.env.NODE_ENV = 'production';
|
|
289
|
-
_context6.next = 4;
|
|
290
|
-
return import('../../dist/config-sync-0844f13b.esm.js');
|
|
291
|
-
|
|
292
|
-
case 4:
|
|
293
|
-
configSyncCommand = _context6.sent;
|
|
294
|
-
_context6.next = 7;
|
|
295
|
-
return configSyncCommand.default(options);
|
|
296
|
-
|
|
297
|
-
case 7:
|
|
298
|
-
case "end":
|
|
299
|
-
return _context6.stop();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}, _callee6);
|
|
303
|
-
}));
|
|
304
|
-
|
|
305
|
-
return function (_x6) {
|
|
306
|
-
return _ref6.apply(this, arguments);
|
|
307
|
-
};
|
|
308
|
-
}());
|
|
309
|
-
cli.help();
|
|
310
|
-
cli.version(pkgJson.version);
|
|
311
|
-
cli.parse();
|
|
312
|
-
}; // Load dotenv files into the process environment.
|
|
24
|
+
function run() {
|
|
25
|
+
return _run.apply(this, arguments);
|
|
26
|
+
} // Load dotenv files into the process environment.
|
|
313
27
|
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
314
28
|
// Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
|
|
315
29
|
|
|
316
30
|
|
|
31
|
+
function _run() {
|
|
32
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
33
|
+
var usageStart, usageBuild, usageCompileHtml, usageServe, usageLogin, usageConfigSync;
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
35
|
+
while (1) {
|
|
36
|
+
switch (_context8.prev = _context8.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
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
|
|
39
|
+
|
|
40
|
+
cli.command('').usage('\n\n Develop and build Custom Applications.').action(function () {
|
|
41
|
+
cli.outputHelp();
|
|
42
|
+
}); // Command: start
|
|
43
|
+
|
|
44
|
+
usageStart = 'Starts the application in development mode using Webpack Dev Server.';
|
|
45
|
+
cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action( /*#__PURE__*/function () {
|
|
46
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
47
|
+
var shouldUseExperimentalBundler, startCommand;
|
|
48
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
49
|
+
while (1) {
|
|
50
|
+
switch (_context2.prev = _context2.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
// Load dotenv files into the process environment.
|
|
53
|
+
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
54
|
+
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
55
|
+
|
|
56
|
+
process.env.BABEL_ENV = 'development';
|
|
57
|
+
process.env.NODE_ENV = 'development';
|
|
58
|
+
shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
59
|
+
|
|
60
|
+
if (shouldUseExperimentalBundler) {
|
|
61
|
+
console.log('Experimental Vite bundler enabled! 🚀');
|
|
62
|
+
console.log('');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!shouldUseExperimentalBundler) {
|
|
66
|
+
_context2.next = 11;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_context2.next = 8;
|
|
71
|
+
return import('../../dist/start-vite-dc046cba.esm.js');
|
|
72
|
+
|
|
73
|
+
case 8:
|
|
74
|
+
_context2.t0 = _context2.sent;
|
|
75
|
+
_context2.next = 14;
|
|
76
|
+
break;
|
|
77
|
+
|
|
78
|
+
case 11:
|
|
79
|
+
_context2.next = 13;
|
|
80
|
+
return import('../../dist/start-7ca70f00.esm.js');
|
|
81
|
+
|
|
82
|
+
case 13:
|
|
83
|
+
_context2.t0 = _context2.sent;
|
|
84
|
+
|
|
85
|
+
case 14:
|
|
86
|
+
startCommand = _context2.t0;
|
|
87
|
+
_context2.next = 17;
|
|
88
|
+
return startCommand.default();
|
|
89
|
+
|
|
90
|
+
case 17:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context2.stop();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, _callee);
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
return function (_x) {
|
|
99
|
+
return _ref.apply(this, arguments);
|
|
100
|
+
};
|
|
101
|
+
}()); // Command: build
|
|
102
|
+
|
|
103
|
+
usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
|
|
104
|
+
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".', {
|
|
105
|
+
default: false
|
|
106
|
+
}).action( /*#__PURE__*/function () {
|
|
107
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
108
|
+
var shouldUseExperimentalBundler, buildCommand, shouldAlsoCompile, compileHtmlCommand;
|
|
109
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
110
|
+
while (1) {
|
|
111
|
+
switch (_context3.prev = _context3.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.log('');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!shouldUseExperimentalBundler) {
|
|
127
|
+
_context3.next = 11;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
_context3.next = 8;
|
|
132
|
+
return import('../../dist/build-vite-93abdc95.esm.js');
|
|
133
|
+
|
|
134
|
+
case 8:
|
|
135
|
+
_context3.t0 = _context3.sent;
|
|
136
|
+
_context3.next = 14;
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
case 11:
|
|
140
|
+
_context3.next = 13;
|
|
141
|
+
return import('../../dist/build-20d77feb.esm.js');
|
|
142
|
+
|
|
143
|
+
case 13:
|
|
144
|
+
_context3.t0 = _context3.sent;
|
|
145
|
+
|
|
146
|
+
case 14:
|
|
147
|
+
buildCommand = _context3.t0;
|
|
148
|
+
_context3.next = 17;
|
|
149
|
+
return buildCommand.default();
|
|
150
|
+
|
|
151
|
+
case 17:
|
|
152
|
+
shouldAlsoCompile = !options.buildOnly;
|
|
153
|
+
|
|
154
|
+
if (!shouldAlsoCompile) {
|
|
155
|
+
_context3.next = 25;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
console.log('');
|
|
160
|
+
_context3.next = 22;
|
|
161
|
+
return import('../../dist/compile-html-4361a0b3.esm.js');
|
|
162
|
+
|
|
163
|
+
case 22:
|
|
164
|
+
compileHtmlCommand = _context3.sent;
|
|
165
|
+
_context3.next = 25;
|
|
166
|
+
return compileHtmlCommand.default({
|
|
167
|
+
printSecurityHeaders: false
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
case 25:
|
|
171
|
+
case "end":
|
|
172
|
+
return _context3.stop();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, _callee2);
|
|
176
|
+
}));
|
|
177
|
+
|
|
178
|
+
return function (_x2) {
|
|
179
|
+
return _ref2.apply(this, arguments);
|
|
180
|
+
};
|
|
181
|
+
}()); // Command: compile-html
|
|
182
|
+
|
|
183
|
+
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".';
|
|
184
|
+
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.', {
|
|
185
|
+
default: false
|
|
186
|
+
}).action( /*#__PURE__*/function () {
|
|
187
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
188
|
+
var compileHtmlCommand;
|
|
189
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
190
|
+
while (1) {
|
|
191
|
+
switch (_context4.prev = _context4.next) {
|
|
192
|
+
case 0:
|
|
193
|
+
// Load dotenv files into the process environment.
|
|
194
|
+
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
195
|
+
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
196
|
+
|
|
197
|
+
process.env.NODE_ENV = 'production';
|
|
198
|
+
_context4.next = 4;
|
|
199
|
+
return import('../../dist/compile-html-4361a0b3.esm.js');
|
|
200
|
+
|
|
201
|
+
case 4:
|
|
202
|
+
compileHtmlCommand = _context4.sent;
|
|
203
|
+
_context4.next = 7;
|
|
204
|
+
return compileHtmlCommand.default(options);
|
|
205
|
+
|
|
206
|
+
case 7:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context4.stop();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, _callee3);
|
|
212
|
+
}));
|
|
213
|
+
|
|
214
|
+
return function (_x3) {
|
|
215
|
+
return _ref3.apply(this, arguments);
|
|
216
|
+
};
|
|
217
|
+
}()); // Command: serve
|
|
218
|
+
|
|
219
|
+
usageServe = 'Serves previously built and compiled application from the "public" folder.';
|
|
220
|
+
cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action( /*#__PURE__*/function () {
|
|
221
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(options) {
|
|
222
|
+
var serveCommand;
|
|
223
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context5) {
|
|
224
|
+
while (1) {
|
|
225
|
+
switch (_context5.prev = _context5.next) {
|
|
226
|
+
case 0:
|
|
227
|
+
// Load dotenv files into the process environment.
|
|
228
|
+
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
229
|
+
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
230
|
+
|
|
231
|
+
process.env.NODE_ENV = 'production';
|
|
232
|
+
_context5.next = 4;
|
|
233
|
+
return import('../../dist/serve-d6b437b1.esm.js');
|
|
234
|
+
|
|
235
|
+
case 4:
|
|
236
|
+
serveCommand = _context5.sent;
|
|
237
|
+
_context5.next = 7;
|
|
238
|
+
return serveCommand.default();
|
|
239
|
+
|
|
240
|
+
case 7:
|
|
241
|
+
case "end":
|
|
242
|
+
return _context5.stop();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, _callee4);
|
|
246
|
+
}));
|
|
247
|
+
|
|
248
|
+
return function (_x4) {
|
|
249
|
+
return _ref4.apply(this, arguments);
|
|
250
|
+
};
|
|
251
|
+
}()); // Command: login
|
|
252
|
+
|
|
253
|
+
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.';
|
|
254
|
+
cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action( /*#__PURE__*/function () {
|
|
255
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(options) {
|
|
256
|
+
var loginCommand;
|
|
257
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
258
|
+
while (1) {
|
|
259
|
+
switch (_context6.prev = _context6.next) {
|
|
260
|
+
case 0:
|
|
261
|
+
// Load dotenv files into the process environment.
|
|
262
|
+
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
263
|
+
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
264
|
+
|
|
265
|
+
process.env.NODE_ENV = 'production';
|
|
266
|
+
_context6.next = 4;
|
|
267
|
+
return import('../../dist/login-bdc2976a.esm.js');
|
|
268
|
+
|
|
269
|
+
case 4:
|
|
270
|
+
loginCommand = _context6.sent;
|
|
271
|
+
_context6.next = 7;
|
|
272
|
+
return loginCommand.default();
|
|
273
|
+
|
|
274
|
+
case 7:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context6.stop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, _callee5);
|
|
280
|
+
}));
|
|
281
|
+
|
|
282
|
+
return function (_x5) {
|
|
283
|
+
return _ref5.apply(this, arguments);
|
|
284
|
+
};
|
|
285
|
+
}()); // Command: config:sync
|
|
286
|
+
|
|
287
|
+
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.';
|
|
288
|
+
cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
|
|
289
|
+
default: false
|
|
290
|
+
}).action( /*#__PURE__*/function () {
|
|
291
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
|
|
292
|
+
var configSyncCommand;
|
|
293
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context7) {
|
|
294
|
+
while (1) {
|
|
295
|
+
switch (_context7.prev = _context7.next) {
|
|
296
|
+
case 0:
|
|
297
|
+
// Load dotenv files into the process environment.
|
|
298
|
+
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
299
|
+
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
300
|
+
|
|
301
|
+
process.env.NODE_ENV = 'production';
|
|
302
|
+
_context7.next = 4;
|
|
303
|
+
return import('../../dist/config-sync-6a39d2e3.esm.js');
|
|
304
|
+
|
|
305
|
+
case 4:
|
|
306
|
+
configSyncCommand = _context7.sent;
|
|
307
|
+
_context7.next = 7;
|
|
308
|
+
return configSyncCommand.default(options);
|
|
309
|
+
|
|
310
|
+
case 7:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context7.stop();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}, _callee6);
|
|
316
|
+
}));
|
|
317
|
+
|
|
318
|
+
return function (_x6) {
|
|
319
|
+
return _ref6.apply(this, arguments);
|
|
320
|
+
};
|
|
321
|
+
}());
|
|
322
|
+
cli.help();
|
|
323
|
+
cli.version(pkgJson.version);
|
|
324
|
+
cli.parse(process.argv, {
|
|
325
|
+
run: false
|
|
326
|
+
});
|
|
327
|
+
_context8.next = 19;
|
|
328
|
+
return cli.runMatchedCommand();
|
|
329
|
+
|
|
330
|
+
case 19:
|
|
331
|
+
case "end":
|
|
332
|
+
return _context8.stop();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}, _callee7);
|
|
336
|
+
}));
|
|
337
|
+
return _run.apply(this, arguments);
|
|
338
|
+
}
|
|
339
|
+
|
|
317
340
|
function loadDotEnvFiles(globalOptions) {
|
|
318
|
-
var
|
|
341
|
+
var _context;
|
|
319
342
|
|
|
320
343
|
var environment = process.env.MC_APP_ENV || process.env.NODE_ENV;
|
|
321
344
|
var dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
|
|
@@ -328,10 +351,10 @@ function loadDotEnvFiles(globalOptions) {
|
|
|
328
351
|
} // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
|
|
329
352
|
|
|
330
353
|
|
|
331
|
-
dotenvFiles.push.apply(dotenvFiles, _toConsumableArray(_filterInstanceProperty(
|
|
354
|
+
dotenvFiles.push.apply(dotenvFiles, _toConsumableArray(_filterInstanceProperty(_context = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
|
|
332
355
|
// since normally you expect tests to produce the same
|
|
333
356
|
// results for everyone
|
|
334
|
-
process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(
|
|
357
|
+
process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean))); // Load environment variables from .env* files. Suppress warnings using silent
|
|
335
358
|
// if this file is missing. dotenv will never modify any environment variables
|
|
336
359
|
// that have already been set. Variable expansion is supported in .env files.
|
|
337
360
|
// https://github.com/motdotla/dotenv
|
|
@@ -11,7 +11,7 @@ import FileSizeReporter from 'react-dev-utils/FileSizeReporter';
|
|
|
11
11
|
import printBuildError from 'react-dev-utils/printBuildError';
|
|
12
12
|
import { packageLocation } from '@commercetools-frontend/assets';
|
|
13
13
|
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
14
|
-
import { c as createWebpackConfigForProduction } from './create-webpack-config-for-production-
|
|
14
|
+
import { c as createWebpackConfigForProduction } from './create-webpack-config-for-production-39453789.esm.js';
|
|
15
15
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
16
16
|
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
17
17
|
import 'fs';
|
|
@@ -40,10 +40,10 @@ import '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
|
40
40
|
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
41
41
|
import '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
42
42
|
import './vendors-to-transpile-68e03526.esm.js';
|
|
43
|
-
import './create-postcss-config-
|
|
43
|
+
import './create-postcss-config-6dcc86ab.esm.js';
|
|
44
44
|
import '@babel/runtime-corejs3/helpers/toConsumableArray';
|
|
45
45
|
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
46
|
-
import './package-
|
|
46
|
+
import './package-47ad699b.esm.js';
|
|
47
47
|
import './has-jsx-runtime-8314226e.esm.js';
|
|
48
48
|
|
|
49
49
|
var measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild;
|