@zohodesk/react-cli 1.1.11-exp.2 → 1.1.11-exp.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -0
- package/lib/plugins/StatsPlugin.js +74 -134
- package/lib/schemas/index.js +2 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- 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
- package/packages/client_build_tool/node_modules/history/CHANGES.md +395 -0
- package/packages/client_build_tool/node_modules/history/DOMUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +3 -0
- package/packages/client_build_tool/node_modules/history/LICENSE +21 -0
- package/packages/client_build_tool/node_modules/history/LocationUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/PathUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/README.md +282 -0
- package/packages/client_build_tool/node_modules/history/cjs/history.js +933 -0
- package/packages/client_build_tool/node_modules/history/cjs/history.min.js +1 -0
- package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createHashHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createTransitionManager.js +3 -0
- package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/PathUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +35 -0
- package/packages/client_build_tool/node_modules/history/esm/history.js +904 -0
- package/packages/client_build_tool/node_modules/history/index.js +7 -0
- package/packages/client_build_tool/node_modules/history/package.json +117 -0
- package/packages/client_build_tool/node_modules/history/umd/history.js +1059 -0
- package/packages/client_build_tool/node_modules/history/umd/history.min.js +1 -0
- package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +35 -0
package/README.md
CHANGED
@@ -44,6 +44,13 @@ Now to run app
|
|
44
44
|
|
45
45
|
# Change Logs
|
46
46
|
|
47
|
+
# 1.1.11-exp.3 (22-8-2023)
|
48
|
+
|
49
|
+
**Changes**
|
50
|
+
- Changed the default name of stats file to `build-report-integrity.json`
|
51
|
+
- Added optimization to reduce the stats file creation time. like streaming.
|
52
|
+
- Added support to exclude keys suggested
|
53
|
+
|
47
54
|
# 1.1.11-exp.2 (11-8-2023)
|
48
55
|
|
49
56
|
**Changes**
|
@@ -10,27 +10,51 @@ const {
|
|
10
10
|
|
11
11
|
const pluginName = 'stats-plugin';
|
12
12
|
const statsSchema = {
|
13
|
-
all:
|
14
|
-
children: false,
|
15
|
-
source: false,
|
16
|
-
assets: true,
|
17
|
-
chunks: true,
|
18
|
-
chunkGroups: true,
|
19
|
-
chunkOrigins: true,
|
20
|
-
chunkModules: true,
|
21
|
-
entrypoints: true,
|
22
|
-
modules: true,
|
23
|
-
moduleTrace: true,
|
24
|
-
outputPath: true,
|
25
|
-
performance: true,
|
26
|
-
reasons: true
|
13
|
+
all: true
|
27
14
|
};
|
28
15
|
|
16
|
+
function* convertObjectToStringGen(obj, excludeKeys = []) {
|
17
|
+
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || obj === null) {
|
18
|
+
yield JSON.stringify(obj);
|
19
|
+
} else if (Array.isArray(obj)) {
|
20
|
+
yield '[';
|
21
|
+
let isFirst = true;
|
22
|
+
|
23
|
+
for (let item of obj) {
|
24
|
+
if (item === undefined) {
|
25
|
+
item = null;
|
26
|
+
}
|
27
|
+
|
28
|
+
yield `${isFirst ? '' : ','}`;
|
29
|
+
yield* convertObjectToStringGen(item, excludeKeys);
|
30
|
+
isFirst = false;
|
31
|
+
}
|
32
|
+
|
33
|
+
yield obj.length ? ']' : ']';
|
34
|
+
} else {
|
35
|
+
yield '{';
|
36
|
+
let isFirst = true;
|
37
|
+
const entries = Object.entries(obj);
|
38
|
+
|
39
|
+
for (const [itemKey, itemValue] of entries) {
|
40
|
+
if (itemValue === undefined || excludeKeys.includes(itemKey)) {
|
41
|
+
continue;
|
42
|
+
}
|
43
|
+
|
44
|
+
yield `${isFirst ? '' : ','}${JSON.stringify(itemKey)}: `;
|
45
|
+
yield* convertObjectToStringGen(itemValue, excludeKeys);
|
46
|
+
isFirst = false;
|
47
|
+
}
|
48
|
+
|
49
|
+
yield entries.length ? '}' : '}';
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
29
53
|
class StatsPlugin {
|
30
54
|
constructor({
|
31
55
|
statsOptions = {},
|
32
56
|
statsOutputExcludeKeys = [],
|
33
|
-
statsFileName = '
|
57
|
+
statsFileName = 'bundle-report-integrity.json'
|
34
58
|
}) {
|
35
59
|
this.excludeKeysInStat = statsOutputExcludeKeys;
|
36
60
|
this.statsOptions = Object.assign({}, statsSchema, statsOptions);
|
@@ -44,131 +68,47 @@ class StatsPlugin {
|
|
44
68
|
});
|
45
69
|
}
|
46
70
|
|
47
|
-
|
48
|
-
return Object.keys(statsJson).reduce((acc, cur) => {
|
49
|
-
if (this.excludeKeysInStat.includes(cur)) {
|
50
|
-
return acc;
|
51
|
-
}
|
52
|
-
|
53
|
-
acc[cur] = statsJson[cur];
|
54
|
-
return acc;
|
55
|
-
}, {});
|
56
|
-
}
|
57
|
-
|
58
|
-
emitStats(statsJson) {
|
71
|
+
writeStatsFileInAStream(statsObj) {
|
59
72
|
const {
|
60
73
|
outputPath
|
61
|
-
} =
|
62
|
-
const
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
74
|
+
} = statsObj;
|
75
|
+
const ouputFileName = path.join(outputPath, this.statsFileName);
|
76
|
+
this.createReadStream(statsObj).pipe(fs.createWriteStream(ouputFileName)).on('end', () => {
|
77
|
+
console.log(`${this.statsFileName} generated successfully`);
|
78
|
+
}).on('error', e => {
|
79
|
+
console.error('error in stats generation', e);
|
80
|
+
});
|
81
|
+
}
|
82
|
+
|
83
|
+
createReadStream(statsObj) {
|
84
|
+
const excludeKeys = this.excludeKeysInStat;
|
85
|
+
return new Readable({
|
86
|
+
read() {
|
87
|
+
let isDone = false;
|
88
|
+
const objToStringGen = convertObjectToStringGen(statsObj, excludeKeys);
|
89
|
+
|
90
|
+
while (!isDone) {
|
91
|
+
const {
|
92
|
+
done,
|
93
|
+
value
|
94
|
+
} = objToStringGen.next();
|
95
|
+
|
96
|
+
if (done) {
|
97
|
+
isDone = true;
|
98
|
+
this.push(null);
|
99
|
+
} else {
|
100
|
+
this.push(value);
|
101
|
+
}
|
102
|
+
}
|
67
103
|
}
|
104
|
+
|
68
105
|
});
|
69
106
|
}
|
70
107
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
// this._indentLevel = 0;
|
75
|
-
// this._stringifier = this._stringify(stats);
|
76
|
-
// }
|
77
|
-
// get _indent() {
|
78
|
-
// return ' '.repeat(this._indentLevel);
|
79
|
-
// }
|
80
|
-
// _read() {
|
81
|
-
// let readMore = true;
|
82
|
-
// while (readMore) {
|
83
|
-
// const { value, done } = this._stringifier.next();
|
84
|
-
// if (done) {
|
85
|
-
// this.push(null);
|
86
|
-
// readMore = false;
|
87
|
-
// } else {
|
88
|
-
// readMore = this.push(value);
|
89
|
-
// }
|
90
|
-
// }
|
91
|
-
// }
|
92
|
-
// *_stringify(obj) {
|
93
|
-
// if (
|
94
|
-
// typeof obj === 'string' ||
|
95
|
-
// typeof obj === 'number' ||
|
96
|
-
// typeof obj === 'boolean' ||
|
97
|
-
// obj === null
|
98
|
-
// ) {
|
99
|
-
// yield JSON.stringify(obj);
|
100
|
-
// } else if (Array.isArray(obj)) {
|
101
|
-
// yield '[';
|
102
|
-
// this._indentLevel++;
|
103
|
-
// let isFirst = true;
|
104
|
-
// for (let item of obj) {
|
105
|
-
// if (item === undefined) {
|
106
|
-
// item = null;
|
107
|
-
// }
|
108
|
-
// yield `${isFirst ? '' : ','}\n${this._indent}`;
|
109
|
-
// yield* this._stringify(item);
|
110
|
-
// isFirst = false;
|
111
|
-
// }
|
112
|
-
// this._indentLevel--;
|
113
|
-
// yield obj.length ? `\n${this._indent}]` : ']';
|
114
|
-
// } else {
|
115
|
-
// yield '{';
|
116
|
-
// this._indentLevel++;
|
117
|
-
// let isFirst = true;
|
118
|
-
// const entries = Object.entries(obj);
|
119
|
-
// for (const [itemKey, itemValue] of entries) {
|
120
|
-
// if (itemValue === undefined) {
|
121
|
-
// continue;
|
122
|
-
// }
|
123
|
-
// yield `${isFirst ? '' : ','}\n${this._indent}${JSON.stringify(
|
124
|
-
// itemKey
|
125
|
-
// )}: `;
|
126
|
-
// yield* this._stringify(itemValue);
|
127
|
-
// isFirst = false;
|
128
|
-
// }
|
129
|
-
// this._indentLevel--;
|
130
|
-
// yield entries.length ? `\n${this._indent}}` : '}';
|
131
|
-
// }
|
132
|
-
// }
|
133
|
-
// }
|
134
|
-
// function writeStats(stats, filepath) {
|
135
|
-
// return new Promise((resolve, reject) => {
|
136
|
-
// new StatsSerializeStream(stats)
|
137
|
-
// .on('end', resolve)
|
138
|
-
// .on('error', reject)
|
139
|
-
// .pipe(fs.createWriteStream(filepath));
|
140
|
-
// });
|
141
|
-
// }
|
142
|
-
// class StatsStremPlugin {
|
143
|
-
// constructor({ statsOptions = {}, statsOutputExcludeKeys = [] }) {
|
144
|
-
// this.excludeKeysInStat = statsOutputExcludeKeys;
|
145
|
-
// this.statsOptions = Object.assign({}, statsSchema, statsOptions);
|
146
|
-
// }
|
147
|
-
// apply(compiler) {
|
148
|
-
// compiler.hooks.done.tap(pluginName, stats => {
|
149
|
-
// const statsJson = stats.toJson(this.statsOptions);
|
150
|
-
// this.emitStats(statsJson);
|
151
|
-
// });
|
152
|
-
// }
|
153
|
-
// transform(statsJson) {
|
154
|
-
// return Object.keys(statsJson).reduce((acc, cur) => {
|
155
|
-
// if (this.excludeKeysInStat.includes(cur)) {
|
156
|
-
// return acc;
|
157
|
-
// }
|
158
|
-
// acc[cur] = statsJson[cur];
|
159
|
-
// return acc;
|
160
|
-
// }, {});
|
161
|
-
// }
|
162
|
-
// emitStats(statsJson) {
|
163
|
-
// const { outputPath } = statsJson;
|
164
|
-
// const transformedStatsJson = this.transform(statsJson);
|
165
|
-
// // const stringifiedJson =
|
166
|
-
// // typeof statsJson === 'object'
|
167
|
-
// // ? JSON.stringify(transformedStatsJson)
|
168
|
-
// // : transformedStatsJson;
|
169
|
-
// writeStats(transformedStatsJson, outputPath + 'jos-stats.json');
|
170
|
-
// }
|
171
|
-
// }
|
108
|
+
emitStats(statsJson) {
|
109
|
+
return this.writeStatsFileInAStream(statsJson);
|
110
|
+
}
|
172
111
|
|
112
|
+
}
|
173
113
|
|
174
114
|
module.exports = StatsPlugin;
|
package/lib/schemas/index.js
CHANGED
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zohodesk/react-cli",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.10",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "@zohodesk/react-cli",
|
9
|
-
"version": "1.1.
|
9
|
+
"version": "1.1.10",
|
10
10
|
"license": "ISC",
|
11
11
|
"dependencies": {
|
12
12
|
"@babel/cli": "7.10.5",
|
package/package.json
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _fs = require("fs");
|
9
|
+
|
10
|
+
var _path = require("path");
|
11
|
+
|
12
|
+
const allConfigs = [];
|
13
|
+
(0, _fs.readdirSync)((0, _path.join)(__dirname, 'commands')).forEach(folderName => {
|
14
|
+
const modulePath = (0, _path.join)(__dirname, './commands/' + folderName + '/config.js');
|
15
|
+
|
16
|
+
if ((0, _fs.existsSync)(modulePath)) {
|
17
|
+
const config = require(modulePath).default;
|
18
|
+
|
19
|
+
allConfigs.push(config);
|
20
|
+
}
|
21
|
+
});
|
22
|
+
var _default = allConfigs;
|
23
|
+
exports.default = _default;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.debugLogger = debugLogger;
|
7
|
+
exports.errorLogger = errorLogger;
|
8
|
+
exports.messageLogger = messageLogger;
|
9
|
+
exports.verboseLogger = verboseLogger;
|
10
|
+
exports.warnLogger = warnLogger;
|
11
|
+
|
12
|
+
/* eslint-disable no-console */
|
13
|
+
function verboseLogger(...args) {// TODO: need to be remove when publish happens
|
14
|
+
// console.log(...args);
|
15
|
+
console.log(...args);
|
16
|
+
}
|
17
|
+
|
18
|
+
function warnLogger(...args) {
|
19
|
+
console.warn(...args);
|
20
|
+
}
|
21
|
+
|
22
|
+
function messageLogger(...args) {
|
23
|
+
console.log(...args);
|
24
|
+
}
|
25
|
+
|
26
|
+
function debugLogger(...args) {// TODO: need to be remove when publish happens
|
27
|
+
// console.log(...args);
|
28
|
+
}
|
29
|
+
|
30
|
+
function errorLogger(...args) {
|
31
|
+
console.error(...args);
|
32
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.commandExecutor = commandExecutor;
|
7
|
+
|
8
|
+
var _buildToolLoggers = require("../../buildToolLoggers");
|
9
|
+
|
10
|
+
var _webpackBuild = _interopRequireDefault(require("../../shared/bundler/webpack/webpackBuild"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
// import { spawnSyncIO } from '../../shared/commands-utlis/spanSync';
|
15
|
+
function commandExecutor(options) {
|
16
|
+
(0, _buildToolLoggers.messageLogger)('Build is runnning');
|
17
|
+
(0, _webpackBuild.default)(options); // spawnSyncIO('webpack', [
|
18
|
+
// '--config',
|
19
|
+
// require.resolve('../../shared/bundler/webpack/webpack.dev.config.js')
|
20
|
+
// ]);
|
21
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.configs = void 0;
|
7
|
+
|
8
|
+
var _commandExecutor = require("./commandExecutor");
|
9
|
+
|
10
|
+
var _errorHander = require("./errorHander");
|
11
|
+
|
12
|
+
var _optionsProcesser = require("./optionsProcesser");
|
13
|
+
|
14
|
+
// import { spawnSyncIO } from '../commands-utlis/spanSync.js';
|
15
|
+
function run(options) {
|
16
|
+
// const { disableWatch } = options.app;
|
17
|
+
// spawnSyncIO('node', [
|
18
|
+
// require.resolve(
|
19
|
+
// disableWatch ? '../servers/nowatchserver' : '../servers/server'
|
20
|
+
// ),
|
21
|
+
// '--expose-http2',
|
22
|
+
// ...args
|
23
|
+
// ]);
|
24
|
+
(0, _commandExecutor.commandExecutor)(options).then(console.log).catch(e => {
|
25
|
+
(0, _errorHander.errorHander)(e);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
const configs = {
|
30
|
+
name: 'devSeverStart',
|
31
|
+
alias: ['start'],
|
32
|
+
optionsProcesser: _optionsProcesser.optionsProcesser,
|
33
|
+
run
|
34
|
+
};
|
35
|
+
exports.configs = configs;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.optionsProcesser = optionsProcesser;
|
7
|
+
|
8
|
+
var _path = require("path");
|
9
|
+
|
10
|
+
var _decidePublicPath = require("../../shared/bundler/webpack/common/decidePublicPath");
|
11
|
+
|
12
|
+
var _urlConcat = require("../../shared/server/urlConcat");
|
13
|
+
|
14
|
+
function optionsProcesser(options) {
|
15
|
+
const {
|
16
|
+
server,
|
17
|
+
context
|
18
|
+
} = options;
|
19
|
+
const {
|
20
|
+
disableContextURL
|
21
|
+
} = server;
|
22
|
+
const serverExtras = (0, _decidePublicPath.modifiedServerOptions)(options);
|
23
|
+
const publicPath = (0, _decidePublicPath.decidePublicPath)(serverExtras);
|
24
|
+
const contextURL = disableContextURL ? '' : `/${context}`;
|
25
|
+
const serverURL = (0, _urlConcat.urlConcat)(publicPath, contextURL);
|
26
|
+
const contextFolderPath = (0, _path.join)(process.cwd(), context);
|
27
|
+
console.log({
|
28
|
+
serverURL,
|
29
|
+
publicPath
|
30
|
+
});
|
31
|
+
const defaultApplyedOptions = { ...options,
|
32
|
+
serverExtras,
|
33
|
+
publicPath,
|
34
|
+
contextURL,
|
35
|
+
serverURL,
|
36
|
+
contextFolderPath,
|
37
|
+
httpsOptions: serverExtras.httpsOptions
|
38
|
+
};
|
39
|
+
return defaultApplyedOptions;
|
40
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.commandExecutor = commandExecutor;
|
7
|
+
|
8
|
+
var _spanSync = require("../../shared/commands-utlis/spanSync");
|
9
|
+
|
10
|
+
var _constants = require("../../shared/constants");
|
11
|
+
|
12
|
+
function commandExecutor(options) {
|
13
|
+
const {
|
14
|
+
extraArgs
|
15
|
+
} = options;
|
16
|
+
(0, _spanSync.spawnSyncIO)("babel", ["src", "--out-dir", "es", "--copy-files", "--config-file=" + _constants.babelrcPath, ...extraArgs]);
|
17
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.commandExecutor = commandExecutor;
|
7
|
+
|
8
|
+
var _spanSync = require("../../shared/commands-utlis/spanSync");
|
9
|
+
|
10
|
+
var _constants = require("../../shared/constants");
|
11
|
+
|
12
|
+
function commandExecutor(options) {
|
13
|
+
const {
|
14
|
+
extraArgs
|
15
|
+
} = options;
|
16
|
+
(0, _spanSync.spawnSyncIO)("babel", ["src", "--out-dir", "lib", "--copy-files", "--config-file=" + _constants.babelrcPath, ...extraArgs]);
|
17
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.commandExecutor = commandExecutor;
|
7
|
+
|
8
|
+
var _serverBywebpackDevMiddleware = require("../../shared/server/serverBywebpackDevMiddleware");
|
9
|
+
|
10
|
+
function commandExecutor(options) {
|
11
|
+
// require("../../shared/server/devServer").run(options);
|
12
|
+
(0, _serverBywebpackDevMiddleware.run)(options);
|
13
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.deprecationHandler = deprecationHandler;
|
7
|
+
|
8
|
+
function deprecationHandler(options) {// options.app.deprecated &&
|
9
|
+
// console.log('options.app.deprecated this option was deprecated since V1.3.1' );
|
10
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.optionsProcesser = optionsProcesser;
|
7
|
+
|
8
|
+
var _path = require("path");
|
9
|
+
|
10
|
+
var _decidePublicPath = require("../../shared/bundler/webpack/common/decidePublicPath");
|
11
|
+
|
12
|
+
var _urlConcat = require("../../shared/server/urlConcat");
|
13
|
+
|
14
|
+
function optionsProcesser(options) {
|
15
|
+
const {
|
16
|
+
server,
|
17
|
+
context
|
18
|
+
} = options;
|
19
|
+
const {
|
20
|
+
disableContextURL
|
21
|
+
} = server;
|
22
|
+
const serverExtras = (0, _decidePublicPath.modifiedServerOptions)(options);
|
23
|
+
const publicPath = (0, _decidePublicPath.decidePublicPath)(serverExtras);
|
24
|
+
const contextURL = disableContextURL ? '' : `/${context}`;
|
25
|
+
const serverURL = (0, _urlConcat.urlConcat)(publicPath, contextURL);
|
26
|
+
const contextFolderPath = (0, _path.join)(process.cwd(), context);
|
27
|
+
const defaultApplyedOptions = { ...options,
|
28
|
+
serverExtras,
|
29
|
+
publicPath,
|
30
|
+
contextURL,
|
31
|
+
serverURL,
|
32
|
+
contextFolderPath,
|
33
|
+
httpsOptions: serverExtras.httpsOptions
|
34
|
+
};
|
35
|
+
return defaultApplyedOptions;
|
36
|
+
}
|