@commercetools-frontend/mc-scripts 21.7.0 → 21.9.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 +361 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +361 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +345 -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-5357ad26.cjs.prod.js +224 -0
- package/dist/build-9b6d7eee.cjs.dev.js +224 -0
- package/dist/build-c483e87f.esm.js +209 -0
- package/dist/build-vite-3b82522e.cjs.dev.js +151 -0
- package/dist/build-vite-93abdc95.esm.js +139 -0
- package/dist/build-vite-b7cd993a.cjs.prod.js +151 -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-4361a0b3.esm.js +77 -0
- package/dist/compile-html-d6331c35.cjs.prod.js +87 -0
- package/dist/compile-html-d9e731aa.cjs.dev.js +87 -0
- package/dist/config-sync-6b31d972.esm.js +840 -0
- package/dist/config-sync-a478bc0f.cjs.dev.js +864 -0
- package/dist/config-sync-f07734e4.cjs.prod.js +859 -0
- package/{build/config/create-postcss-config.js → dist/create-postcss-config-04243dea.esm.js} +27 -25
- package/dist/create-postcss-config-760e2dc5.cjs.dev.js +90 -0
- package/dist/create-postcss-config-ddc3abee.cjs.prod.js +90 -0
- package/dist/create-webpack-config-for-development-76fdab59.cjs.prod.js +419 -0
- package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-d93ae4b2.esm.js} +94 -57
- package/dist/create-webpack-config-for-development-dfd1c174.cjs.dev.js +419 -0
- package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-9290479a.esm.js} +120 -54
- package/dist/create-webpack-config-for-production-bc8c1f37.cjs.dev.js +469 -0
- package/dist/create-webpack-config-for-production-d652ad1a.cjs.prod.js +469 -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/moment-locales.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 +2485 -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/vite-plugins/vite-plugin-custom-application.d.ts +4 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -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-7b7ae27e.esm.js +155 -0
- package/dist/login-b13f26e7.cjs.dev.js +165 -0
- package/dist/login-c11fb977.cjs.prod.js +165 -0
- package/dist/package-4b4fcf02.cjs.prod.js +139 -0
- package/dist/package-4c3e3fb7.cjs.dev.js +139 -0
- package/dist/package-8e6305bd.esm.js +137 -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-1b7dad90.cjs.prod.js +209 -0
- package/dist/start-45ca01f2.cjs.dev.js +209 -0
- package/dist/start-600d06a3.esm.js +194 -0
- package/dist/start-vite-22de08dc.cjs.dev.js +151 -0
- package/dist/start-vite-dc046cba.esm.js +138 -0
- package/dist/start-vite-fe13330b.cjs.prod.js +151 -0
- package/dist/user-agent-5f8ec93d.cjs.prod.js +106 -0
- package/dist/user-agent-ca628320.esm.js +94 -0
- package/dist/user-agent-ee57c98a.cjs.dev.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/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +110 -0
- package/dist/vite-plugin-svgr-eb8524fa.esm.js +85 -0
- package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +110 -0
- package/package.json +56 -50
- 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,46 @@
|
|
|
1
|
+
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
2
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
var moduleFileExtensions = ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx']; // Make sure any symlinks in the project folder are resolved:
|
|
7
|
+
// https://github.com/facebook/create-react-app/issues/637
|
|
8
|
+
|
|
9
|
+
var appDirectory = fs.realpathSync(process.cwd());
|
|
10
|
+
|
|
11
|
+
var resolveApp = function resolveApp(relativePath) {
|
|
12
|
+
return path.resolve(appDirectory, relativePath);
|
|
13
|
+
}; // Resolve file paths in the order given
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var resolveModule = function resolveModule(resolveFn, filePath) {
|
|
17
|
+
var extension = _findInstanceProperty(moduleFileExtensions).call(moduleFileExtensions, function (extension) {
|
|
18
|
+
var _context;
|
|
19
|
+
|
|
20
|
+
return fs.existsSync(resolveFn(_concatInstanceProperty(_context = "".concat(filePath, ".")).call(_context, extension)));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (extension) {
|
|
24
|
+
var _context2;
|
|
25
|
+
|
|
26
|
+
return resolveFn(_concatInstanceProperty(_context2 = "".concat(filePath, ".")).call(_context2, extension));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return resolveFn("".concat(filePath, ".js"));
|
|
30
|
+
}; // Resolve the absolute path of the caller location. This is necessary
|
|
31
|
+
// to point to files within that folder.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var paths = {
|
|
35
|
+
appPackageJson: resolveApp('package.json'),
|
|
36
|
+
appBuild: resolveApp('public'),
|
|
37
|
+
appIndexHtmlTemplate: resolveApp('public/index.html.template'),
|
|
38
|
+
appIndexHtml: resolveApp('public/index.html'),
|
|
39
|
+
appWebpackConfig: resolveModule(resolveApp, "webpack.config.".concat(process.env.NODE_ENV === 'production' ? 'prod' : 'dev')),
|
|
40
|
+
yarnLockFile: resolveApp('yarn.lock'),
|
|
41
|
+
appRoot: resolveApp('.'),
|
|
42
|
+
entryPoint: resolveModule(resolveApp, 'src/index'),
|
|
43
|
+
sourceFolders: [resolveApp('src')]
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { paths as p };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var http = require('http');
|
|
6
|
+
var serveHandler = require('serve-handler');
|
|
7
|
+
var paths = require('./paths-16823f56.cjs.dev.js');
|
|
8
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
|
+
require('fs');
|
|
11
|
+
require('path');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
16
|
+
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
17
|
+
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
18
|
+
|
|
19
|
+
var port = 3001;
|
|
20
|
+
|
|
21
|
+
function run() {
|
|
22
|
+
return _run.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _run() {
|
|
26
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
27
|
+
var server;
|
|
28
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
server = http__default["default"].createServer(function (request, response) {
|
|
33
|
+
// You pass two more arguments for config and middleware
|
|
34
|
+
// More details here: https://github.com/vercel/serve-handler#options
|
|
35
|
+
return serveHandler__default["default"](request, response, {
|
|
36
|
+
public: paths.paths.appBuild,
|
|
37
|
+
rewrites: [{
|
|
38
|
+
source: '/favicon*',
|
|
39
|
+
destination: '/favicon.png'
|
|
40
|
+
}, {
|
|
41
|
+
source: '/login*',
|
|
42
|
+
destination: '/login.html'
|
|
43
|
+
}, {
|
|
44
|
+
source: '/logout',
|
|
45
|
+
destination: '/logout.html'
|
|
46
|
+
}, {
|
|
47
|
+
// Match all routes except for the login, logout, and favicon routes.
|
|
48
|
+
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
49
|
+
// implementation would stop at the first match.
|
|
50
|
+
// See https://github.com/vercel/serve-handler/issues/71
|
|
51
|
+
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
52
|
+
destination: '/index.html'
|
|
53
|
+
}]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
server.listen(port, function () {
|
|
57
|
+
console.log("Running at http://localhost:".concat(port));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
case 2:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
return _run.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var http = require('http');
|
|
6
|
+
var serveHandler = require('serve-handler');
|
|
7
|
+
var paths = require('./paths-76b66e74.cjs.prod.js');
|
|
8
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
|
+
require('fs');
|
|
11
|
+
require('path');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
16
|
+
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
17
|
+
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
18
|
+
|
|
19
|
+
var port = 3001;
|
|
20
|
+
|
|
21
|
+
function run() {
|
|
22
|
+
return _run.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _run() {
|
|
26
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
27
|
+
var server;
|
|
28
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
server = http__default["default"].createServer(function (request, response) {
|
|
33
|
+
// You pass two more arguments for config and middleware
|
|
34
|
+
// More details here: https://github.com/vercel/serve-handler#options
|
|
35
|
+
return serveHandler__default["default"](request, response, {
|
|
36
|
+
public: paths.paths.appBuild,
|
|
37
|
+
rewrites: [{
|
|
38
|
+
source: '/favicon*',
|
|
39
|
+
destination: '/favicon.png'
|
|
40
|
+
}, {
|
|
41
|
+
source: '/login*',
|
|
42
|
+
destination: '/login.html'
|
|
43
|
+
}, {
|
|
44
|
+
source: '/logout',
|
|
45
|
+
destination: '/logout.html'
|
|
46
|
+
}, {
|
|
47
|
+
// Match all routes except for the login, logout, and favicon routes.
|
|
48
|
+
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
49
|
+
// implementation would stop at the first match.
|
|
50
|
+
// See https://github.com/vercel/serve-handler/issues/71
|
|
51
|
+
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
52
|
+
destination: '/index.html'
|
|
53
|
+
}]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
server.listen(port, function () {
|
|
57
|
+
console.log("Running at http://localhost:".concat(port));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
case 2:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
return _run.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
2
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import serveHandler from 'serve-handler';
|
|
5
|
+
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
6
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
7
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
8
|
+
import 'fs';
|
|
9
|
+
import 'path';
|
|
10
|
+
|
|
11
|
+
var port = 3001;
|
|
12
|
+
|
|
13
|
+
function run() {
|
|
14
|
+
return _run.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function _run() {
|
|
18
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
19
|
+
var server;
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
server = http.createServer(function (request, response) {
|
|
25
|
+
// You pass two more arguments for config and middleware
|
|
26
|
+
// More details here: https://github.com/vercel/serve-handler#options
|
|
27
|
+
return serveHandler(request, response, {
|
|
28
|
+
public: paths.appBuild,
|
|
29
|
+
rewrites: [{
|
|
30
|
+
source: '/favicon*',
|
|
31
|
+
destination: '/favicon.png'
|
|
32
|
+
}, {
|
|
33
|
+
source: '/login*',
|
|
34
|
+
destination: '/login.html'
|
|
35
|
+
}, {
|
|
36
|
+
source: '/logout',
|
|
37
|
+
destination: '/logout.html'
|
|
38
|
+
}, {
|
|
39
|
+
// Match all routes except for the login, logout, and favicon routes.
|
|
40
|
+
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
41
|
+
// implementation would stop at the first match.
|
|
42
|
+
// See https://github.com/vercel/serve-handler/issues/71
|
|
43
|
+
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
44
|
+
destination: '/index.html'
|
|
45
|
+
}]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
server.listen(port, function () {
|
|
49
|
+
console.log("Running at http://localhost:".concat(port));
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
case 2:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
}));
|
|
59
|
+
return _run.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { run as default };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
6
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
var webpack = require('webpack');
|
|
9
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
10
|
+
var chalk = require('chalk');
|
|
11
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
12
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
13
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
14
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
15
|
+
var paths = require('./paths-76b66e74.cjs.prod.js');
|
|
16
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
17
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
18
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
19
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-76fdab59.cjs.prod.js');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
22
|
+
require('path');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
29
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
30
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
31
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
32
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
33
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
34
|
+
require('webpackbar');
|
|
35
|
+
require('html-webpack-plugin');
|
|
36
|
+
require('moment-locales-webpack-plugin');
|
|
37
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
38
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
39
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
40
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
41
|
+
require('./vendors-to-transpile-367e0ba8.cjs.prod.js');
|
|
42
|
+
require('./create-postcss-config-ddc3abee.cjs.prod.js');
|
|
43
|
+
require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
44
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
45
|
+
require('./package-4b4fcf02.cjs.prod.js');
|
|
46
|
+
require('./has-jsx-runtime-0b03b72e.cjs.prod.js');
|
|
47
|
+
|
|
48
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
49
|
+
|
|
50
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
51
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
52
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
53
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
54
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
55
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
58
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
|
|
61
|
+
var host = process.env.HOST || '0.0.0.0'; // We support configuring the sockjs pathname during development.
|
|
62
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
63
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
64
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
65
|
+
// and `sockPort` options in webpack-dev-server.
|
|
66
|
+
|
|
67
|
+
var sockHost = process.env.WDS_SOCKET_HOST;
|
|
68
|
+
var sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
69
|
+
|
|
70
|
+
var sockPort = process.env.WDS_SOCKET_PORT;
|
|
71
|
+
|
|
72
|
+
var createWebpackDevServerConfig = function createWebpackDevServerConfig(_ref) {
|
|
73
|
+
var port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
var applicationConfig$1 = applicationConfig.processConfig();
|
|
76
|
+
var compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath: publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host: host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port: port,
|
|
105
|
+
setupMiddlewares: function setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
var _devServer$app;
|
|
107
|
+
|
|
108
|
+
if (!devServer) {
|
|
109
|
+
throw new Error('webpack-dev-server is not defined');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
(_devServer$app = devServer.app) === null || _devServer$app === void 0 ? void 0 : _devServer$app.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
113
|
+
return middlewares;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
function run() {
|
|
119
|
+
return _run.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function _run() {
|
|
123
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
124
|
+
var _config$output, _context;
|
|
125
|
+
|
|
126
|
+
var useYarn, isInteractive, hasWebpackConfig, DEFAULT_PORT, HOST, port, protocol, appName, urls, config, compiler, serverConfig, devServer;
|
|
127
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
128
|
+
while (1) {
|
|
129
|
+
switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
useYarn = fs__default["default"].existsSync(paths.paths.yarnLockFile);
|
|
132
|
+
isInteractive = process.stdout.isTTY; // Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
133
|
+
// which is why it's disabled by default.
|
|
134
|
+
|
|
135
|
+
hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig); // Warn and crash if required files are missing
|
|
136
|
+
|
|
137
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
138
|
+
process.exit(1);
|
|
139
|
+
} // Tools like Cloud9 rely on this.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
143
|
+
HOST = process.env.HOST || '0.0.0.0'; // We attempt to use the default port but if it is busy, we offer the user to
|
|
144
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
145
|
+
|
|
146
|
+
_context2.next = 8;
|
|
147
|
+
return WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
148
|
+
|
|
149
|
+
case 8:
|
|
150
|
+
port = _context2.sent;
|
|
151
|
+
|
|
152
|
+
if (!(port == null)) {
|
|
153
|
+
_context2.next = 12;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.warn('Could not find a free port. Aborting.'); // We have not found a port.
|
|
158
|
+
|
|
159
|
+
return _context2.abrupt("return");
|
|
160
|
+
|
|
161
|
+
case 12:
|
|
162
|
+
protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
163
|
+
appName = require(paths.paths.appPackageJson).name;
|
|
164
|
+
urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port); // Get webpack config
|
|
165
|
+
|
|
166
|
+
config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment(); // Create a webpack compiler that is configured with custom messages.
|
|
167
|
+
|
|
168
|
+
compiler = WebpackDevServerUtils.createCompiler({
|
|
169
|
+
appName: appName,
|
|
170
|
+
config: config,
|
|
171
|
+
useYarn: useYarn,
|
|
172
|
+
webpack: webpack__default["default"],
|
|
173
|
+
urls: urls
|
|
174
|
+
}); // Serve webpack assets generated by the compiler over a web sever.
|
|
175
|
+
|
|
176
|
+
serverConfig = createWebpackDevServerConfig({
|
|
177
|
+
port: port,
|
|
178
|
+
publicPath: (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.publicPath
|
|
179
|
+
});
|
|
180
|
+
devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
181
|
+
_context2.next = 21;
|
|
182
|
+
return devServer.start();
|
|
183
|
+
|
|
184
|
+
case 21:
|
|
185
|
+
if (isInteractive) {
|
|
186
|
+
clearConsole__default["default"]();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
190
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
191
|
+
|
|
192
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, function (sig) {
|
|
193
|
+
process.on(sig, function () {
|
|
194
|
+
devServer.close();
|
|
195
|
+
process.exit();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
case 25:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context2.stop();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, _callee);
|
|
205
|
+
}));
|
|
206
|
+
return _run.apply(this, arguments);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
6
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
var webpack = require('webpack');
|
|
9
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
10
|
+
var chalk = require('chalk');
|
|
11
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
12
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
13
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
14
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
15
|
+
var paths = require('./paths-16823f56.cjs.dev.js');
|
|
16
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
17
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
18
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
19
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-dfd1c174.cjs.dev.js');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
22
|
+
require('path');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
29
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
30
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
31
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
32
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
33
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
34
|
+
require('webpackbar');
|
|
35
|
+
require('html-webpack-plugin');
|
|
36
|
+
require('moment-locales-webpack-plugin');
|
|
37
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
38
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
39
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
40
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
41
|
+
require('./vendors-to-transpile-b51af5d3.cjs.dev.js');
|
|
42
|
+
require('./create-postcss-config-760e2dc5.cjs.dev.js');
|
|
43
|
+
require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
44
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
45
|
+
require('./package-4c3e3fb7.cjs.dev.js');
|
|
46
|
+
require('./has-jsx-runtime-3d4bb633.cjs.dev.js');
|
|
47
|
+
|
|
48
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
49
|
+
|
|
50
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
51
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
52
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
53
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
54
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
55
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
58
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
|
|
61
|
+
var host = process.env.HOST || '0.0.0.0'; // We support configuring the sockjs pathname during development.
|
|
62
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
63
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
64
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
65
|
+
// and `sockPort` options in webpack-dev-server.
|
|
66
|
+
|
|
67
|
+
var sockHost = process.env.WDS_SOCKET_HOST;
|
|
68
|
+
var sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
69
|
+
|
|
70
|
+
var sockPort = process.env.WDS_SOCKET_PORT;
|
|
71
|
+
|
|
72
|
+
var createWebpackDevServerConfig = function createWebpackDevServerConfig(_ref) {
|
|
73
|
+
var port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
var applicationConfig$1 = applicationConfig.processConfig();
|
|
76
|
+
var compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath: publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host: host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port: port,
|
|
105
|
+
setupMiddlewares: function setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
var _devServer$app;
|
|
107
|
+
|
|
108
|
+
if (!devServer) {
|
|
109
|
+
throw new Error('webpack-dev-server is not defined');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
(_devServer$app = devServer.app) === null || _devServer$app === void 0 ? void 0 : _devServer$app.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
113
|
+
return middlewares;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
function run() {
|
|
119
|
+
return _run.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function _run() {
|
|
123
|
+
_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
124
|
+
var _config$output, _context;
|
|
125
|
+
|
|
126
|
+
var useYarn, isInteractive, hasWebpackConfig, DEFAULT_PORT, HOST, port, protocol, appName, urls, config, compiler, serverConfig, devServer;
|
|
127
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
128
|
+
while (1) {
|
|
129
|
+
switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
useYarn = fs__default["default"].existsSync(paths.paths.yarnLockFile);
|
|
132
|
+
isInteractive = process.stdout.isTTY; // Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
133
|
+
// which is why it's disabled by default.
|
|
134
|
+
|
|
135
|
+
hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig); // Warn and crash if required files are missing
|
|
136
|
+
|
|
137
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
138
|
+
process.exit(1);
|
|
139
|
+
} // Tools like Cloud9 rely on this.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
143
|
+
HOST = process.env.HOST || '0.0.0.0'; // We attempt to use the default port but if it is busy, we offer the user to
|
|
144
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
145
|
+
|
|
146
|
+
_context2.next = 8;
|
|
147
|
+
return WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
148
|
+
|
|
149
|
+
case 8:
|
|
150
|
+
port = _context2.sent;
|
|
151
|
+
|
|
152
|
+
if (!(port == null)) {
|
|
153
|
+
_context2.next = 12;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.warn('Could not find a free port. Aborting.'); // We have not found a port.
|
|
158
|
+
|
|
159
|
+
return _context2.abrupt("return");
|
|
160
|
+
|
|
161
|
+
case 12:
|
|
162
|
+
protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
163
|
+
appName = require(paths.paths.appPackageJson).name;
|
|
164
|
+
urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port); // Get webpack config
|
|
165
|
+
|
|
166
|
+
config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment(); // Create a webpack compiler that is configured with custom messages.
|
|
167
|
+
|
|
168
|
+
compiler = WebpackDevServerUtils.createCompiler({
|
|
169
|
+
appName: appName,
|
|
170
|
+
config: config,
|
|
171
|
+
useYarn: useYarn,
|
|
172
|
+
webpack: webpack__default["default"],
|
|
173
|
+
urls: urls
|
|
174
|
+
}); // Serve webpack assets generated by the compiler over a web sever.
|
|
175
|
+
|
|
176
|
+
serverConfig = createWebpackDevServerConfig({
|
|
177
|
+
port: port,
|
|
178
|
+
publicPath: (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.publicPath
|
|
179
|
+
});
|
|
180
|
+
devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
181
|
+
_context2.next = 21;
|
|
182
|
+
return devServer.start();
|
|
183
|
+
|
|
184
|
+
case 21:
|
|
185
|
+
if (isInteractive) {
|
|
186
|
+
clearConsole__default["default"]();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
190
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
191
|
+
|
|
192
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, function (sig) {
|
|
193
|
+
process.on(sig, function () {
|
|
194
|
+
devServer.close();
|
|
195
|
+
process.exit();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
case 25:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context2.stop();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, _callee);
|
|
205
|
+
}));
|
|
206
|
+
return _run.apply(this, arguments);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
exports["default"] = run;
|