@zohodesk/react-cli 1.1.16 → 1.1.18-exp.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +27 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +22 -0
- package/lib/babel/cmjs-plugins-presets.js +7 -1
- package/lib/babel/es-plugins-presets.js +7 -1
- package/lib/configs/webpack.dev.config.js +7 -2
- package/lib/configs/webpack.prod.config.js +9 -2
- package/lib/loaderUtils/getDevJsLoaders.js +5 -1
- package/lib/schemas/index.js +4 -0
- package/npm-shrinkwrap.json +42 -11
- package/package.json +4 -2
- package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
- package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
- package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
- package/packages/client_build_tool/lib/commands/build/config.js +12 -0
- package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/build/index.js +35 -0
- package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
- package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
- package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
- package/packages/client_build_tool/lib/commands/start/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
- package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
- package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
- package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
- package/packages/client_build_tool/lib/commandsRouter.js +71 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
- package/packages/client_build_tool/lib/shared/constants.js +33 -0
- package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
- package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
- package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
- package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
- package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
- package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
- package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
- package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
- package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
- package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
- package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
- package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
- package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
- package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
- package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
- package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
- package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.configServiceWorkerPlugin = configServiceWorkerPlugin;
|
7
|
+
|
8
|
+
var _ServiceWorkerPlugin = _interopRequireDefault(require("../custom_plugins/ServiceWorkerPlugin"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
function configServiceWorkerPlugin(options) {
|
13
|
+
const {
|
14
|
+
serviceWorker
|
15
|
+
} = options.app;
|
16
|
+
console.log(serviceWorker);
|
17
|
+
return new _ServiceWorkerPlugin.default(serviceWorker);
|
18
|
+
}
|
package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.configUglifyCSSPlugin = configUglifyCSSPlugin;
|
7
|
+
|
8
|
+
var _UglifyCSSPlugin = _interopRequireDefault(require("../custom_plugins/UglifyCSSPlugin"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
// eslint-disable-next-line no-unused-vars
|
13
|
+
function configUglifyCSSPlugin(options) {
|
14
|
+
return new _UglifyCSSPlugin.default();
|
15
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.plugins = plugins;
|
7
|
+
|
8
|
+
var _configHtmlWebpackPlugin = require("./pluginConfigs/configHtmlWebpackPlugin");
|
9
|
+
|
10
|
+
var _configEnvVariables = require("./pluginConfigs/configEnvVariables");
|
11
|
+
|
12
|
+
var _configI18nSplitPlugin = require("./pluginConfigs/configI18nSplitPlugin");
|
13
|
+
|
14
|
+
var _configMiniCSSExtractPlugin = require("./pluginConfigs/configMiniCSSExtractPlugin");
|
15
|
+
|
16
|
+
var _configRtlCssPlugin = require("./pluginConfigs/configRtlCssPlugin");
|
17
|
+
|
18
|
+
var _configCopyThirdpartyFile = require("./pluginConfigs/configCopyThirdpartyFile");
|
19
|
+
|
20
|
+
var _configIgnorePlugin = require("./pluginConfigs/configIgnorePlugin");
|
21
|
+
|
22
|
+
var _configUglifyCSSPlugin = require("./pluginConfigs/configUglifyCSSPlugin");
|
23
|
+
|
24
|
+
var _configCdnChangePlugin = require("./pluginConfigs/configCdnChangePlugin");
|
25
|
+
|
26
|
+
var _configServiceWorkerPlugin = require("./pluginConfigs/configServiceWorkerPlugin");
|
27
|
+
|
28
|
+
var _configProgressPlugin = require("./pluginConfigs/configProgressPlugin");
|
29
|
+
|
30
|
+
// import { IgnorePlugin } from 'webpack';
|
31
|
+
function plugins(options) {
|
32
|
+
const {
|
33
|
+
i18nChunkSplit
|
34
|
+
} = options;
|
35
|
+
const {
|
36
|
+
rtlSplit
|
37
|
+
} = options.css.plugins;
|
38
|
+
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configCopyThirdpartyFile.configCopyThirdpartyFile)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), i18nChunkSplit.chunkSplitEnable && (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), rtlSplit.enableRTLSplit && (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configUglifyCSSPlugin.configUglifyCSSPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options)].filter(Boolean);
|
39
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.postcssPlugins = postcssPlugins;
|
7
|
+
|
8
|
+
var _postcssRtl = _interopRequireDefault(require("postcss-rtl"));
|
9
|
+
|
10
|
+
var _postcssSelectorReplace = _interopRequireDefault(require("postcss-selector-replace"));
|
11
|
+
|
12
|
+
var _ExcludePlugin = require("./custom_postcss_loaders/ExcludePlugin");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
// import CheckPlugin from './custom_postcss_loaders/CheckPlugin';
|
17
|
+
// console.log({ postcssRTLPlugin });
|
18
|
+
function postcssPlugins(options) {
|
19
|
+
const {
|
20
|
+
plugins,
|
21
|
+
selectorReplace
|
22
|
+
} = options.css;
|
23
|
+
return [selectorReplace && (0, _postcssSelectorReplace.default)(selectorReplace), ...(0, _ExcludePlugin.excludeEmptyCheckPlugin)({
|
24
|
+
enable: plugins.rtl.enable,
|
25
|
+
exclude: plugins.rtl.exclude,
|
26
|
+
plugins: [(0, _postcssRtl.default)({
|
27
|
+
addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
|
28
|
+
if (prefix === '[dir]') {
|
29
|
+
return selector;
|
30
|
+
}
|
31
|
+
|
32
|
+
return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
|
33
|
+
}
|
34
|
+
})]
|
35
|
+
})].filter(Boolean);
|
36
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.loaderResolver = loaderResolver;
|
7
|
+
exports.moduleResolver = moduleResolver;
|
8
|
+
|
9
|
+
var _client_packages_group = require("@zohodesk/client_packages_group");
|
10
|
+
|
11
|
+
var _constants = require("../../constants");
|
12
|
+
|
13
|
+
var _libAlias = require("./common/libAlias");
|
14
|
+
|
15
|
+
function moduleResolver(options) {
|
16
|
+
const {
|
17
|
+
moduleResolvePath,
|
18
|
+
disableES5Transpile
|
19
|
+
} = options.app;
|
20
|
+
const nodeModulesPath = moduleResolvePath // eslint-disable-next-line import/no-dynamic-require, global-require
|
21
|
+
? require(require.resolve(moduleResolvePath, {
|
22
|
+
paths: [options.cwd]
|
23
|
+
})).nodeModulesPath : _client_packages_group.nodeModulesPath; // const {unstableDepsInverse} = options;
|
24
|
+
// console.log({ nodeModulesPath });
|
25
|
+
|
26
|
+
return {
|
27
|
+
modules: [_constants.cliNodemodulesPath, nodeModulesPath, 'node_modules'].filter(Boolean),
|
28
|
+
alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
|
29
|
+
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
function loaderResolver(options) {
|
34
|
+
// const unstableDepsInverse = false;
|
35
|
+
const {
|
36
|
+
unstableDepsInverse
|
37
|
+
} = options;
|
38
|
+
return {
|
39
|
+
modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
|
40
|
+
|
41
|
+
};
|
42
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _readOptions = require("../../schemas/readOptions");
|
9
|
+
|
10
|
+
var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const options = (0, _readOptions.getOptions)();
|
15
|
+
const config = (0, _webpackConfig.default)(options);
|
16
|
+
var _default = config;
|
17
|
+
exports.default = _default;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = webpackBuild;
|
7
|
+
|
8
|
+
var _webpack = require("webpack");
|
9
|
+
|
10
|
+
var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function webpackBuild(options) {
|
15
|
+
const config = (0, _webpackConfig.default)(options);
|
16
|
+
console.log('webpackBuild');
|
17
|
+
(0, _webpack.webpack)(config, (err, stats) => {
|
18
|
+
if (err || stats.hasErrors()) {
|
19
|
+
// ...
|
20
|
+
console.log('err', err);
|
21
|
+
} // Done processing
|
22
|
+
|
23
|
+
});
|
24
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = webpackConfigCreator;
|
7
|
+
|
8
|
+
var _outputConfig = require("./outputConfig");
|
9
|
+
|
10
|
+
var _jsLoaders = require("./jsLoaders");
|
11
|
+
|
12
|
+
var _cssLoaders = require("./cssLoaders");
|
13
|
+
|
14
|
+
var _assetLoaders = require("./loaderConfigs/assetLoaders");
|
15
|
+
|
16
|
+
var _plugins = require("./plugins");
|
17
|
+
|
18
|
+
var _resolvers = require("./resolvers");
|
19
|
+
|
20
|
+
var _optimizationConfig = require("./optimizationConfig");
|
21
|
+
|
22
|
+
var _configHtmlTemplateLoader = require("./loaderConfigs/configHtmlTemplateLoader");
|
23
|
+
|
24
|
+
var _configWebWorkerLoader = require("./loaderConfigs/configWebWorkerLoader");
|
25
|
+
|
26
|
+
// import { devServerConfig } from './devServerConfig';
|
27
|
+
function webpackConfigCreator(options) {
|
28
|
+
return {
|
29
|
+
mode: 'development',
|
30
|
+
output: (0, _outputConfig.outputConfig)(options),
|
31
|
+
devtool: 'cheap-source-map',
|
32
|
+
// stats: 'errors-only',
|
33
|
+
stats: {
|
34
|
+
children: false,
|
35
|
+
colors: true,
|
36
|
+
errorDetails: true // excludeAssets: /i18n/,
|
37
|
+
// excludeAssets: /./,
|
38
|
+
// warningsFilter: /\[mini-css-extract-plugin\]/
|
39
|
+
|
40
|
+
},
|
41
|
+
// devServer: devServerConfig(options),
|
42
|
+
optimization: (0, _optimizationConfig.optimizationConfig)(options),
|
43
|
+
module: {
|
44
|
+
rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options)]
|
45
|
+
},
|
46
|
+
plugins: (0, _plugins.plugins)(options),
|
47
|
+
resolve: (0, _resolvers.moduleResolver)(options),
|
48
|
+
resolveLoader: (0, _resolvers.loaderResolver)(options)
|
49
|
+
};
|
50
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.doBasicRequiermentCheck = doBasicRequiermentCheck;
|
7
|
+
|
8
|
+
function doBasicRequiermentCheck() {
|
9
|
+
const majorV = Number(process.version.slice(1, 4));
|
10
|
+
|
11
|
+
if (majorV >= 12 && majorV <= 18) {
|
12
|
+
return true;
|
13
|
+
}
|
14
|
+
|
15
|
+
throw `your node version not compactable with this cli please update node vesrion to 12 - 18, and your current version is ${process.version}`;
|
16
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getCliPath = void 0;
|
7
|
+
|
8
|
+
var _os = require("os");
|
9
|
+
|
10
|
+
var _fs = require("fs");
|
11
|
+
|
12
|
+
var _path = require("path");
|
13
|
+
|
14
|
+
const appPath = process.cwd();
|
15
|
+
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
16
|
+
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
17
|
+
const suffixExt = isWindows ? '.cmd' : ''; // function searchForCommandPath(commandName) {
|
18
|
+
// let pathFolders = __dirname.split(sep);
|
19
|
+
// let cliPath;
|
20
|
+
// while (pathFolders.pop()) {
|
21
|
+
// cliPath = join(pathFolders.join(sep), 'node_modules', '.bin', commandName);
|
22
|
+
// if (existsSync(cliPath)) {
|
23
|
+
// return cliPath;
|
24
|
+
// }
|
25
|
+
// }
|
26
|
+
// console.warn(`unable to find command "${commandName}"`);
|
27
|
+
// return join(__dirname, '..', 'node_modules', '.bin', commandName);
|
28
|
+
// }
|
29
|
+
|
30
|
+
function searchForCommandPath(libName) {
|
31
|
+
const commandPath = (0, _path.join)(__dirname, '..', '..', '..', 'node_modules', '.bin', libName); // TODO: need to check for windows machine reason command with ext added,
|
32
|
+
// when we use global react-cli package (executable) working or not
|
33
|
+
|
34
|
+
return (0, _fs.existsSync)(commandPath) ? commandPath : libName;
|
35
|
+
}
|
36
|
+
|
37
|
+
const getCliPath = !isNodeModuleUnderAppFolder ? commandName => searchForCommandPath(commandName + suffixExt) : commandName => commandName + suffixExt;
|
38
|
+
exports.getCliPath = getCliPath;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "doBasicRequiermentCheck", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _doBasicRequiermentCheck.doBasicRequiermentCheck;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "readArgsFormCommandLine", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _readArgsFormCommandLine.readArgsFormCommandLine;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "readOptionFormCommandLine", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return _readOptionFormCommandLine.readOptionFormCommandLine;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
var _readArgsFormCommandLine = require("./readArgsFormCommandLine");
|
26
|
+
|
27
|
+
var _readOptionFormCommandLine = require("./readOptionFormCommandLine");
|
28
|
+
|
29
|
+
var _doBasicRequiermentCheck = require("./doBasicRequiermentCheck");
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.spawnIO = spawnIO;
|
7
|
+
exports.spawnSyncIO = spawnSyncIO;
|
8
|
+
|
9
|
+
var _getCliPath = require("./getCliPath");
|
10
|
+
|
11
|
+
const {
|
12
|
+
spawnSync,
|
13
|
+
spawn
|
14
|
+
} = require('child_process');
|
15
|
+
|
16
|
+
function spawnSyncIO(commandName, args) {
|
17
|
+
const command = (0, _getCliPath.getCliPath)(commandName);
|
18
|
+
const result = spawnSync(command, args, {
|
19
|
+
stdio: 'inherit'
|
20
|
+
});
|
21
|
+
|
22
|
+
if (result.error || result.stderr) {
|
23
|
+
console.error(result.error || result.stderr);
|
24
|
+
} // console.log(result.output);
|
25
|
+
|
26
|
+
|
27
|
+
process.exit(result.status);
|
28
|
+
}
|
29
|
+
|
30
|
+
function spawnIO(commandName, args, cb) {
|
31
|
+
// const result =
|
32
|
+
spawn(commandName, args, {
|
33
|
+
stdio: 'inherit'
|
34
|
+
}, cb); // process.exit(result.status);
|
35
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.cliRootPath = exports.cliNodemodulesPath = exports.babelrcPath = exports.appPath = exports.appInitialHTMLTemplatePath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
|
7
|
+
|
8
|
+
var _path = _interopRequireWildcard(require("path"));
|
9
|
+
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
11
|
+
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
13
|
+
|
14
|
+
const BASE_CONFIG_KEY = 'react-cli';
|
15
|
+
exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY;
|
16
|
+
|
17
|
+
const cliRootPath = _path.default.resolve(__dirname, '..', '..');
|
18
|
+
|
19
|
+
exports.cliRootPath = cliRootPath;
|
20
|
+
const CONFIG_ROOT = 'client-build-config';
|
21
|
+
exports.CONFIG_ROOT = CONFIG_ROOT;
|
22
|
+
|
23
|
+
const cliNodemodulesPath = _path.default.resolve(cliRootPath, 'node_modules');
|
24
|
+
|
25
|
+
exports.cliNodemodulesPath = cliNodemodulesPath;
|
26
|
+
const babelrcPath = (0, _path.join)(cliRootPath, '.babelrc');
|
27
|
+
exports.babelrcPath = babelrcPath;
|
28
|
+
const appPath = process.cwd();
|
29
|
+
exports.appPath = appPath;
|
30
|
+
|
31
|
+
const appInitialHTMLTemplatePath = _path.default.join(process.cwd(), 'src', 'index.html');
|
32
|
+
|
33
|
+
exports.appInitialHTMLTemplatePath = appInitialHTMLTemplatePath;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.applyValuesToShema = applyValuesToShema;
|
7
|
+
|
8
|
+
function isObject(obj) {
|
9
|
+
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
10
|
+
}
|
11
|
+
|
12
|
+
function applyValuesToShema(schemas, customOptions, processEnv) {
|
13
|
+
const output = {};
|
14
|
+
|
15
|
+
function decideValue(schema, key, customOptions) {
|
16
|
+
const specificShema = schema[key];
|
17
|
+
const correspondingValue = customOptions && customOptions[key];
|
18
|
+
|
19
|
+
if (isObject(specificShema)) {
|
20
|
+
if (typeof specificShema.cli === 'string') {
|
21
|
+
var _ref, _processEnv$specificS;
|
22
|
+
|
23
|
+
return (_ref = (_processEnv$specificS = processEnv[specificShema.cli]) !== null && _processEnv$specificS !== void 0 ? _processEnv$specificS : correspondingValue) !== null && _ref !== void 0 ? _ref : specificShema.value;
|
24
|
+
}
|
25
|
+
|
26
|
+
return applyValuesToShema(specificShema, correspondingValue, processEnv);
|
27
|
+
}
|
28
|
+
|
29
|
+
return correspondingValue !== null && correspondingValue !== void 0 ? correspondingValue : schema[key];
|
30
|
+
} // console.log({schemas})
|
31
|
+
|
32
|
+
|
33
|
+
Object.keys(schemas).forEach(key => {
|
34
|
+
output[key] = decideValue(schemas, key, customOptions);
|
35
|
+
});
|
36
|
+
return output;
|
37
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.cliArgsToObject = cliArgsToObject;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* experimental argument parsing logic
|
10
|
+
* @param {Array} cliArgs is when we use cli the options or args
|
11
|
+
*
|
12
|
+
* cliArgs:-
|
13
|
+
* `cbt start --port=2332 --mode=prod` in this command
|
14
|
+
* ['--port=2332', '--mode=prod'] these are cliArgs
|
15
|
+
*
|
16
|
+
* retunr {"port": 2332, "mode":"prod"}
|
17
|
+
*/
|
18
|
+
function cliArgsToObject(cliArgs) {
|
19
|
+
const processEnv = {};
|
20
|
+
cliArgs.forEach(option => {
|
21
|
+
if (/^--./.test(option)) {
|
22
|
+
const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
23
|
+
|
24
|
+
let key = option.slice(2, equIndex);
|
25
|
+
let value = option.slice(equIndex + 1);
|
26
|
+
|
27
|
+
if (equIndex === -1) {
|
28
|
+
key = option.slice(2);
|
29
|
+
value = true;
|
30
|
+
}
|
31
|
+
|
32
|
+
key = key.replace(/-|:/g, '_');
|
33
|
+
processEnv[key] = value;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
return processEnv;
|
37
|
+
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _os = require("os");
|
9
|
+
|
10
|
+
// import { join } from 'path';
|
11
|
+
// import { cliRootPath } from '../constants';
|
12
|
+
// import { getIp } from '../server/getIp';
|
13
|
+
var _default = {
|
14
|
+
context: {
|
15
|
+
value: 'app',
|
16
|
+
cli: 'context'
|
17
|
+
},
|
18
|
+
enableChunkHash: {
|
19
|
+
value: true,
|
20
|
+
cli: 'enablehash'
|
21
|
+
},
|
22
|
+
output: {
|
23
|
+
value: 'build',
|
24
|
+
cli: 'output'
|
25
|
+
},
|
26
|
+
server: {
|
27
|
+
httpsCerts: {
|
28
|
+
value: '',
|
29
|
+
cli: 'https_certs'
|
30
|
+
},
|
31
|
+
host: {
|
32
|
+
value: (0, _os.hostname)(),
|
33
|
+
cli: 'host'
|
34
|
+
},
|
35
|
+
port: {
|
36
|
+
value: 9090,
|
37
|
+
cli: 'port'
|
38
|
+
},
|
39
|
+
domain: {
|
40
|
+
value: 'tsi',
|
41
|
+
cli: 'domain'
|
42
|
+
},
|
43
|
+
// domain: { value: null, cli: 'domain' },
|
44
|
+
mode: {
|
45
|
+
value: 'dev',
|
46
|
+
cli: 'mode'
|
47
|
+
},
|
48
|
+
disableContextURL: false,
|
49
|
+
hasMock: false,
|
50
|
+
mockPrefix: {
|
51
|
+
value: '/api',
|
52
|
+
cli: 'mock_prefix'
|
53
|
+
},
|
54
|
+
mockPort: {
|
55
|
+
value: 5000,
|
56
|
+
cli: 'mock_port'
|
57
|
+
}
|
58
|
+
},
|
59
|
+
css: {
|
60
|
+
selectorReplace: null,
|
61
|
+
classNameOptions: {
|
62
|
+
classNamePrefix: 'zd',
|
63
|
+
classNameBlob: false
|
64
|
+
},
|
65
|
+
plugins: {
|
66
|
+
rtlSplit: {
|
67
|
+
enableRTLSplit: false,
|
68
|
+
templateLabel: '{{--dir}}',
|
69
|
+
disableMinifySelector: false,
|
70
|
+
dirVarName: 'document.dir'
|
71
|
+
},
|
72
|
+
rtl: {
|
73
|
+
enable: false,
|
74
|
+
exclude: []
|
75
|
+
}
|
76
|
+
}
|
77
|
+
},
|
78
|
+
i18nChunkSplit: {
|
79
|
+
chunkSplitEnable: {
|
80
|
+
value: false,
|
81
|
+
cli: 'i18n_split'
|
82
|
+
},
|
83
|
+
disableDefault: false,
|
84
|
+
templateLabel: '{{--user-locale}}',
|
85
|
+
localeVarName: 'document.documentElement.lang',
|
86
|
+
jsonpFunc: 'console.log',
|
87
|
+
jsResource: null,
|
88
|
+
propertiesFolder: null
|
89
|
+
},
|
90
|
+
app: {
|
91
|
+
tpFolder: null,
|
92
|
+
moduleResolvePath: {
|
93
|
+
value: '',
|
94
|
+
cli: 'module_resolve_path'
|
95
|
+
},
|
96
|
+
htmlTemplate: {
|
97
|
+
inject: true
|
98
|
+
},
|
99
|
+
cdnMapping: {
|
100
|
+
isCdnEnabled: false,
|
101
|
+
variableName: '',
|
102
|
+
cssTemplate: '',
|
103
|
+
jsTemplate: '',
|
104
|
+
i18nTemplate: ''
|
105
|
+
},
|
106
|
+
serviceWorker: {
|
107
|
+
enableSw: false,
|
108
|
+
filePath: 'sw.js',
|
109
|
+
fileName: 'v1.js',
|
110
|
+
exitPath: '/',
|
111
|
+
replaceText: '//<!--AssetsFromBuild -->'
|
112
|
+
},
|
113
|
+
enableSMap: {
|
114
|
+
value: false,
|
115
|
+
cli: 'source_map_enable'
|
116
|
+
}
|
117
|
+
}
|
118
|
+
};
|
119
|
+
exports.default = _default;
|