@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.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/.eslintignore +7 -7
- package/.eslintrc.js +180 -179
- package/.prettierrc +6 -6
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +27 -951
- package/bin/cli.js +483 -483
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/configs/jest.config.js +8 -12
- package/lib/configs/libAlias.js +10 -3
- package/lib/configs/resolvers.js +38 -0
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +17 -22
- package/lib/configs/webpack.docs.config.js +10 -15
- package/lib/configs/webpack.impact.config.js +11 -11
- package/lib/configs/webpack.prod.config.js +22 -24
- package/lib/constants.js +31 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- package/lib/loaderUtils/getCSSLoaders.js +42 -22
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
- package/lib/pluginUtils/getDevPlugins.js +19 -39
- package/lib/pluginUtils/getProdPlugins.js +29 -47
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -24
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +54 -30
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +248 -0
- package/lib/postcss-plugins/variableModifier.js +1 -0
- package/lib/schemas/index.js +36 -8
- package/lib/servers/docsServerCore.js +13 -12
- package/lib/servers/getCliPath.js +1 -1
- package/lib/servers/httpsOptions.js +40 -9
- package/lib/servers/nowatchserver.js +12 -11
- package/lib/servers/server.js +14 -13
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/getOptions.js +42 -14
- package/lib/utils/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package.json +119 -148
- package/postpublish.js +8 -6
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/cert/Tsicsezwild-22-23.crt +0 -37
- package/cert/Tsicsezwild-22-23.key +0 -27
package/lib/servers/server.js
CHANGED
|
@@ -25,14 +25,15 @@ var _httpsOptions = require("./httpsOptions");
|
|
|
25
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
26
|
|
|
27
27
|
// import fs from 'fs';
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const options = (0, _utils.getOptions)();
|
|
29
|
+
const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
|
|
30
|
+
const {
|
|
30
31
|
app: {
|
|
31
32
|
context,
|
|
32
33
|
server
|
|
33
34
|
}
|
|
34
35
|
} = options;
|
|
35
|
-
|
|
36
|
+
const {
|
|
36
37
|
host,
|
|
37
38
|
port,
|
|
38
39
|
domain,
|
|
@@ -41,9 +42,9 @@ let {
|
|
|
41
42
|
hasMock,
|
|
42
43
|
mockPort
|
|
43
44
|
} = server;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const isCompatableHttp2 = Number(process.version.substr(1).split('.')[0]) >= 8;
|
|
46
|
+
const contextURL = disableContextURL ? '' : `/${context}`;
|
|
47
|
+
const serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
|
|
47
48
|
const {
|
|
48
49
|
writeToDisk
|
|
49
50
|
} = options.impactService;
|
|
@@ -72,8 +73,8 @@ if (mode === 'prod') {
|
|
|
72
73
|
} // console.log({ contextURL });
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
const compiler = (0, _webpack.default)(config);
|
|
77
|
+
const webpackServerOptions = {
|
|
77
78
|
logLevel: 'error',
|
|
78
79
|
publicPath: mode === 'prod' ? contextURL === '' ? `${serverUrl}/${contextURL}` : serverUrl + contextURL : config.output.publicPath,
|
|
79
80
|
headers: options.app.enableDevCache ? {
|
|
@@ -114,7 +115,7 @@ app.use('/wms/*', (req, res) => {
|
|
|
114
115
|
res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
|
|
115
116
|
});
|
|
116
117
|
|
|
117
|
-
const httpsServer = _https.default.createServer(
|
|
118
|
+
const httpsServer = _https.default.createServer(httpsOptions, app);
|
|
118
119
|
|
|
119
120
|
const wss = new _ws.default.Server({
|
|
120
121
|
server: httpsServer
|
|
@@ -132,7 +133,7 @@ wss.on('connection', ws => {
|
|
|
132
133
|
});
|
|
133
134
|
app.post('/wmsmockapi', (req, res) => {
|
|
134
135
|
wsPool.forEach(ws => {
|
|
135
|
-
|
|
136
|
+
const {
|
|
136
137
|
body
|
|
137
138
|
} = req;
|
|
138
139
|
|
|
@@ -178,7 +179,7 @@ httpsServer.listen(port, err => {
|
|
|
178
179
|
if (isCompatableHttp2) {
|
|
179
180
|
const http2 = require('http2');
|
|
180
181
|
|
|
181
|
-
const http2Server = http2.createSecureServer(
|
|
182
|
+
const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
|
|
182
183
|
|
|
183
184
|
http2Server.on('stream', (stream, headers) => {
|
|
184
185
|
stream.respond({
|
|
@@ -187,7 +188,7 @@ if (isCompatableHttp2) {
|
|
|
187
188
|
});
|
|
188
189
|
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
|
189
190
|
});
|
|
190
|
-
|
|
191
|
+
const http2Port = Number(port) + 1;
|
|
191
192
|
http2Server.listen(http2Port, err => {
|
|
192
193
|
if (err) {
|
|
193
194
|
throw err;
|
|
@@ -203,7 +204,7 @@ if (isCompatableHttp2) {
|
|
|
203
204
|
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
|
|
207
|
+
const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
|
|
207
208
|
app.listen(httpPort, err => {
|
|
208
209
|
if (err) {
|
|
209
210
|
throw err;
|
package/lib/sh/pre-commit.sh
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
|
|
4
|
-
|
|
5
|
-
CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
|
|
6
|
-
|
|
7
|
-
echo "Branch Name - $CURRENT_BRANCH"
|
|
8
|
-
|
|
9
|
-
if [[ "$STAGED_FILES" = "" ]]; then
|
|
10
|
-
exit 0
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
IS_FAILED=false
|
|
14
|
-
FILES=""
|
|
15
|
-
|
|
16
|
-
for FILE in $STAGED_FILES # Add files with space separation
|
|
17
|
-
do
|
|
18
|
-
FILES+="$FILE "
|
|
19
|
-
done
|
|
20
|
-
|
|
21
|
-
npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
|
|
22
|
-
|
|
23
|
-
if [[ "$?" != 0 ]]; then
|
|
24
|
-
IS_FAILED=true
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
if $IS_FAILED; then
|
|
28
|
-
echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
|
|
29
|
-
exit 1
|
|
30
|
-
else
|
|
31
|
-
echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
exit $?
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
|
|
4
|
+
|
|
5
|
+
CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
|
|
6
|
+
|
|
7
|
+
echo "Branch Name - $CURRENT_BRANCH"
|
|
8
|
+
|
|
9
|
+
if [[ "$STAGED_FILES" = "" ]]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
IS_FAILED=false
|
|
14
|
+
FILES=""
|
|
15
|
+
|
|
16
|
+
for FILE in $STAGED_FILES # Add files with space separation
|
|
17
|
+
do
|
|
18
|
+
FILES+="$FILE "
|
|
19
|
+
done
|
|
20
|
+
|
|
21
|
+
npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
|
|
22
|
+
|
|
23
|
+
if [[ "$?" != 0 ]]; then
|
|
24
|
+
IS_FAILED=true
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if $IS_FAILED; then
|
|
28
|
+
echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
|
|
29
|
+
exit 1
|
|
30
|
+
else
|
|
31
|
+
echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
exit $?
|
package/lib/sh/reportPublish.sh
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
branchName=$2
|
|
3
|
-
url=$1
|
|
4
|
-
zipUrl=$3
|
|
5
|
-
unique=$(date +"%d_%m_%y_Time_%H_%M_%S")
|
|
6
|
-
publishFolder=$branchName"_"$unique
|
|
7
|
-
|
|
8
|
-
rm -rf ./reports
|
|
9
|
-
rm -rf ./scrTemplate
|
|
10
|
-
rm -rf ./errTemplate
|
|
11
|
-
rm -rf ./css
|
|
12
|
-
rm -rf ./js
|
|
13
|
-
rm -rf ./index.html
|
|
14
|
-
|
|
15
|
-
curl $zipUrl | tar xz
|
|
16
|
-
|
|
17
|
-
cp -rf ./reports/css ./css
|
|
18
|
-
cp -rf ./reports/js ./js
|
|
19
|
-
cp -rf ./reports/index.html ./index.html
|
|
20
|
-
if [ -d "./screenShots" ] ; then
|
|
21
|
-
cp -rf ./scrTemplate/* ./screenShots/
|
|
22
|
-
else
|
|
23
|
-
mkdir ./screenShots
|
|
24
|
-
cp -rf ./scrTemplate/* ./screenShots/
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
[ ! -f "./result.json" ] && touch result.json && cp -rf ./errTemplate/* ./result.json
|
|
28
|
-
[ ! -d "./commitCoverage" ] && mkdir commitCoverage && cp -rf ./errTemplate/* ./commitCoverage/
|
|
29
|
-
[ ! -d "./unittest" ] && mkdir unittest && cp -rf ./errTemplate/* ./unittest/
|
|
30
|
-
[ ! -d "./coverageTest" ] && mkdir coverageTest && cp -rf ./errTemplate/* ./coverageTest/
|
|
31
|
-
[ ! -d "./coverage" ] && mkdir coverage && cp -rf ./errTemplate/* ./coverage/
|
|
32
|
-
|
|
33
|
-
tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html ./result.json
|
|
34
|
-
|
|
35
|
-
curl -i -F name=file -F file=@$publishFolder.tar.gz $url"/cgi-bin/upload.py"
|
|
36
|
-
replace=$publishFolder
|
|
37
|
-
reportUrl=$url"/"$replace
|
|
38
|
-
subject="Client Report - React - $publishFolder"
|
|
39
|
-
msg="<p><b>Report URL - <a href='$reportUrl'>Link</a></b></p>
|
|
40
|
-
<p><b>Report Branchname - $branchName</b></p>
|
|
41
|
-
<p><b>Report Unique ID - $unique</b></p>
|
|
42
|
-
<p><b>Report Developer - $6</b></p>"
|
|
43
|
-
#node mailSender.js <from> <pass> <to> <subject> <text>
|
|
44
|
-
BASEDIR=$(dirname "$0")
|
|
45
|
-
node $BASEDIR"/../utils/mailSender" $4 $5 $6 "$subject" "$msg" $7 $8 "$reportUrl"
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
branchName=$2
|
|
3
|
+
url=$1
|
|
4
|
+
zipUrl=$3
|
|
5
|
+
unique=$(date +"%d_%m_%y_Time_%H_%M_%S")
|
|
6
|
+
publishFolder=$branchName"_"$unique
|
|
7
|
+
|
|
8
|
+
rm -rf ./reports
|
|
9
|
+
rm -rf ./scrTemplate
|
|
10
|
+
rm -rf ./errTemplate
|
|
11
|
+
rm -rf ./css
|
|
12
|
+
rm -rf ./js
|
|
13
|
+
rm -rf ./index.html
|
|
14
|
+
|
|
15
|
+
curl $zipUrl | tar xz
|
|
16
|
+
|
|
17
|
+
cp -rf ./reports/css ./css
|
|
18
|
+
cp -rf ./reports/js ./js
|
|
19
|
+
cp -rf ./reports/index.html ./index.html
|
|
20
|
+
if [ -d "./screenShots" ] ; then
|
|
21
|
+
cp -rf ./scrTemplate/* ./screenShots/
|
|
22
|
+
else
|
|
23
|
+
mkdir ./screenShots
|
|
24
|
+
cp -rf ./scrTemplate/* ./screenShots/
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
[ ! -f "./result.json" ] && touch result.json && cp -rf ./errTemplate/* ./result.json
|
|
28
|
+
[ ! -d "./commitCoverage" ] && mkdir commitCoverage && cp -rf ./errTemplate/* ./commitCoverage/
|
|
29
|
+
[ ! -d "./unittest" ] && mkdir unittest && cp -rf ./errTemplate/* ./unittest/
|
|
30
|
+
[ ! -d "./coverageTest" ] && mkdir coverageTest && cp -rf ./errTemplate/* ./coverageTest/
|
|
31
|
+
[ ! -d "./coverage" ] && mkdir coverage && cp -rf ./errTemplate/* ./coverage/
|
|
32
|
+
|
|
33
|
+
tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html ./result.json
|
|
34
|
+
|
|
35
|
+
curl -i -F name=file -F file=@$publishFolder.tar.gz $url"/cgi-bin/upload.py"
|
|
36
|
+
replace=$publishFolder
|
|
37
|
+
reportUrl=$url"/"$replace
|
|
38
|
+
subject="Client Report - React - $publishFolder"
|
|
39
|
+
msg="<p><b>Report URL - <a href='$reportUrl'>Link</a></b></p>
|
|
40
|
+
<p><b>Report Branchname - $branchName</b></p>
|
|
41
|
+
<p><b>Report Unique ID - $unique</b></p>
|
|
42
|
+
<p><b>Report Developer - $6</b></p>"
|
|
43
|
+
#node mailSender.js <from> <pass> <to> <subject> <text>
|
|
44
|
+
BASEDIR=$(dirname "$0")
|
|
45
|
+
node $BASEDIR"/../utils/mailSender" $4 $5 $6 "$subject" "$msg" $7 $8 "$reportUrl"
|
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
|
|
5
|
-
<style>
|
|
6
|
-
#file {
|
|
7
|
-
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
|
8
|
-
border-collapse: collapse;
|
|
9
|
-
width: 100%;
|
|
10
|
-
}
|
|
11
|
-
#redTd {
|
|
12
|
-
color: red;
|
|
13
|
-
}
|
|
14
|
-
#greenTD {
|
|
15
|
-
color: green;
|
|
16
|
-
}
|
|
17
|
-
#file td,
|
|
18
|
-
#file th {
|
|
19
|
-
border: 1px solid #ddd;
|
|
20
|
-
padding: 8px;
|
|
21
|
-
text-align: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#file tr:nth-child(even) {
|
|
25
|
-
background-color: #f2f2f2;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#file tr:hover {
|
|
29
|
-
background-color: #ddd;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#file th {
|
|
33
|
-
padding-top: 12px;
|
|
34
|
-
padding-bottom: 12px;
|
|
35
|
-
background-color: #2a2d36;
|
|
36
|
-
color: white;
|
|
37
|
-
}
|
|
38
|
-
#sizeTable {
|
|
39
|
-
float: left;
|
|
40
|
-
width: 50%;
|
|
41
|
-
}
|
|
42
|
-
#hashTable {
|
|
43
|
-
display: inline-block;
|
|
44
|
-
width: 50%;
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
47
|
-
<script type="text/javascript" src="./buildtrack.js"></script>
|
|
48
|
-
</head>
|
|
49
|
-
<body>
|
|
50
|
-
<div>
|
|
51
|
-
<div style="float: left;margin-right: 10px;">Branch Name:</div>
|
|
52
|
-
<h4 id="h4" style="margin: 0px;"></h4>
|
|
53
|
-
</div>
|
|
54
|
-
<div id="sizeTable">
|
|
55
|
-
<div>
|
|
56
|
-
<h3>Size changes</h3>
|
|
57
|
-
<h3></h3>
|
|
58
|
-
</div>
|
|
59
|
-
<table id="file" class="table table-bordered table-hover table-condensed">
|
|
60
|
-
<thead>
|
|
61
|
-
<tr>
|
|
62
|
-
<th title="Field #1">Name</th>
|
|
63
|
-
<th title="Field #2">Size / Diff</th>
|
|
64
|
-
<th title="Field #3">Size / Old</th>
|
|
65
|
-
<th title="Field #4">Size / New</th>
|
|
66
|
-
</tr>
|
|
67
|
-
</thead>
|
|
68
|
-
<tbody id="sizeTbody"></tbody>
|
|
69
|
-
</table>
|
|
70
|
-
</div>
|
|
71
|
-
<div id="hashTable">
|
|
72
|
-
<div>
|
|
73
|
-
<h3>Hash changes</h3>
|
|
74
|
-
<h3></h3>
|
|
75
|
-
</div>
|
|
76
|
-
<table id="file" class="table table-bordered table-hover table-condensed">
|
|
77
|
-
<thead>
|
|
78
|
-
<tr>
|
|
79
|
-
<th style="background-color: #4CAF50;" title="Field #1">Name</th>
|
|
80
|
-
<th style="background-color: #4CAF50;" title="Field #2">
|
|
81
|
-
Hash / Old
|
|
82
|
-
</th>
|
|
83
|
-
<th style="background-color: #4CAF50;" title="Field #3">
|
|
84
|
-
Hash / New
|
|
85
|
-
</th>
|
|
86
|
-
</tr>
|
|
87
|
-
</thead>
|
|
88
|
-
<tbody id="hashTbody"></tbody>
|
|
89
|
-
</table>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<script type="text/javascript">
|
|
93
|
-
function load() {
|
|
94
|
-
if (statsJson) {
|
|
95
|
-
var tdStringSize = '';
|
|
96
|
-
var tdStringHash = '';
|
|
97
|
-
if (statsJson.increased.length > 0) {
|
|
98
|
-
statsJson.increased.forEach(fileObj => {
|
|
99
|
-
let colorTD = '</td><td>';
|
|
100
|
-
if (fileObj.size.diff.split(' ').length > 2) {
|
|
101
|
-
colorTD = '</td><td id="greenTd">';
|
|
102
|
-
} else {
|
|
103
|
-
colorTD = '</td><td id="redTd">';
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
tdStringSize =
|
|
107
|
-
tdStringSize +
|
|
108
|
-
'<tr><td>' +
|
|
109
|
-
fileObj.name +
|
|
110
|
-
colorTD +
|
|
111
|
-
fileObj.size.diff +
|
|
112
|
-
'</td><td>' +
|
|
113
|
-
fileObj.size.old +
|
|
114
|
-
'</td><td>' +
|
|
115
|
-
fileObj.size.new +
|
|
116
|
-
'</td><tr>';
|
|
117
|
-
});
|
|
118
|
-
} else {
|
|
119
|
-
tdStringSize = '<tr><td></td><td></td><td></td></tr>';
|
|
120
|
-
}
|
|
121
|
-
document.getElementById('sizeTbody').innerHTML = tdStringSize;
|
|
122
|
-
if (statsJson.hashChanged.length > 0) {
|
|
123
|
-
statsJson.hashChanged.forEach(fileObj => {
|
|
124
|
-
tdStringHash =
|
|
125
|
-
tdStringHash +
|
|
126
|
-
'<tr><td>' +
|
|
127
|
-
fileObj.name +
|
|
128
|
-
'</td><td>' +
|
|
129
|
-
fileObj.hash.old +
|
|
130
|
-
'</td><td>' +
|
|
131
|
-
fileObj.hash.new +
|
|
132
|
-
'</td><tr>';
|
|
133
|
-
});
|
|
134
|
-
} else {
|
|
135
|
-
tdStringHash = '<tr><td></td><td></td><td></td></tr>';
|
|
136
|
-
}
|
|
137
|
-
document.getElementById('hashTbody').innerHTML = tdStringHash;
|
|
138
|
-
if (statsJson.branchName) {
|
|
139
|
-
document.getElementById('h4').innerHTML = statsJson.branchName;
|
|
140
|
-
} else {
|
|
141
|
-
document.getElementById('h4').innerHTML = 'Not specified';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
load();
|
|
146
|
-
</script>
|
|
147
|
-
</body>
|
|
148
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
|
|
5
|
+
<style>
|
|
6
|
+
#file {
|
|
7
|
+
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
|
8
|
+
border-collapse: collapse;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
#redTd {
|
|
12
|
+
color: red;
|
|
13
|
+
}
|
|
14
|
+
#greenTD {
|
|
15
|
+
color: green;
|
|
16
|
+
}
|
|
17
|
+
#file td,
|
|
18
|
+
#file th {
|
|
19
|
+
border: 1px solid #ddd;
|
|
20
|
+
padding: 8px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#file tr:nth-child(even) {
|
|
25
|
+
background-color: #f2f2f2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#file tr:hover {
|
|
29
|
+
background-color: #ddd;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#file th {
|
|
33
|
+
padding-top: 12px;
|
|
34
|
+
padding-bottom: 12px;
|
|
35
|
+
background-color: #2a2d36;
|
|
36
|
+
color: white;
|
|
37
|
+
}
|
|
38
|
+
#sizeTable {
|
|
39
|
+
float: left;
|
|
40
|
+
width: 50%;
|
|
41
|
+
}
|
|
42
|
+
#hashTable {
|
|
43
|
+
display: inline-block;
|
|
44
|
+
width: 50%;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
<script type="text/javascript" src="./buildtrack.js"></script>
|
|
48
|
+
</head>
|
|
49
|
+
<body>
|
|
50
|
+
<div>
|
|
51
|
+
<div style="float: left;margin-right: 10px;">Branch Name:</div>
|
|
52
|
+
<h4 id="h4" style="margin: 0px;"></h4>
|
|
53
|
+
</div>
|
|
54
|
+
<div id="sizeTable">
|
|
55
|
+
<div>
|
|
56
|
+
<h3>Size changes</h3>
|
|
57
|
+
<h3></h3>
|
|
58
|
+
</div>
|
|
59
|
+
<table id="file" class="table table-bordered table-hover table-condensed">
|
|
60
|
+
<thead>
|
|
61
|
+
<tr>
|
|
62
|
+
<th title="Field #1">Name</th>
|
|
63
|
+
<th title="Field #2">Size / Diff</th>
|
|
64
|
+
<th title="Field #3">Size / Old</th>
|
|
65
|
+
<th title="Field #4">Size / New</th>
|
|
66
|
+
</tr>
|
|
67
|
+
</thead>
|
|
68
|
+
<tbody id="sizeTbody"></tbody>
|
|
69
|
+
</table>
|
|
70
|
+
</div>
|
|
71
|
+
<div id="hashTable">
|
|
72
|
+
<div>
|
|
73
|
+
<h3>Hash changes</h3>
|
|
74
|
+
<h3></h3>
|
|
75
|
+
</div>
|
|
76
|
+
<table id="file" class="table table-bordered table-hover table-condensed">
|
|
77
|
+
<thead>
|
|
78
|
+
<tr>
|
|
79
|
+
<th style="background-color: #4CAF50;" title="Field #1">Name</th>
|
|
80
|
+
<th style="background-color: #4CAF50;" title="Field #2">
|
|
81
|
+
Hash / Old
|
|
82
|
+
</th>
|
|
83
|
+
<th style="background-color: #4CAF50;" title="Field #3">
|
|
84
|
+
Hash / New
|
|
85
|
+
</th>
|
|
86
|
+
</tr>
|
|
87
|
+
</thead>
|
|
88
|
+
<tbody id="hashTbody"></tbody>
|
|
89
|
+
</table>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<script type="text/javascript">
|
|
93
|
+
function load() {
|
|
94
|
+
if (statsJson) {
|
|
95
|
+
var tdStringSize = '';
|
|
96
|
+
var tdStringHash = '';
|
|
97
|
+
if (statsJson.increased.length > 0) {
|
|
98
|
+
statsJson.increased.forEach(fileObj => {
|
|
99
|
+
let colorTD = '</td><td>';
|
|
100
|
+
if (fileObj.size.diff.split(' ').length > 2) {
|
|
101
|
+
colorTD = '</td><td id="greenTd">';
|
|
102
|
+
} else {
|
|
103
|
+
colorTD = '</td><td id="redTd">';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
tdStringSize =
|
|
107
|
+
tdStringSize +
|
|
108
|
+
'<tr><td>' +
|
|
109
|
+
fileObj.name +
|
|
110
|
+
colorTD +
|
|
111
|
+
fileObj.size.diff +
|
|
112
|
+
'</td><td>' +
|
|
113
|
+
fileObj.size.old +
|
|
114
|
+
'</td><td>' +
|
|
115
|
+
fileObj.size.new +
|
|
116
|
+
'</td><tr>';
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
tdStringSize = '<tr><td></td><td></td><td></td></tr>';
|
|
120
|
+
}
|
|
121
|
+
document.getElementById('sizeTbody').innerHTML = tdStringSize;
|
|
122
|
+
if (statsJson.hashChanged.length > 0) {
|
|
123
|
+
statsJson.hashChanged.forEach(fileObj => {
|
|
124
|
+
tdStringHash =
|
|
125
|
+
tdStringHash +
|
|
126
|
+
'<tr><td>' +
|
|
127
|
+
fileObj.name +
|
|
128
|
+
'</td><td>' +
|
|
129
|
+
fileObj.hash.old +
|
|
130
|
+
'</td><td>' +
|
|
131
|
+
fileObj.hash.new +
|
|
132
|
+
'</td><tr>';
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
tdStringHash = '<tr><td></td><td></td><td></td></tr>';
|
|
136
|
+
}
|
|
137
|
+
document.getElementById('hashTbody').innerHTML = tdStringHash;
|
|
138
|
+
if (statsJson.branchName) {
|
|
139
|
+
document.getElementById('h4').innerHTML = statsJson.branchName;
|
|
140
|
+
} else {
|
|
141
|
+
document.getElementById('h4').innerHTML = 'Not specified';
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
load();
|
|
146
|
+
</script>
|
|
147
|
+
</body>
|
|
148
|
+
</html>
|
package/lib/utils/getOptions.js
CHANGED
|
@@ -26,14 +26,14 @@ const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse log
|
|
|
26
26
|
// // clone:type
|
|
27
27
|
|
|
28
28
|
const processEnv = {};
|
|
29
|
-
|
|
29
|
+
const keysWithColon = [];
|
|
30
30
|
Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEach(key => {
|
|
31
|
-
|
|
31
|
+
const nkey = key.slice(NPM_CONFIG_PREFIX.length);
|
|
32
32
|
processEnv[nkey] = process.env[key];
|
|
33
33
|
nkey.includes(':') && keysWithColon.push(nkey);
|
|
34
34
|
});
|
|
35
35
|
keysWithColon.forEach(key => {
|
|
36
|
-
|
|
36
|
+
const nkey = key.replace(/:/g, '_');
|
|
37
37
|
|
|
38
38
|
if (processEnv[nkey]) {
|
|
39
39
|
throw Error('there is some options conflict', key, nkey);
|
|
@@ -60,8 +60,8 @@ function getCWD() {
|
|
|
60
60
|
let cwd = process.cwd();
|
|
61
61
|
|
|
62
62
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const ress = (0, _child_process.execSync)('npm bin').toString();
|
|
64
|
+
const i = ress.lastIndexOf('node_modules');
|
|
65
65
|
cwd = i === -1 ? cwd : ress.slice(0, i);
|
|
66
66
|
} catch (error) {
|
|
67
67
|
console.log(error);
|
|
@@ -73,7 +73,7 @@ function getCWD() {
|
|
|
73
73
|
|
|
74
74
|
args.forEach(option => {
|
|
75
75
|
if (/^--./.test(option)) {
|
|
76
|
-
|
|
76
|
+
const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
|
77
77
|
|
|
78
78
|
let key = option.slice(2, equIndex);
|
|
79
79
|
let value = option.slice(equIndex + 1);
|
|
@@ -88,10 +88,10 @@ args.forEach(option => {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const defaulter = (target, source) => {
|
|
92
|
+
const defaultObject = {};
|
|
93
93
|
Object.keys(target).forEach(key => {
|
|
94
|
-
|
|
94
|
+
const data = target[key];
|
|
95
95
|
|
|
96
96
|
if (data && typeof data === 'object') {
|
|
97
97
|
if (Array.isArray(data)) {
|
|
@@ -122,26 +122,54 @@ let defaulter = (target, source) => {
|
|
|
122
122
|
return defaultObject;
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
global.reactCLIOptions = null;
|
|
125
|
+
global.reactCLIOptions = null; // function selectn(obj, key) {
|
|
126
|
+
// let temp = obj;
|
|
127
|
+
// let keys = key.split('.');
|
|
128
|
+
// for (let i = 0; i < keys.length; i++) {
|
|
129
|
+
// const element = keys[i];
|
|
130
|
+
// temp = temp && temp[element];
|
|
131
|
+
// }
|
|
132
|
+
// return temp;
|
|
133
|
+
// }
|
|
134
|
+
|
|
135
|
+
function deprecationSupport(options) {
|
|
136
|
+
// if (selectn(options, ".app.hasRTL") === true) {
|
|
137
|
+
if (options.app.hasRTL === true) {
|
|
138
|
+
options.app.plugins.hasRTL = true;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (options.docs.hasRTL === true) {
|
|
142
|
+
options.docs.plugins.hasRTL = true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (options.app.rtlExclude.length > 0) {
|
|
146
|
+
options.app.exclude.rtl = options.app.rtlExclude;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (options.docs.rtlExclude.length > 0) {
|
|
150
|
+
options.docs.exclude.rtl = options.docs.rtlExclude;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
126
153
|
|
|
127
|
-
|
|
154
|
+
const getOptions = () => {
|
|
128
155
|
if (global.reactCLIOptions) {
|
|
129
156
|
return global.reactCLIOptions;
|
|
130
157
|
}
|
|
131
158
|
|
|
132
|
-
|
|
159
|
+
const appPath = process.cwd();
|
|
133
160
|
let userSchemas;
|
|
134
161
|
|
|
135
|
-
|
|
162
|
+
const packagePath = _path.default.join(appPath, 'package.json');
|
|
136
163
|
|
|
137
164
|
if (_fs.default.existsSync(packagePath)) {
|
|
138
165
|
userSchemas = require(packagePath)['react-cli'] || {};
|
|
139
166
|
}
|
|
140
167
|
|
|
141
|
-
|
|
168
|
+
const options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
|
142
169
|
|
|
143
170
|
options.npmVersion = getNpmVersion();
|
|
144
171
|
options.cwd = getCWD();
|
|
172
|
+
deprecationSupport(options);
|
|
145
173
|
options.packageVersion = process.env.npm_package_version;
|
|
146
174
|
global.reactCLIOptions = options;
|
|
147
175
|
return options;
|