@commercetools-frontend/mc-scripts 21.23.10 → 21.24.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.
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +120 -326
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +116 -321
- package/dist/build-0392d4d9.cjs.dev.js +170 -0
- package/dist/build-5fa4f64b.cjs.prod.js +170 -0
- package/dist/build-cfa639ba.esm.js +156 -0
- package/dist/build-vite-b531d3d3.esm.js +118 -0
- package/dist/build-vite-c40a55c3.cjs.dev.js +129 -0
- package/dist/build-vite-d17432ec.cjs.prod.js +129 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
- package/dist/compile-html-41195e35.cjs.dev.js +49 -0
- package/dist/compile-html-5abd78aa.cjs.prod.js +49 -0
- package/dist/compile-html-f9de842c.esm.js +40 -0
- package/dist/config-sync-498d8415.esm.js +759 -0
- package/dist/config-sync-6f9a931b.cjs.prod.js +778 -0
- package/dist/config-sync-f4c52a72.cjs.dev.js +783 -0
- package/dist/{create-postcss-config-f65c7e31.cjs.dev.js → create-postcss-config-2f44c5b7.cjs.dev.js} +9 -14
- package/dist/{create-postcss-config-787d905f.cjs.prod.js → create-postcss-config-61048a3f.cjs.prod.js} +9 -14
- package/dist/{create-postcss-config-06b2e5c2.esm.js → create-postcss-config-9542b23c.esm.js} +9 -13
- package/dist/{create-webpack-config-for-development-59faaed8.cjs.prod.js → create-webpack-config-for-development-220735a5.cjs.prod.js} +24 -28
- package/dist/{create-webpack-config-for-development-d46ef148.cjs.dev.js → create-webpack-config-for-development-78d38450.cjs.dev.js} +24 -28
- package/dist/{create-webpack-config-for-development-fd365d6a.esm.js → create-webpack-config-for-development-e2c3b7c9.esm.js} +21 -25
- package/dist/{create-webpack-config-for-production-b28b3d33.esm.js → create-webpack-config-for-production-45ce787c.esm.js} +18 -21
- package/dist/{create-webpack-config-for-production-e12e3c30.cjs.dev.js → create-webpack-config-for-production-e15d7dce.cjs.dev.js} +20 -23
- package/dist/{create-webpack-config-for-production-1af3a454.cjs.prod.js → create-webpack-config-for-production-e1d519b7.cjs.prod.js} +20 -23
- package/dist/{user-agent-6e8d0e0b.cjs.prod.js → credentials-storage-7815c4a1.cjs.prod.js} +24 -24
- package/dist/{user-agent-4b60934e.esm.js → credentials-storage-97830674.esm.js} +22 -22
- package/dist/{user-agent-9a470e39.cjs.dev.js → credentials-storage-a664870a.cjs.dev.js} +24 -24
- package/dist/declarations/src/deprecated-entry-points.d.ts +1 -1
- package/dist/login-19cd817d.cjs.dev.js +93 -0
- package/dist/login-5a1f8e41.cjs.prod.js +93 -0
- package/dist/login-68f06363.esm.js +84 -0
- package/dist/{package-e2d9b5e0.cjs.dev.js → package-3397bc01.cjs.prod.js} +17 -16
- package/dist/{package-a5454c97.esm.js → package-4cd4bbaf.esm.js} +17 -16
- package/dist/{package-808a31f1.cjs.prod.js → package-bfe8f0c1.cjs.dev.js} +17 -16
- package/dist/{paths-76b66e74.cjs.prod.js → paths-284c77fb.cjs.prod.js} +6 -8
- package/dist/{paths-ed23d5a1.esm.js → paths-55c5d5a2.esm.js} +6 -8
- package/dist/{paths-16823f56.cjs.dev.js → paths-db35ac0f.cjs.dev.js} +6 -8
- package/dist/serve-41077dad.cjs.prod.js +48 -0
- package/dist/serve-660e2ee0.esm.js +41 -0
- package/dist/serve-b8063204.cjs.dev.js +48 -0
- package/dist/start-1db2f392.cjs.prod.js +180 -0
- package/dist/start-82f38adc.cjs.dev.js +180 -0
- package/dist/start-ed11d328.esm.js +166 -0
- package/dist/start-vite-324af14d.cjs.prod.js +119 -0
- package/dist/start-vite-7d10ae71.esm.js +107 -0
- package/dist/start-vite-8f03b0df.cjs.dev.js +119 -0
- package/dist/{vendors-to-transpile-367e0ba8.cjs.prod.js → vendors-to-transpile-04a49d40.cjs.prod.js} +1 -1
- package/dist/{vendors-to-transpile-b51af5d3.cjs.dev.js → vendors-to-transpile-6ab4ea06.cjs.dev.js} +1 -1
- package/dist/{vendors-to-transpile-68e03526.esm.js → vendors-to-transpile-7dc84a72.esm.js} +1 -1
- package/dist/vite-plugin-svgr-9a4e7f77.cjs.prod.js +79 -0
- package/dist/vite-plugin-svgr-f17db78a.esm.js +55 -0
- package/dist/vite-plugin-svgr-fdb37ccf.cjs.dev.js +79 -0
- package/package.json +17 -16
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -4
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +12 -13
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +12 -13
- package/dist/build-0e6d74d1.esm.js +0 -209
- package/dist/build-9074fc85.cjs.dev.js +0 -224
- package/dist/build-ae132901.cjs.prod.js +0 -224
- package/dist/build-vite-482a21b8.cjs.dev.js +0 -151
- package/dist/build-vite-cc68e3bf.esm.js +0 -139
- package/dist/build-vite-f095b68d.cjs.prod.js +0 -151
- package/dist/compile-html-4361a0b3.esm.js +0 -77
- package/dist/compile-html-d6331c35.cjs.prod.js +0 -87
- package/dist/compile-html-d9e731aa.cjs.dev.js +0 -87
- package/dist/config-sync-2a9945bc.cjs.dev.js +0 -989
- package/dist/config-sync-43a80f60.cjs.prod.js +0 -984
- package/dist/config-sync-c6c4d1cf.esm.js +0 -964
- package/dist/login-7f1cc8d0.cjs.prod.js +0 -167
- package/dist/login-d21a49e8.esm.js +0 -157
- package/dist/login-ed827138.cjs.dev.js +0 -167
- package/dist/serve-12de323b.cjs.dev.js +0 -70
- package/dist/serve-784f4fcd.cjs.prod.js +0 -70
- package/dist/serve-d6b437b1.esm.js +0 -62
- package/dist/start-10a4d95a.esm.js +0 -194
- package/dist/start-d021fa98.cjs.prod.js +0 -209
- package/dist/start-eea524f2.cjs.dev.js +0 -209
- package/dist/start-vite-57ec5175.cjs.dev.js +0 -146
- package/dist/start-vite-94c2db8c.esm.js +0 -133
- package/dist/start-vite-fc0b15d3.cjs.prod.js +0 -146
- package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +0 -110
- package/dist/vite-plugin-svgr-eb8524fa.esm.js +0 -85
- package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +0 -110
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
6
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
7
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
8
5
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
9
6
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
10
7
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
@@ -13,11 +10,10 @@ var path = require('path');
|
|
|
13
10
|
var cac = require('cac');
|
|
14
11
|
var dotenv = require('dotenv');
|
|
15
12
|
var dotenvExpand = require('dotenv-expand');
|
|
16
|
-
var _package = require('../../dist/package-
|
|
13
|
+
var _package = require('../../dist/package-bfe8f0c1.cjs.dev.js');
|
|
17
14
|
|
|
18
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
16
|
|
|
20
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
21
17
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
22
18
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
23
19
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
@@ -26,357 +22,155 @@ var path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
26
22
|
var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
|
|
27
23
|
var dotenvExpand__default = /*#__PURE__*/_interopDefault(dotenvExpand);
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
const cli = cac.cac('mc-scripts'); // Makes the script crash on unhandled rejections instead of silently
|
|
30
26
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
31
27
|
// terminate the Node.js process with a non-zero exit code.
|
|
32
28
|
|
|
33
|
-
process.on('unhandledRejection',
|
|
29
|
+
process.on('unhandledRejection', err => {
|
|
34
30
|
throw err;
|
|
35
31
|
}); // Get the current directory where the CLI is executed from. Usually this is the application folder.
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
const applicationDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
38
34
|
|
|
39
|
-
function run() {
|
|
40
|
-
|
|
35
|
+
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
|
+
|
|
38
|
+
cli.command('').usage('\n\n Develop and build Custom Applications.').action(() => {
|
|
39
|
+
cli.outputHelp();
|
|
40
|
+
}); // Command: start
|
|
41
|
+
|
|
42
|
+
const usageStart = 'Starts the application in development mode using Webpack Dev Server.';
|
|
43
|
+
cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action(async options => {
|
|
44
|
+
// Load dotenv files into the process environment.
|
|
45
|
+
// 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.
|
|
47
|
+
|
|
48
|
+
process.env.BABEL_ENV = 'development';
|
|
49
|
+
process.env.NODE_ENV = 'development';
|
|
50
|
+
const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
51
|
+
|
|
52
|
+
if (shouldUseExperimentalBundler) {
|
|
53
|
+
console.log('Experimental Vite bundler enabled! 🚀');
|
|
54
|
+
console.log('');
|
|
55
|
+
}
|
|
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-82f38adc.cjs.dev.js'); });
|
|
58
|
+
await startCommand.default();
|
|
59
|
+
}); // Command: build
|
|
60
|
+
|
|
61
|
+
const usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
|
|
62
|
+
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
|
+
default: false
|
|
64
|
+
}).action(async options => {
|
|
65
|
+
// Load dotenv files into the process environment.
|
|
66
|
+
// 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.
|
|
68
|
+
|
|
69
|
+
process.env.BABEL_ENV = 'production';
|
|
70
|
+
process.env.NODE_ENV = 'production';
|
|
71
|
+
const shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
72
|
+
|
|
73
|
+
if (shouldUseExperimentalBundler) {
|
|
74
|
+
console.log('Experimental Vite bundler enabled! 🚀');
|
|
75
|
+
console.log('');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const buildCommand = shouldUseExperimentalBundler ? await Promise.resolve().then(function () { return require('../../dist/build-vite-c40a55c3.cjs.dev.js'); }) : await Promise.resolve().then(function () { return require('../../dist/build-0392d4d9.cjs.dev.js'); });
|
|
79
|
+
await buildCommand.default();
|
|
80
|
+
const shouldAlsoCompile = !options.buildOnly;
|
|
81
|
+
|
|
82
|
+
if (shouldAlsoCompile) {
|
|
83
|
+
console.log('');
|
|
84
|
+
const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-41195e35.cjs.dev.js'); });
|
|
85
|
+
await compileHtmlCommand.default({
|
|
86
|
+
printSecurityHeaders: false
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}); // Command: compile-html
|
|
90
|
+
|
|
91
|
+
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
|
+
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
|
+
default: false
|
|
94
|
+
}).action(async options => {
|
|
95
|
+
// Load dotenv files into the process environment.
|
|
96
|
+
// 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.
|
|
98
|
+
|
|
99
|
+
process.env.NODE_ENV = 'production';
|
|
100
|
+
const compileHtmlCommand = await Promise.resolve().then(function () { return require('../../dist/compile-html-41195e35.cjs.dev.js'); });
|
|
101
|
+
await compileHtmlCommand.default(options);
|
|
102
|
+
}); // Command: serve
|
|
103
|
+
|
|
104
|
+
const usageServe = 'Serves previously built and compiled application from the "public" folder.';
|
|
105
|
+
cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action(async options => {
|
|
106
|
+
// Load dotenv files into the process environment.
|
|
107
|
+
// 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.
|
|
109
|
+
|
|
110
|
+
process.env.NODE_ENV = 'production';
|
|
111
|
+
const serveCommand = await Promise.resolve().then(function () { return require('../../dist/serve-b8063204.cjs.dev.js'); });
|
|
112
|
+
await serveCommand.default();
|
|
113
|
+
}); // Command: login
|
|
114
|
+
|
|
115
|
+
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
|
+
cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action(async options => {
|
|
117
|
+
// Load dotenv files into the process environment.
|
|
118
|
+
// 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.
|
|
120
|
+
|
|
121
|
+
process.env.NODE_ENV = 'production';
|
|
122
|
+
const loginCommand = await Promise.resolve().then(function () { return require('../../dist/login-19cd817d.cjs.dev.js'); });
|
|
123
|
+
await loginCommand.default();
|
|
124
|
+
}); // Command: config:sync
|
|
125
|
+
|
|
126
|
+
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
|
+
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
|
+
default: false
|
|
129
|
+
}).action(async options => {
|
|
130
|
+
// Load dotenv files into the process environment.
|
|
131
|
+
// 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.
|
|
133
|
+
|
|
134
|
+
process.env.NODE_ENV = 'production';
|
|
135
|
+
const configSyncCommand = await Promise.resolve().then(function () { return require('../../dist/config-sync-f4c52a72.cjs.dev.js'); });
|
|
136
|
+
await configSyncCommand.default(options);
|
|
137
|
+
});
|
|
138
|
+
cli.help();
|
|
139
|
+
cli.version(_package.pkgJson.version);
|
|
140
|
+
cli.parse(process.argv, {
|
|
141
|
+
run: false
|
|
142
|
+
});
|
|
143
|
+
await cli.runMatchedCommand();
|
|
41
144
|
} // Load dotenv files into the process environment.
|
|
42
145
|
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
43
146
|
// Inspired also by https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used
|
|
44
147
|
|
|
45
148
|
|
|
46
|
-
function _run() {
|
|
47
|
-
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7() {
|
|
48
|
-
var usageStart, usageBuild, usageCompileHtml, usageServe, usageLogin, usageConfigSync;
|
|
49
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context8) {
|
|
50
|
-
while (1) {
|
|
51
|
-
switch (_context8.prev = _context8.next) {
|
|
52
|
-
case 0:
|
|
53
|
-
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
|
|
54
|
-
|
|
55
|
-
cli.command('').usage('\n\n Develop and build Custom Applications.').action(function () {
|
|
56
|
-
cli.outputHelp();
|
|
57
|
-
}); // Command: start
|
|
58
|
-
|
|
59
|
-
usageStart = 'Starts the application in development mode using Webpack Dev Server.';
|
|
60
|
-
cli.command('start', usageStart).usage("\n\n ".concat(usageStart)).alias('dev').action( /*#__PURE__*/function () {
|
|
61
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
|
|
62
|
-
var shouldUseExperimentalBundler, startCommand;
|
|
63
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
64
|
-
while (1) {
|
|
65
|
-
switch (_context2.prev = _context2.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
// Load dotenv files into the process environment.
|
|
68
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
69
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
70
|
-
|
|
71
|
-
process.env.BABEL_ENV = 'development';
|
|
72
|
-
process.env.NODE_ENV = 'development';
|
|
73
|
-
shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
74
|
-
|
|
75
|
-
if (shouldUseExperimentalBundler) {
|
|
76
|
-
console.log('Experimental Vite bundler enabled! 🚀');
|
|
77
|
-
console.log('');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (!shouldUseExperimentalBundler) {
|
|
81
|
-
_context2.next = 11;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
_context2.next = 8;
|
|
86
|
-
return Promise.resolve().then(function () { return require('../../dist/start-vite-57ec5175.cjs.dev.js'); });
|
|
87
|
-
|
|
88
|
-
case 8:
|
|
89
|
-
_context2.t0 = _context2.sent;
|
|
90
|
-
_context2.next = 14;
|
|
91
|
-
break;
|
|
92
|
-
|
|
93
|
-
case 11:
|
|
94
|
-
_context2.next = 13;
|
|
95
|
-
return Promise.resolve().then(function () { return require('../../dist/start-eea524f2.cjs.dev.js'); });
|
|
96
|
-
|
|
97
|
-
case 13:
|
|
98
|
-
_context2.t0 = _context2.sent;
|
|
99
|
-
|
|
100
|
-
case 14:
|
|
101
|
-
startCommand = _context2.t0;
|
|
102
|
-
_context2.next = 17;
|
|
103
|
-
return startCommand.default();
|
|
104
|
-
|
|
105
|
-
case 17:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context2.stop();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}, _callee);
|
|
111
|
-
}));
|
|
112
|
-
|
|
113
|
-
return function (_x) {
|
|
114
|
-
return _ref.apply(this, arguments);
|
|
115
|
-
};
|
|
116
|
-
}()); // Command: build
|
|
117
|
-
|
|
118
|
-
usageBuild = 'Bundles the application in production mode. Outputs a "public" folder.';
|
|
119
|
-
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".', {
|
|
120
|
-
default: false
|
|
121
|
-
}).action( /*#__PURE__*/function () {
|
|
122
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(options) {
|
|
123
|
-
var shouldUseExperimentalBundler, buildCommand, shouldAlsoCompile, compileHtmlCommand;
|
|
124
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context3) {
|
|
125
|
-
while (1) {
|
|
126
|
-
switch (_context3.prev = _context3.next) {
|
|
127
|
-
case 0:
|
|
128
|
-
// Load dotenv files into the process environment.
|
|
129
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
130
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
131
|
-
|
|
132
|
-
process.env.BABEL_ENV = 'production';
|
|
133
|
-
process.env.NODE_ENV = 'production';
|
|
134
|
-
shouldUseExperimentalBundler = process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER === 'true';
|
|
135
|
-
|
|
136
|
-
if (shouldUseExperimentalBundler) {
|
|
137
|
-
console.log('Experimental Vite bundler enabled! 🚀');
|
|
138
|
-
console.log('');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!shouldUseExperimentalBundler) {
|
|
142
|
-
_context3.next = 11;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
_context3.next = 8;
|
|
147
|
-
return Promise.resolve().then(function () { return require('../../dist/build-vite-482a21b8.cjs.dev.js'); });
|
|
148
|
-
|
|
149
|
-
case 8:
|
|
150
|
-
_context3.t0 = _context3.sent;
|
|
151
|
-
_context3.next = 14;
|
|
152
|
-
break;
|
|
153
|
-
|
|
154
|
-
case 11:
|
|
155
|
-
_context3.next = 13;
|
|
156
|
-
return Promise.resolve().then(function () { return require('../../dist/build-9074fc85.cjs.dev.js'); });
|
|
157
|
-
|
|
158
|
-
case 13:
|
|
159
|
-
_context3.t0 = _context3.sent;
|
|
160
|
-
|
|
161
|
-
case 14:
|
|
162
|
-
buildCommand = _context3.t0;
|
|
163
|
-
_context3.next = 17;
|
|
164
|
-
return buildCommand.default();
|
|
165
|
-
|
|
166
|
-
case 17:
|
|
167
|
-
shouldAlsoCompile = !options.buildOnly;
|
|
168
|
-
|
|
169
|
-
if (!shouldAlsoCompile) {
|
|
170
|
-
_context3.next = 25;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
console.log('');
|
|
175
|
-
_context3.next = 22;
|
|
176
|
-
return Promise.resolve().then(function () { return require('../../dist/compile-html-d9e731aa.cjs.dev.js'); });
|
|
177
|
-
|
|
178
|
-
case 22:
|
|
179
|
-
compileHtmlCommand = _context3.sent;
|
|
180
|
-
_context3.next = 25;
|
|
181
|
-
return compileHtmlCommand.default({
|
|
182
|
-
printSecurityHeaders: false
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
case 25:
|
|
186
|
-
case "end":
|
|
187
|
-
return _context3.stop();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}, _callee2);
|
|
191
|
-
}));
|
|
192
|
-
|
|
193
|
-
return function (_x2) {
|
|
194
|
-
return _ref2.apply(this, arguments);
|
|
195
|
-
};
|
|
196
|
-
}()); // Command: compile-html
|
|
197
|
-
|
|
198
|
-
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".';
|
|
199
|
-
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.', {
|
|
200
|
-
default: false
|
|
201
|
-
}).action( /*#__PURE__*/function () {
|
|
202
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(options) {
|
|
203
|
-
var compileHtmlCommand;
|
|
204
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context4) {
|
|
205
|
-
while (1) {
|
|
206
|
-
switch (_context4.prev = _context4.next) {
|
|
207
|
-
case 0:
|
|
208
|
-
// Load dotenv files into the process environment.
|
|
209
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
210
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
211
|
-
|
|
212
|
-
process.env.NODE_ENV = 'production';
|
|
213
|
-
_context4.next = 4;
|
|
214
|
-
return Promise.resolve().then(function () { return require('../../dist/compile-html-d9e731aa.cjs.dev.js'); });
|
|
215
|
-
|
|
216
|
-
case 4:
|
|
217
|
-
compileHtmlCommand = _context4.sent;
|
|
218
|
-
_context4.next = 7;
|
|
219
|
-
return compileHtmlCommand.default(options);
|
|
220
|
-
|
|
221
|
-
case 7:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context4.stop();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}, _callee3);
|
|
227
|
-
}));
|
|
228
|
-
|
|
229
|
-
return function (_x3) {
|
|
230
|
-
return _ref3.apply(this, arguments);
|
|
231
|
-
};
|
|
232
|
-
}()); // Command: serve
|
|
233
|
-
|
|
234
|
-
usageServe = 'Serves previously built and compiled application from the "public" folder.';
|
|
235
|
-
cli.command('serve', usageServe).usage("\n\n ".concat(usageServe)).action( /*#__PURE__*/function () {
|
|
236
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(options) {
|
|
237
|
-
var serveCommand;
|
|
238
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context5) {
|
|
239
|
-
while (1) {
|
|
240
|
-
switch (_context5.prev = _context5.next) {
|
|
241
|
-
case 0:
|
|
242
|
-
// Load dotenv files into the process environment.
|
|
243
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
244
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
245
|
-
|
|
246
|
-
process.env.NODE_ENV = 'production';
|
|
247
|
-
_context5.next = 4;
|
|
248
|
-
return Promise.resolve().then(function () { return require('../../dist/serve-12de323b.cjs.dev.js'); });
|
|
249
|
-
|
|
250
|
-
case 4:
|
|
251
|
-
serveCommand = _context5.sent;
|
|
252
|
-
_context5.next = 7;
|
|
253
|
-
return serveCommand.default();
|
|
254
|
-
|
|
255
|
-
case 7:
|
|
256
|
-
case "end":
|
|
257
|
-
return _context5.stop();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}, _callee4);
|
|
261
|
-
}));
|
|
262
|
-
|
|
263
|
-
return function (_x4) {
|
|
264
|
-
return _ref4.apply(this, arguments);
|
|
265
|
-
};
|
|
266
|
-
}()); // Command: login
|
|
267
|
-
|
|
268
|
-
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.';
|
|
269
|
-
cli.command('login', usageLogin).usage("\n\n ".concat(usageLogin)).action( /*#__PURE__*/function () {
|
|
270
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(options) {
|
|
271
|
-
var loginCommand;
|
|
272
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context6) {
|
|
273
|
-
while (1) {
|
|
274
|
-
switch (_context6.prev = _context6.next) {
|
|
275
|
-
case 0:
|
|
276
|
-
// Load dotenv files into the process environment.
|
|
277
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
278
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
279
|
-
|
|
280
|
-
process.env.NODE_ENV = 'production';
|
|
281
|
-
_context6.next = 4;
|
|
282
|
-
return Promise.resolve().then(function () { return require('../../dist/login-ed827138.cjs.dev.js'); });
|
|
283
|
-
|
|
284
|
-
case 4:
|
|
285
|
-
loginCommand = _context6.sent;
|
|
286
|
-
_context6.next = 7;
|
|
287
|
-
return loginCommand.default();
|
|
288
|
-
|
|
289
|
-
case 7:
|
|
290
|
-
case "end":
|
|
291
|
-
return _context6.stop();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}, _callee5);
|
|
295
|
-
}));
|
|
296
|
-
|
|
297
|
-
return function (_x5) {
|
|
298
|
-
return _ref5.apply(this, arguments);
|
|
299
|
-
};
|
|
300
|
-
}()); // Command: config:sync
|
|
301
|
-
|
|
302
|
-
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.';
|
|
303
|
-
cli.command('config:sync', usageConfigSync).usage("\n\n ".concat(usageConfigSync)).option('--dry-run', '(optional) Executes the command but does not send any mutation request.', {
|
|
304
|
-
default: false
|
|
305
|
-
}).action( /*#__PURE__*/function () {
|
|
306
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(options) {
|
|
307
|
-
var configSyncCommand;
|
|
308
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context7) {
|
|
309
|
-
while (1) {
|
|
310
|
-
switch (_context7.prev = _context7.next) {
|
|
311
|
-
case 0:
|
|
312
|
-
// Load dotenv files into the process environment.
|
|
313
|
-
// This is essentially what `dotenv-cli` does, but it's now built into this CLI.
|
|
314
|
-
loadDotEnvFiles(options); // Do this as the first thing so that any code reading it knows the right env.
|
|
315
|
-
|
|
316
|
-
process.env.NODE_ENV = 'production';
|
|
317
|
-
_context7.next = 4;
|
|
318
|
-
return Promise.resolve().then(function () { return require('../../dist/config-sync-2a9945bc.cjs.dev.js'); });
|
|
319
|
-
|
|
320
|
-
case 4:
|
|
321
|
-
configSyncCommand = _context7.sent;
|
|
322
|
-
_context7.next = 7;
|
|
323
|
-
return configSyncCommand.default(options);
|
|
324
|
-
|
|
325
|
-
case 7:
|
|
326
|
-
case "end":
|
|
327
|
-
return _context7.stop();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}, _callee6);
|
|
331
|
-
}));
|
|
332
|
-
|
|
333
|
-
return function (_x6) {
|
|
334
|
-
return _ref6.apply(this, arguments);
|
|
335
|
-
};
|
|
336
|
-
}());
|
|
337
|
-
cli.help();
|
|
338
|
-
cli.version(_package.pkgJson.version);
|
|
339
|
-
cli.parse(process.argv, {
|
|
340
|
-
run: false
|
|
341
|
-
});
|
|
342
|
-
_context8.next = 19;
|
|
343
|
-
return cli.runMatchedCommand();
|
|
344
|
-
|
|
345
|
-
case 19:
|
|
346
|
-
case "end":
|
|
347
|
-
return _context8.stop();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}, _callee7);
|
|
351
|
-
}));
|
|
352
|
-
return _run.apply(this, arguments);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
149
|
function loadDotEnvFiles(globalOptions) {
|
|
356
150
|
var _context;
|
|
357
151
|
|
|
358
|
-
|
|
359
|
-
|
|
152
|
+
const environment = process.env.MC_APP_ENV || process.env.NODE_ENV;
|
|
153
|
+
const dotenvFiles = []; // Custom dotenv files specified by the `--env` option takes precedence.
|
|
360
154
|
|
|
361
155
|
if (typeof globalOptions.env === 'string') {
|
|
362
156
|
dotenvFiles.push(globalOptions.env);
|
|
363
157
|
} else if (_Array$isArray__default["default"](globalOptions.env)) {
|
|
364
158
|
// Multiple `--env` options are allowed.
|
|
365
|
-
dotenvFiles.push
|
|
159
|
+
dotenvFiles.push(...globalOptions.env);
|
|
366
160
|
} // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
|
|
367
161
|
|
|
368
162
|
|
|
369
|
-
dotenvFiles.push
|
|
163
|
+
dotenvFiles.push(..._filterInstanceProperty__default["default"](_context = [".env.".concat(environment, ".local"), // Don't include `.env.local` for `test` environment
|
|
370
164
|
// since normally you expect tests to produce the same
|
|
371
165
|
// results for everyone
|
|
372
|
-
process.env.NODE_ENV !== 'test' && ".env.local", ".env.".concat(environment), '.env']).call(_context, Boolean))
|
|
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
|
|
373
167
|
// if this file is missing. dotenv will never modify any environment variables
|
|
374
168
|
// that have already been set. Variable expansion is supported in .env files.
|
|
375
169
|
// https://github.com/motdotla/dotenv
|
|
376
170
|
// https://github.com/motdotla/dotenv-expand
|
|
377
171
|
|
|
378
|
-
_forEachInstanceProperty__default["default"](dotenvFiles).call(dotenvFiles,
|
|
379
|
-
|
|
172
|
+
_forEachInstanceProperty__default["default"](dotenvFiles).call(dotenvFiles, dotenvFile => {
|
|
173
|
+
const dotenvFilePath = path__default["default"].resolve(path__default["default"].join(applicationDirectory, dotenvFile));
|
|
380
174
|
|
|
381
175
|
if (fs__default["default"].existsSync(dotenvFilePath)) {
|
|
382
176
|
dotenvExpand__default["default"].expand(dotenv__default["default"].config({
|