@commercetools-frontend/mc-scripts 21.7.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.
- package/LICENSE +1 -1
- package/README.md +1 -42
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +1 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
- package/{build/config/application-runtime.js → application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js} +2 -2
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
- package/application-runtime/package.json +4 -0
- package/bin/cli.js +1 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +1 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +354 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +354 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +338 -0
- package/cli/package.json +4 -0
- package/config/create-webpack-config-for-development.js +7 -1
- package/config/create-webpack-config-for-production.js +7 -1
- package/config/vendors-to-transpile.js +5 -1
- package/dist/build-8582b673.esm.js +209 -0
- package/dist/build-9395925a.cjs.prod.js +224 -0
- package/dist/build-97278377.cjs.dev.js +224 -0
- package/dist/build-vite-6c987a60.cjs.dev.js +109 -0
- package/dist/build-vite-76d44332.cjs.prod.js +109 -0
- package/dist/build-vite-a9602b19.esm.js +97 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +1 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +30 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +30 -0
- package/dist/commercetools-frontend-mc-scripts.esm.js +22 -0
- package/dist/compile-html-0c588a89.cjs.dev.js +93 -0
- package/dist/compile-html-4832f8c5.esm.js +83 -0
- package/dist/compile-html-7654b5e6.cjs.prod.js +93 -0
- package/dist/config-sync-20bc05e8.esm.js +868 -0
- package/dist/config-sync-62824317.cjs.prod.js +887 -0
- package/dist/config-sync-d52e73f6.cjs.dev.js +892 -0
- package/dist/create-postcss-config-4cbe10ab.cjs.dev.js +90 -0
- package/dist/create-postcss-config-8ea16440.cjs.prod.js +90 -0
- package/{build/config/create-postcss-config.js → dist/create-postcss-config-c1aa3525.esm.js} +27 -25
- package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-8a8b84d6.esm.js} +92 -56
- package/dist/create-webpack-config-for-development-a5e73092.cjs.prod.js +418 -0
- package/dist/create-webpack-config-for-development-e2735e02.cjs.dev.js +418 -0
- package/dist/create-webpack-config-for-production-4e7b56c0.cjs.prod.js +468 -0
- package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-7dc669e5.esm.js} +117 -52
- package/dist/create-webpack-config-for-production-d9bf281c.cjs.dev.js +468 -0
- package/dist/declarations/src/application-runtime.d.ts +1 -0
- package/dist/declarations/src/cli.d.ts +4 -0
- package/dist/declarations/src/commands/build-vite.d.ts +2 -0
- package/dist/declarations/src/commands/build.d.ts +2 -0
- package/dist/declarations/src/commands/compile-html.d.ts +3 -0
- package/dist/declarations/src/commands/config-sync.d.ts +3 -0
- package/dist/declarations/src/commands/login.d.ts +2 -0
- package/dist/declarations/src/commands/serve.d.ts +2 -0
- package/dist/declarations/src/commands/start-vite.d.ts +2 -0
- package/dist/declarations/src/commands/start.d.ts +2 -0
- package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
- package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
- package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
- package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
- package/dist/declarations/src/config/paths.d.ts +12 -0
- package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
- package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
- package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
- package/dist/declarations/src/generated/core.d.ts +710 -0
- package/dist/declarations/src/generated/settings.d.ts +2383 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/postcss.d.ts +1 -0
- package/dist/declarations/src/types.d.ts +82 -0
- package/dist/declarations/src/utils/auth.d.ts +6 -0
- package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
- package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
- package/dist/declarations/src/utils/graphql-requests.d.ts +80 -0
- package/dist/declarations/src/utils/user-agent.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
- package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
- package/dist/declarations/src/webpack.d.ts +2 -0
- package/dist/has-jsx-runtime-0b03b72e.cjs.prod.js +17 -0
- package/dist/has-jsx-runtime-3d4bb633.cjs.dev.js +17 -0
- package/{build/config/has-jsx-runtime.js → dist/has-jsx-runtime-8314226e.esm.js} +1 -3
- package/dist/login-706ccc9a.cjs.prod.js +165 -0
- package/dist/login-779552b7.cjs.dev.js +165 -0
- package/dist/login-7d94659e.esm.js +155 -0
- package/dist/package-a98de907.esm.js +133 -0
- package/dist/package-aaf61bf0.cjs.dev.js +135 -0
- package/dist/package-b5c040f3.cjs.prod.js +135 -0
- package/dist/paths-16823f56.cjs.dev.js +55 -0
- package/dist/paths-76b66e74.cjs.prod.js +55 -0
- package/dist/paths-ed23d5a1.esm.js +46 -0
- package/dist/serve-12de323b.cjs.dev.js +70 -0
- package/dist/serve-784f4fcd.cjs.prod.js +70 -0
- package/dist/serve-d6b437b1.esm.js +62 -0
- package/dist/start-2b953ab0.cjs.dev.js +209 -0
- package/dist/start-e3ccd672.cjs.prod.js +209 -0
- package/dist/start-e924bd5d.esm.js +194 -0
- package/dist/start-vite-737bacca.cjs.dev.js +149 -0
- package/dist/start-vite-b0f58ae4.cjs.prod.js +149 -0
- package/dist/start-vite-ec5d40b5.esm.js +136 -0
- package/dist/user-agent-5da1830b.cjs.dev.js +106 -0
- package/dist/user-agent-8044acd6.esm.js +94 -0
- package/dist/user-agent-d18809af.cjs.prod.js +106 -0
- package/dist/vendors-to-transpile-367e0ba8.cjs.prod.js +5 -0
- package/dist/vendors-to-transpile-68e03526.esm.js +3 -0
- package/dist/vendors-to-transpile-b51af5d3.cjs.dev.js +5 -0
- package/package.json +41 -39
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +1 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +14 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +14 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +6 -0
- package/postcss/package.json +4 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +1 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +51 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +51 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +42 -0
- package/webpack/package.json +4 -0
- package/build/bin/cli.js +0 -264
- package/build/commands/build-vite.js +0 -91
- package/build/commands/build.js +0 -140
- package/build/commands/compile-html.js +0 -53
- package/build/commands/config-sync.js +0 -176
- package/build/commands/login.js +0 -60
- package/build/commands/serve.js +0 -37
- package/build/commands/start-vite.js +0 -138
- package/build/commands/start.js +0 -108
- package/build/config/paths.js +0 -38
- package/build/config/vendors-to-transpile.js +0 -3
- package/build/config/webpack-dev-server.config.js +0 -69
- package/build/index.js +0 -16
- package/build/utils/auth.js +0 -34
- package/build/utils/auth.spec.js +0 -61
- package/build/utils/create-custom-application.settings.graphql +0 -8
- package/build/utils/credentials-storage.js +0 -72
- package/build/utils/credentials-storage.spec.js +0 -69
- package/build/utils/fetch-custom-application.settings.graphql +0 -36
- package/build/utils/fetch-user-organizations.core.graphql +0 -9
- package/build/utils/get-config-diff.js +0 -308
- package/build/utils/get-config-diff.spec.js +0 -285
- package/build/utils/graphql-requests.js +0 -105
- package/build/utils/graphql-requests.spec.js +0 -159
- package/build/utils/require-graphql.js +0 -15
- package/build/utils/update-custom-application.settings.graphql +0 -13
- package/build/utils/user-agent.js +0 -15
- package/build/webpack-plugins/final-stats-writer-plugin.js +0 -50
- package/build/webpack-plugins/local-html-webpack-plugin.js +0 -38
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
2
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
|
+
import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
|
|
4
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { build } from 'vite';
|
|
8
|
+
import pluginGraphql from '@rollup/plugin-graphql';
|
|
9
|
+
import pluginReact from '@vitejs/plugin-react';
|
|
10
|
+
import { generateTemplate } from '@commercetools-frontend/mc-html-template';
|
|
11
|
+
import { packageLocation } from '@commercetools-frontend/assets';
|
|
12
|
+
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
13
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
14
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
|
+
import 'fs';
|
|
16
|
+
|
|
17
|
+
function run() {
|
|
18
|
+
return _run.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _run() {
|
|
22
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23
|
+
var DEFAULT_PORT, appEntryPoint, html;
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) {
|
|
26
|
+
switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001; // Ensure the `/public` folder exists.
|
|
29
|
+
|
|
30
|
+
fs.mkdirSync(paths.appBuild, {
|
|
31
|
+
recursive: true
|
|
32
|
+
}); // Generate `index.html` (template).
|
|
33
|
+
|
|
34
|
+
appEntryPoint = path.relative(paths.appRoot, paths.entryPoint);
|
|
35
|
+
html = generateTemplate({
|
|
36
|
+
// Define the module entry point (path relative from the `/public` folder).
|
|
37
|
+
// NOTE: that this is different from the development configuration.
|
|
38
|
+
scriptImports: ["<script type=\"module\" src=\"/".concat(appEntryPoint, "\"></script>")]
|
|
39
|
+
}); // Write `index.html` (template) into the `/public` folder.
|
|
40
|
+
|
|
41
|
+
fs.writeFileSync(paths.appIndexHtml, html, {
|
|
42
|
+
encoding: 'utf8'
|
|
43
|
+
});
|
|
44
|
+
_context.next = 7;
|
|
45
|
+
return build({
|
|
46
|
+
root: paths.appRoot,
|
|
47
|
+
define: {
|
|
48
|
+
'process.env.DEBUG': _JSON$stringify(false),
|
|
49
|
+
'process.env.NODE_ENV': _JSON$stringify('production')
|
|
50
|
+
},
|
|
51
|
+
build: {
|
|
52
|
+
outDir: 'public',
|
|
53
|
+
assetsDir: '.',
|
|
54
|
+
rollupOptions: {
|
|
55
|
+
// This is necessary to instruct Vite that the `index.html` (template)
|
|
56
|
+
// is located in the `/public` folder.
|
|
57
|
+
// NOTE that after the build, Vite will write the `index.html` (template)
|
|
58
|
+
// at the `/public/public/index.html` location. See `fs.renameSync` below.
|
|
59
|
+
input: paths.appIndexHtml
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
server: {
|
|
63
|
+
port: DEFAULT_PORT
|
|
64
|
+
},
|
|
65
|
+
plugins: [pluginGraphql(), pluginReact({
|
|
66
|
+
jsxImportSource: '@emotion/react',
|
|
67
|
+
babel: {
|
|
68
|
+
plugins: ['@emotion/babel-plugin']
|
|
69
|
+
}
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
case 7:
|
|
74
|
+
// Rename `/public/public/index.html` to `/public/index.html.template`
|
|
75
|
+
fs.renameSync( // Because of our custom entry point path (`/public/index.html`),
|
|
76
|
+
// Vite will write the `index.html` to `/public/public/index.html`.
|
|
77
|
+
// We need to move this file to the `/public` folder and rename it
|
|
78
|
+
// to `index.html.template` (as expected by the `compile-html` command).
|
|
79
|
+
path.join(paths.appBuild, 'public/index.html'), paths.appIndexHtmlTemplate); // Clean up nested folder
|
|
80
|
+
|
|
81
|
+
fs.rmdirSync(path.join(paths.appBuild, 'public')); // Copy public assets
|
|
82
|
+
|
|
83
|
+
fs.copySync(path.join(packageLocation, 'html-page'), paths.appBuild, {
|
|
84
|
+
dereference: true
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
case 10:
|
|
88
|
+
case "end":
|
|
89
|
+
return _context.stop();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, _callee);
|
|
93
|
+
}));
|
|
94
|
+
return _run.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { run as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vendorsToTranspile = require('./vendors-to-transpile-b51af5d3.cjs.dev.js');
|
|
6
|
+
|
|
7
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
8
|
+
var version = "21.8.0";
|
|
9
|
+
|
|
10
|
+
// These exports are deprecated.
|
|
11
|
+
function createWebpackConfigForDevelopment(options) {
|
|
12
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
13
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function createWebpackConfigForProduction(options) {
|
|
17
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
18
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function createPostcssConfig(options) {
|
|
22
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
23
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.vendorsToTranspile = vendorsToTranspile.vendorsToTranspile;
|
|
27
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
28
|
+
exports.createWebpackConfigForDevelopment = createWebpackConfigForDevelopment;
|
|
29
|
+
exports.createWebpackConfigForProduction = createWebpackConfigForProduction;
|
|
30
|
+
exports.version = version;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vendorsToTranspile = require('./vendors-to-transpile-367e0ba8.cjs.prod.js');
|
|
6
|
+
|
|
7
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
8
|
+
var version = "21.8.0";
|
|
9
|
+
|
|
10
|
+
// These exports are deprecated.
|
|
11
|
+
function createWebpackConfigForDevelopment(options) {
|
|
12
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
13
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function createWebpackConfigForProduction(options) {
|
|
17
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
18
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function createPostcssConfig(options) {
|
|
22
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
23
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.vendorsToTranspile = vendorsToTranspile.vendorsToTranspile;
|
|
27
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
28
|
+
exports.createWebpackConfigForDevelopment = createWebpackConfigForDevelopment;
|
|
29
|
+
exports.createWebpackConfigForProduction = createWebpackConfigForProduction;
|
|
30
|
+
exports.version = version;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { v as vendorsToTranspile } from './vendors-to-transpile-68e03526.esm.js';
|
|
2
|
+
|
|
3
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
4
|
+
var version = "21.8.0";
|
|
5
|
+
|
|
6
|
+
// These exports are deprecated.
|
|
7
|
+
function createWebpackConfigForDevelopment(options) {
|
|
8
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
9
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function createWebpackConfigForProduction(options) {
|
|
13
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
14
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createPostcssConfig(options) {
|
|
18
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
19
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { createPostcssConfig, createWebpackConfigForDevelopment, createWebpackConfigForProduction, version };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
var chalk = require('chalk');
|
|
9
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
10
|
+
var paths = require('./paths-16823f56.cjs.dev.js');
|
|
11
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
12
|
+
require('path');
|
|
13
|
+
|
|
14
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
17
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
18
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
19
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
20
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
21
|
+
|
|
22
|
+
var appDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
23
|
+
|
|
24
|
+
function run() {
|
|
25
|
+
return _run.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _run() {
|
|
29
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
30
|
+
var options,
|
|
31
|
+
compiled,
|
|
32
|
+
transformerPath,
|
|
33
|
+
transformerFn,
|
|
34
|
+
_context,
|
|
35
|
+
_args = arguments;
|
|
36
|
+
|
|
37
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
38
|
+
while (1) {
|
|
39
|
+
switch (_context2.prev = _context2.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
42
|
+
console.log('Compiling index.html...');
|
|
43
|
+
_context2.next = 4;
|
|
44
|
+
return mcHtmlTemplate.compileHtml(paths.paths.appIndexHtmlTemplate);
|
|
45
|
+
|
|
46
|
+
case 4:
|
|
47
|
+
compiled = _context2.sent;
|
|
48
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
49
|
+
encoding: 'utf8'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!options.transformer) {
|
|
53
|
+
_context2.next = 18;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_context2.prev = 7;
|
|
58
|
+
transformerPath = require.resolve(options.transformer, {
|
|
59
|
+
paths: [appDirectory]
|
|
60
|
+
});
|
|
61
|
+
transformerFn = require(transformerPath);
|
|
62
|
+
transformerFn(compiled);
|
|
63
|
+
_context2.next = 16;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case 13:
|
|
67
|
+
_context2.prev = 13;
|
|
68
|
+
_context2.t0 = _context2["catch"](7);
|
|
69
|
+
throw new Error(_concatInstanceProperty__default["default"](_context = "Could not load transformer module \"".concat(options.transformer, "\"\n")).call(_context, _context2.t0 instanceof Error ? _context2.t0.stack : ''));
|
|
70
|
+
|
|
71
|
+
case 16:
|
|
72
|
+
_context2.next = 19;
|
|
73
|
+
break;
|
|
74
|
+
|
|
75
|
+
case 18:
|
|
76
|
+
if (options['print-security-headers']) {
|
|
77
|
+
console.log(_JSON$stringify__default["default"](compiled.headers));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
case 19:
|
|
81
|
+
console.log(chalk__default["default"].green('Compiled successfully.\n'));
|
|
82
|
+
|
|
83
|
+
case 20:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee, null, [[7, 13]]);
|
|
89
|
+
}));
|
|
90
|
+
return _run.apply(this, arguments);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
2
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
4
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { compileHtml } from '@commercetools-frontend/mc-html-template';
|
|
8
|
+
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
9
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
10
|
+
import 'path';
|
|
11
|
+
|
|
12
|
+
var appDirectory = fs.realpathSync(process.cwd());
|
|
13
|
+
|
|
14
|
+
function run() {
|
|
15
|
+
return _run.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _run() {
|
|
19
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20
|
+
var options,
|
|
21
|
+
compiled,
|
|
22
|
+
transformerPath,
|
|
23
|
+
transformerFn,
|
|
24
|
+
_context,
|
|
25
|
+
_args = arguments;
|
|
26
|
+
|
|
27
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
28
|
+
while (1) {
|
|
29
|
+
switch (_context2.prev = _context2.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
32
|
+
console.log('Compiling index.html...');
|
|
33
|
+
_context2.next = 4;
|
|
34
|
+
return compileHtml(paths.appIndexHtmlTemplate);
|
|
35
|
+
|
|
36
|
+
case 4:
|
|
37
|
+
compiled = _context2.sent;
|
|
38
|
+
fs.writeFileSync(paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
39
|
+
encoding: 'utf8'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!options.transformer) {
|
|
43
|
+
_context2.next = 18;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_context2.prev = 7;
|
|
48
|
+
transformerPath = require.resolve(options.transformer, {
|
|
49
|
+
paths: [appDirectory]
|
|
50
|
+
});
|
|
51
|
+
transformerFn = require(transformerPath);
|
|
52
|
+
transformerFn(compiled);
|
|
53
|
+
_context2.next = 16;
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
case 13:
|
|
57
|
+
_context2.prev = 13;
|
|
58
|
+
_context2.t0 = _context2["catch"](7);
|
|
59
|
+
throw new Error(_concatInstanceProperty(_context = "Could not load transformer module \"".concat(options.transformer, "\"\n")).call(_context, _context2.t0 instanceof Error ? _context2.t0.stack : ''));
|
|
60
|
+
|
|
61
|
+
case 16:
|
|
62
|
+
_context2.next = 19;
|
|
63
|
+
break;
|
|
64
|
+
|
|
65
|
+
case 18:
|
|
66
|
+
if (options['print-security-headers']) {
|
|
67
|
+
console.log(_JSON$stringify(compiled.headers));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case 19:
|
|
71
|
+
console.log(chalk.green('Compiled successfully.\n'));
|
|
72
|
+
|
|
73
|
+
case 20:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context2.stop();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, _callee, null, [[7, 13]]);
|
|
79
|
+
}));
|
|
80
|
+
return _run.apply(this, arguments);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { run as default };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
var chalk = require('chalk');
|
|
9
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
10
|
+
var paths = require('./paths-76b66e74.cjs.prod.js');
|
|
11
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
12
|
+
require('path');
|
|
13
|
+
|
|
14
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
17
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
18
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
19
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
20
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
21
|
+
|
|
22
|
+
var appDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
23
|
+
|
|
24
|
+
function run() {
|
|
25
|
+
return _run.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _run() {
|
|
29
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
30
|
+
var options,
|
|
31
|
+
compiled,
|
|
32
|
+
transformerPath,
|
|
33
|
+
transformerFn,
|
|
34
|
+
_context,
|
|
35
|
+
_args = arguments;
|
|
36
|
+
|
|
37
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
38
|
+
while (1) {
|
|
39
|
+
switch (_context2.prev = _context2.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
42
|
+
console.log('Compiling index.html...');
|
|
43
|
+
_context2.next = 4;
|
|
44
|
+
return mcHtmlTemplate.compileHtml(paths.paths.appIndexHtmlTemplate);
|
|
45
|
+
|
|
46
|
+
case 4:
|
|
47
|
+
compiled = _context2.sent;
|
|
48
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
49
|
+
encoding: 'utf8'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!options.transformer) {
|
|
53
|
+
_context2.next = 18;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_context2.prev = 7;
|
|
58
|
+
transformerPath = require.resolve(options.transformer, {
|
|
59
|
+
paths: [appDirectory]
|
|
60
|
+
});
|
|
61
|
+
transformerFn = require(transformerPath);
|
|
62
|
+
transformerFn(compiled);
|
|
63
|
+
_context2.next = 16;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case 13:
|
|
67
|
+
_context2.prev = 13;
|
|
68
|
+
_context2.t0 = _context2["catch"](7);
|
|
69
|
+
throw new Error(_concatInstanceProperty__default["default"](_context = "Could not load transformer module \"".concat(options.transformer, "\"\n")).call(_context, _context2.t0 instanceof Error ? _context2.t0.stack : ''));
|
|
70
|
+
|
|
71
|
+
case 16:
|
|
72
|
+
_context2.next = 19;
|
|
73
|
+
break;
|
|
74
|
+
|
|
75
|
+
case 18:
|
|
76
|
+
if (options['print-security-headers']) {
|
|
77
|
+
console.log(_JSON$stringify__default["default"](compiled.headers));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
case 19:
|
|
81
|
+
console.log(chalk__default["default"].green('Compiled successfully.\n'));
|
|
82
|
+
|
|
83
|
+
case 20:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee, null, [[7, 13]]);
|
|
89
|
+
}));
|
|
90
|
+
return _run.apply(this, arguments);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
exports["default"] = run;
|