@zohodesk/react-cli 1.0.2-exp.4 → 1.0.3-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/Changelog.md +1019 -1019
- package/README.md +1189 -1165
- package/bin/cli.js +483 -483
- package/docs/CustomChunks.md +26 -26
- package/docs/DevServerPort.md +39 -39
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/SelectorWeight.md +8 -8
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +729 -729
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/testPattern.js +0 -2
- package/lib/common/valueReplacer.js +1 -3
- package/lib/configs/resolvers.js +14 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +0 -6
- package/lib/configs/webpack.docs.config.js +0 -4
- package/lib/configs/webpack.impact.config.js +0 -4
- package/lib/configs/webpack.prod.config.js +0 -6
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- package/lib/loaderUtils/getCSSLoaders.js +47 -81
- package/lib/loaderUtils/windowsModification.js +1 -6
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/logger.js +20 -0
- package/lib/pluginUtils/getDevPlugins.js +13 -18
- package/lib/pluginUtils/getProdPlugins.js +12 -16
- package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
- package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
- package/lib/plugins/CustomAttributePlugin.js +82 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +9 -9
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +10 -12
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -13
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +10 -15
- 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/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/SelectorPlugin.js +36 -53
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/{MinifyPlugin.js → UglifyCSSPlugin.js} +3 -3
- package/lib/plugins/VariableConversionCollector.js +84 -98
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +7 -7
- package/lib/postcss-plugins/ExcludePlugin.js +1 -1
- package/lib/postcss-plugins/IncludePlugin.js +0 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +14 -20
- package/lib/postcss-plugins/ValueReplacer.js +14 -5
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +3 -9
- package/lib/postcss-plugins/variableModificationPlugin/index.js +20 -3
- package/lib/postcss-plugins/variableModifier.js +24 -58
- package/lib/schemas/index.js +11 -35
- package/lib/servers/devBuild.js +13 -11
- package/lib/servers/httpsOptions.js +12 -13
- package/lib/servers/nowatchserver.js +5 -3
- package/lib/servers/requireLocalOrGlobal.js +61 -0
- package/lib/servers/server.js +3 -5
- 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/cssClassNameGenerate.js +14 -43
- package/lib/utils/resultSchema.json +73 -73
- package/npm-shrinkwrap.json +14407 -0
- package/npm8.md +9 -9
- package/package.json +121 -122
- package/postpublish.js +8 -8
- 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 -1501
- 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/lib/loaderUtils/tests/windowsModification.test.js +0 -10
- package/lib/loaders/composeLoader.js +0 -175
- package/lib/plugins/utils/classHandling.js +0 -20
- package/lib/plugins/utils/fileHandling.js +0 -107
- package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
- package/lib/postcss-plugins/EmptyPlugin.js +0 -8
package/lib/schemas/index.js
CHANGED
@@ -92,7 +92,7 @@ var _default = {
|
|
92
92
|
},
|
93
93
|
app: {
|
94
94
|
moduleResolvePath: {
|
95
|
-
value: '',
|
95
|
+
value: '@zohodesk/client_packages_group',
|
96
96
|
cli: 'module_resolve_path'
|
97
97
|
},
|
98
98
|
// this option only for impact testing
|
@@ -124,6 +124,13 @@ var _default = {
|
|
124
124
|
filenames: [],
|
125
125
|
packages: []
|
126
126
|
},
|
127
|
+
customAttributes: {
|
128
|
+
enable: false,
|
129
|
+
attributes: null,
|
130
|
+
jsAttributes: null,
|
131
|
+
cssAttributes: null,
|
132
|
+
i18nAttributes: null
|
133
|
+
},
|
127
134
|
server: {
|
128
135
|
host: {
|
129
136
|
value: (0, _os.hostname)(),
|
@@ -222,28 +229,12 @@ var _default = {
|
|
222
229
|
cli: 'enable_smaphook'
|
223
230
|
},
|
224
231
|
plugins: {
|
225
|
-
valueReplacer: false,
|
226
|
-
selectorReplace: false,
|
227
232
|
hasRTL: false,
|
228
233
|
hoverActive: false,
|
229
234
|
combinerMediaQuery: false,
|
230
235
|
cssVariableReplacement: false,
|
231
|
-
selectorWeight: false
|
232
|
-
minifier: false,
|
233
|
-
composeMinification: false
|
234
|
-
},
|
235
|
-
patterns: {
|
236
|
-
valueReplacer: [],
|
237
|
-
selectorReplace: [],
|
238
|
-
hoverActive: [],
|
239
|
-
combinerMediaQuery: [],
|
240
|
-
hasRTL: [],
|
241
|
-
cssVariableReplacement: [],
|
242
|
-
selectorWeight: [],
|
243
|
-
cssUniqueness: [],
|
244
|
-
composeMinification: []
|
236
|
+
selectorWeight: false
|
245
237
|
},
|
246
|
-
patternsRootDir: '',
|
247
238
|
exclude: {
|
248
239
|
rtl: [],
|
249
240
|
hoverActive: [],
|
@@ -251,10 +242,6 @@ var _default = {
|
|
251
242
|
cssVariableReplacement: [],
|
252
243
|
selectorWeight: []
|
253
244
|
},
|
254
|
-
include: {
|
255
|
-
cssVariableReplacement: [],
|
256
|
-
selectorWeight: []
|
257
|
-
},
|
258
245
|
cssVariableReplacementConfig: '',
|
259
246
|
selectorWeightConfig: {
|
260
247
|
defaultSelector: '',
|
@@ -339,22 +326,11 @@ var _default = {
|
|
339
326
|
hasRTL: false,
|
340
327
|
rtlExclude: [],
|
341
328
|
plugins: {
|
342
|
-
|
329
|
+
hasRTL: false,
|
343
330
|
hoverActive: false,
|
344
331
|
combinerMediaQuery: false,
|
345
332
|
cssVariableReplacement: false,
|
346
|
-
selectorWeight: false
|
347
|
-
minifier: false
|
348
|
-
},
|
349
|
-
patternsRootDir: '',
|
350
|
-
patterns: {
|
351
|
-
valueReplacer: [],
|
352
|
-
selectorReplace: [],
|
353
|
-
hoverActive: [],
|
354
|
-
combinerMediaQuery: [],
|
355
|
-
hasRTL: [],
|
356
|
-
cssVariableReplacement: [],
|
357
|
-
selectorWeight: []
|
333
|
+
selectorWeight: false
|
358
334
|
},
|
359
335
|
exclude: {
|
360
336
|
rtl: [],
|
package/lib/servers/devBuild.js
CHANGED
@@ -15,6 +15,8 @@ var _utils = require("../utils");
|
|
15
15
|
|
16
16
|
var _getCliPath = require("./getCliPath");
|
17
17
|
|
18
|
+
var _logger = require("../logger");
|
19
|
+
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
21
|
|
20
22
|
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
@@ -35,28 +37,28 @@ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).nam
|
|
35
37
|
const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
|
36
38
|
|
37
39
|
function execSyncDefalut(command) {
|
38
|
-
|
40
|
+
(0, _logger.messageLogger)(' command running ==>', command);
|
39
41
|
return (0, _child_process.execSync)(command, {
|
40
42
|
stdio: 'inherit'
|
41
43
|
});
|
42
44
|
}
|
43
45
|
|
44
46
|
const isQuiet = 'q';
|
45
|
-
const webpack = (0, _getCliPath.getCliPath)('webpack'); //
|
47
|
+
const webpack = (0, _getCliPath.getCliPath)('webpack'); // messageLogger('webpack === > ', webpack, fs.existsSync(webpack));
|
46
48
|
|
47
49
|
if (_fs.default.existsSync(outputFolderLocation)) {
|
48
50
|
execSyncDefalut(`rm -rf ${outputFolder}`);
|
49
|
-
|
51
|
+
(0, _logger.messageLogger)(`previous ${outputFolder} removed`);
|
50
52
|
}
|
51
53
|
|
52
54
|
if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
|
53
55
|
execSyncDefalut('rm build.zip');
|
54
|
-
|
56
|
+
(0, _logger.messageLogger)('previous build.zip removed');
|
55
57
|
} // execSyncDefalut(`${webpack } --version`);
|
56
58
|
// execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
57
59
|
|
58
60
|
|
59
|
-
|
61
|
+
(0, _logger.messageLogger)('webpack compilation starts...');
|
60
62
|
const startTime = Date.now(); // const result = spawnSync(
|
61
63
|
// webpack,
|
62
64
|
// ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
|
@@ -67,31 +69,31 @@ const startTime = Date.now(); // const result = spawnSync(
|
|
67
69
|
// --disable_watch=true
|
68
70
|
|
69
71
|
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
70
|
-
result &&
|
72
|
+
result && (0, _logger.messageLogger)(result);
|
71
73
|
|
72
74
|
if (result && result.stderr) {
|
73
75
|
throw result.stderr;
|
74
76
|
}
|
75
77
|
|
76
|
-
|
78
|
+
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
77
79
|
|
78
80
|
if (zipname) {
|
79
81
|
execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
|
80
|
-
|
82
|
+
(0, _logger.messageLogger)('build.zip file created');
|
81
83
|
const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
|
82
84
|
execSyncDefalut(`rm -rf ${zipname}`);
|
83
85
|
|
84
86
|
if (result && result.stderr) {
|
85
|
-
|
87
|
+
(0, _logger.messageLogger)('zip file not created', cssSelectorZipPath);
|
86
88
|
console.error(result.stderr);
|
87
89
|
} else {
|
88
|
-
|
90
|
+
(0, _logger.messageLogger)('zip file created', cssSelectorZipPath);
|
89
91
|
}
|
90
92
|
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
91
93
|
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
92
94
|
|
93
95
|
|
94
|
-
|
96
|
+
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
95
97
|
|
96
98
|
function getPaths() {
|
97
99
|
return {
|
@@ -6,21 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.httpsOptions = httpsOptions;
|
7
7
|
exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
var _logger = require("../logger");
|
10
|
+
|
11
|
+
var _requireLocalOrGlobal = require("./requireLocalOrGlobal");
|
12
|
+
|
13
|
+
const globalCertificate = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk-private/client_dev_cert');
|
14
|
+
|
15
15
|
function httpsOptions(options) {
|
16
16
|
const {
|
17
17
|
httpsCerts
|
18
18
|
} = options.app.server;
|
19
|
-
|
20
|
-
const certificate = require(require.resolve(httpsCerts, {
|
21
|
-
paths: [process.cwd()]
|
22
|
-
})); // TODO: in future we may do some version based check. certificate.version
|
23
|
-
|
19
|
+
const certificate = (0, _requireLocalOrGlobal.requireLocalOrGlobal)(httpsCerts); // TODO: in future we may do some version based check. certificate.version
|
24
20
|
|
25
21
|
return certificate.httpsOptions;
|
26
22
|
}
|
@@ -36,13 +32,16 @@ function httpsOptionsWithUserFriendlyError(options) {
|
|
36
32
|
return certificate;
|
37
33
|
} catch (error) {
|
38
34
|
if (error.message.indexOf('Cannot find module') !== -1) {
|
39
|
-
|
35
|
+
(0, _logger.errorLogger)(`You have given react-cli.app.server.httpsCerts as "${httpsCerts}". \n But it seems that file path have some problem.\n we are unable to locate "${httpsCerts}" in "${process.cwd()}"`);
|
40
36
|
} else {
|
41
|
-
|
37
|
+
(0, _logger.errorLogger)(error);
|
42
38
|
}
|
43
39
|
|
44
40
|
process.exit(0);
|
45
41
|
}
|
42
|
+
} else if (globalCertificate) {
|
43
|
+
(0, _logger.messageLogger)('global `@zohodesk-private/client_dev_cert` package taken as https certificate');
|
44
|
+
return globalCertificate.httpsOptions;
|
46
45
|
} else {
|
47
46
|
return null;
|
48
47
|
}
|
@@ -16,6 +16,8 @@ var _httpsOptions = require("./httpsOptions");
|
|
16
16
|
|
17
17
|
var _devBuild = require("./devBuild");
|
18
18
|
|
19
|
+
var _logger = require("../logger");
|
20
|
+
|
19
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
22
|
|
21
23
|
// import webpack from 'webpack';
|
@@ -128,7 +130,7 @@ if (zipname) {
|
|
128
130
|
throw err;
|
129
131
|
}
|
130
132
|
|
131
|
-
|
133
|
+
(0, _logger.messageLogger)(`${zipname}.zip downloaded`);
|
132
134
|
});
|
133
135
|
});
|
134
136
|
app.use('/zips/build.zip', (req, res) => {
|
@@ -137,7 +139,7 @@ if (zipname) {
|
|
137
139
|
throw err;
|
138
140
|
}
|
139
141
|
|
140
|
-
|
142
|
+
(0, _logger.messageLogger)('build.zip downloaded');
|
141
143
|
});
|
142
144
|
});
|
143
145
|
}
|
@@ -188,7 +190,7 @@ if (httpsOptions) {
|
|
188
190
|
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
189
191
|
});
|
190
192
|
} else {
|
191
|
-
(0, _utils.log)(
|
193
|
+
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
192
194
|
}
|
193
195
|
}
|
194
196
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.globalNodeModules = void 0;
|
7
|
+
exports.requireGlobal = requireGlobal;
|
8
|
+
exports.requireLocal = requireLocal;
|
9
|
+
exports.requireLocalOrGlobal = requireLocalOrGlobal;
|
10
|
+
|
11
|
+
var _child_process = require("child_process");
|
12
|
+
|
13
|
+
var _path = _interopRequireDefault(require("path"));
|
14
|
+
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
+
|
17
|
+
const globalNodeModules = _path.default.join(`${(0, _child_process.execSync)('npm config get prefix')}`.trim(), 'lib');
|
18
|
+
|
19
|
+
exports.globalNodeModules = globalNodeModules;
|
20
|
+
|
21
|
+
function requireLocalOrGlobal(moduleName, opts = {}) {
|
22
|
+
let {
|
23
|
+
global = true
|
24
|
+
} = opts;
|
25
|
+
const {
|
26
|
+
local = true
|
27
|
+
} = opts;
|
28
|
+
const isRelativePath = moduleName === '.'; // NOTE: if starts with . then it only mean local
|
29
|
+
|
30
|
+
if (isRelativePath) {
|
31
|
+
global = false;
|
32
|
+
}
|
33
|
+
|
34
|
+
try {
|
35
|
+
const paths = [local && process.cwd(), global && globalNodeModules].filter(Boolean); // x({ paths, globalNodeModules, global, local, opts });
|
36
|
+
|
37
|
+
const moduleResolvePath = require.resolve(moduleName, {
|
38
|
+
paths
|
39
|
+
});
|
40
|
+
|
41
|
+
return require(moduleResolvePath);
|
42
|
+
} catch (error) {
|
43
|
+
// NOTE: since we return null we can check out side
|
44
|
+
// console.log('Re validate: ', error);
|
45
|
+
return null;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function requireLocal(moduleName) {
|
50
|
+
return requireLocalOrGlobal(moduleName, {
|
51
|
+
global: false,
|
52
|
+
local: true
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
function requireGlobal(moduleName) {
|
57
|
+
return requireLocalOrGlobal(moduleName, {
|
58
|
+
global: true,
|
59
|
+
local: false
|
60
|
+
});
|
61
|
+
}
|
package/lib/servers/server.js
CHANGED
@@ -70,8 +70,7 @@ if (mode === 'prod') {
|
|
70
70
|
config = require('../configs/webpack.dev.config');
|
71
71
|
} else {
|
72
72
|
throw new Error('You must configure valid option in mode');
|
73
|
-
}
|
74
|
-
|
73
|
+
}
|
75
74
|
|
76
75
|
const compiler = (0, _webpack.default)(config);
|
77
76
|
const webpackServerOptions = {
|
@@ -101,7 +100,6 @@ app.use((0, _HMRMiddleware.default)(compiler, {
|
|
101
100
|
path: '/sockjs-node/info'
|
102
101
|
}));
|
103
102
|
app.use((req, res, next) => {
|
104
|
-
//console.log('origin', req.get('origin'));
|
105
103
|
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
|
106
104
|
|
107
105
|
res.setHeader('Access-Control-Allow-Private-Network', true);
|
@@ -204,8 +202,8 @@ if (httpsOptions) {
|
|
204
202
|
port: http2Port
|
205
203
|
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
206
204
|
});
|
207
|
-
} else
|
208
|
-
(0, _utils.log)(
|
205
|
+
} else {
|
206
|
+
(0, _utils.log)("Your node version didn't adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2");
|
209
207
|
}
|
210
208
|
}
|
211
209
|
|
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"
|