@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.2
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/README.md +1025 -1028
- package/bin/cli.js +482 -482
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- 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/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +719 -678
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/babel/cmjs-plugins-presets.js +4 -0
- package/lib/babel/es-plugins-presets.js +4 -0
- package/lib/common/getEntries.js +10 -0
- package/lib/common/getPublicPathConfig.js +6 -0
- package/lib/common/index.js +5 -0
- package/lib/common/splitChunks.js +13 -2
- package/lib/common/sslcertUpdater.js +17 -6
- package/lib/common/templateParameters.js +2 -0
- package/lib/common/testPattern.js +21 -10
- package/lib/common/valueReplacer.js +15 -0
- package/lib/configs/jest.config.js +9 -0
- package/lib/configs/libAlias.js +2 -4
- package/lib/configs/webpack.component.umd.config.js +5 -0
- package/lib/configs/webpack.css.umd.config.js +13 -5
- package/lib/configs/webpack.dev.config.js +36 -2
- package/lib/configs/webpack.docs.config.js +21 -1
- package/lib/configs/webpack.impact.config.js +19 -1
- package/lib/configs/webpack.prod.config.js +37 -3
- package/lib/hooks/docsProptypeHook.js +7 -3
- package/lib/jest/commitedFilesResult.js +45 -3
- package/lib/jest/coverageCollector.js +11 -0
- package/lib/jest/jsonMaker.js +6 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
- package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
- package/lib/jest/result.js +22 -0
- package/lib/jest/run.js +17 -6
- package/lib/jest/setup.js +57 -5
- package/lib/loaderUtils/configsAssetsLoaders.js +44 -34
- package/lib/loaderUtils/getCSSLoaders.js +35 -20
- package/lib/loaderUtils/getDevJsLoaders.js +8 -0
- package/lib/loaderUtils/index.js +3 -0
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/docsLoader.js +7 -0
- package/lib/loaders/docsPropsLoader.js +7 -3
- package/lib/loaders/fileBountryLoader.js +2 -0
- package/lib/loaders/fileLoader.js +22 -11
- package/lib/loaders/scriptInstrumentLoader.js +13 -5
- package/lib/loaders/selectorMappingLoader.js +25 -7
- package/lib/loaders/workerLoader.js +29 -13
- package/lib/middlewares/HMRMiddleware.js +26 -13
- package/lib/middlewares/SSTMiddleware.js +3 -0
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
- package/lib/pluginUtils/getDevPlugins.js +68 -22
- package/lib/pluginUtils/getDocsPlugins.js +10 -1
- package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
- package/lib/pluginUtils/getLibraryPlugins.js +5 -0
- package/lib/pluginUtils/getProdPlugins.js +77 -28
- package/lib/pluginUtils/getServerPlugins.js +5 -0
- package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
- package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
- package/lib/pluginUtils/index.js +8 -0
- package/lib/plugins/CdnChangePlugin.js +14 -0
- package/lib/plugins/CleanupStatsPlugin.js +5 -0
- package/lib/plugins/EFCPlugin.js +34 -23
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +32 -23
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +38 -12
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +77 -46
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +59 -44
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +30 -21
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +80 -70
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
- package/lib/plugins/ManifestPlugin.js +17 -0
- package/lib/plugins/ModuleStatsPlugin.js +23 -0
- package/lib/plugins/OptimizeJSPlugin.js +7 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
- package/lib/plugins/PublicPathChangePlugin.js +36 -4
- package/lib/plugins/ReportGeneratePlugin.js +30 -4
- package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
- package/lib/plugins/ResourceHintsPlugin.js +27 -20
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +22 -15
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
- package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +29 -13
- package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
- package/lib/plugins/SourceMapHookPlugin.js +9 -0
- package/lib/plugins/TPHashMappingPlugin.js +19 -5
- package/lib/plugins/UglifyCSSPlugin.js +9 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
- package/lib/plugins/VariableConversionCollector.js +322 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +19 -0
- package/lib/plugins/libraryImpactPlugin.js +32 -0
- package/lib/plugins/webpackwatchrunplugin.js +5 -0
- package/lib/postcss-plugins/ExcludePlugin.js +4 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +37 -24
- package/lib/postcss-plugins/ValueReplacer.js +6 -9
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +69 -33
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +42 -13
- package/lib/postcss-plugins/variableModificationPlugin/index.js +216 -141
- package/lib/postcss-plugins/variableModifier.js +20 -13
- package/lib/schemas/index.js +23 -4
- package/lib/servers/clusterHubServer.js +10 -0
- package/lib/servers/devBuild.js +24 -13
- package/lib/servers/docsServer.js +2 -0
- package/lib/servers/docsServerCore.js +21 -0
- package/lib/servers/getCliPath.js +9 -0
- package/lib/servers/helpServer.js +5 -0
- package/lib/servers/httpsOptions.js +4 -0
- package/lib/servers/impactServer.js +34 -2
- package/lib/servers/mockserver.js +9 -0
- package/lib/servers/nowatchserver.js +34 -12
- package/lib/servers/scrServer.js +20 -13
- package/lib/servers/server.js +35 -7
- package/lib/servers/ssServer.js +16 -0
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +14 -0
- package/lib/templates/WMSTemplate.js +12 -6
- package/lib/utils/babelPresets.js +2 -0
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +8 -2
- package/lib/utils/copy.js +6 -0
- package/lib/utils/copyTimezones.js +8 -0
- package/lib/utils/createEventStream.js +4 -0
- package/lib/utils/cssClassNameGenerate.js +19 -3
- package/lib/utils/cssURLReplacer.js +25 -0
- package/lib/utils/dependencyPostPublish.js +9 -0
- package/lib/utils/fileUtils.js +26 -0
- package/lib/utils/folderIterator.js +10 -0
- package/lib/utils/getComponents.js +21 -0
- package/lib/utils/getCurrentBranch.js +5 -0
- package/lib/utils/getDependenciesImpactList.js +21 -0
- package/lib/utils/getHash.js +7 -0
- package/lib/utils/getIp.js +2 -0
- package/lib/utils/getOptions.js +39 -14
- package/lib/utils/getServerURL.js +7 -0
- package/lib/utils/index.js +47 -2
- package/lib/utils/init.js +1 -0
- package/lib/utils/initPreCommitHook.js +29 -6
- package/lib/utils/jsonHelper.js +19 -2
- package/lib/utils/libraryImpactConfig.js +2 -0
- package/lib/utils/lint/addScripts.js +5 -2
- package/lib/utils/lint/checkExistingConfig.js +12 -3
- package/lib/utils/lint/copyConfigs.js +3 -0
- package/lib/utils/lint/index.js +9 -0
- package/lib/utils/lint/lintScripts.js +1 -0
- package/lib/utils/lint/lintSetup.js +4 -3
- package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
- package/lib/utils/lint/question.js +7 -0
- package/lib/utils/lintReporter.js +20 -0
- package/lib/utils/mailSender.js +7 -0
- package/lib/utils/pullOrigin.js +4 -0
- package/lib/utils/reinstallDependencies.js +28 -0
- package/lib/utils/removeAttributes.js +7 -0
- package/lib/utils/repoClone.js +27 -2
- package/lib/utils/request.js +12 -0
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +16 -4
- package/lib/utils/setEnvVariables.js +2 -0
- package/lib/utils/ssTestHack.js +10 -0
- package/lib/utils/switchBranch.js +4 -0
- package/lib/utils/urlConcat.js +4 -0
- package/lib/utils/useExitCleanup.js +10 -9
- package/npm8.md +9 -9
- package/package.json +146 -146
- package/postpublish.js +6 -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 -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/servers/scrServer.js
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _screenshotTest = _interopRequireDefault(require("@zohodesk/screenshot-test"));
|
4
|
+
|
4
5
|
var _jsonHelper = require("../utils/jsonHelper");
|
6
|
+
|
5
7
|
var _child_process = require("child_process");
|
8
|
+
|
6
9
|
var _utils = require("../utils");
|
10
|
+
|
7
11
|
var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
|
12
|
+
|
8
13
|
var _SSTMiddleware = _interopRequireDefault(require("../middlewares/SSTMiddleware"));
|
14
|
+
|
9
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
//Getting variables from flag and exe
|
11
16
|
|
17
|
+
//Getting variables from flag and exe
|
12
18
|
let cwd = process.cwd();
|
13
19
|
let options = (0, _utils.getOptions)();
|
14
20
|
let {
|
@@ -30,8 +36,8 @@ let {
|
|
30
36
|
}
|
31
37
|
} = options;
|
32
38
|
let resultFileName = `${cwd}/result.json`;
|
33
|
-
let docsServerInstance;
|
34
|
-
|
39
|
+
let docsServerInstance; // let impactedComponentList = null;
|
40
|
+
|
35
41
|
let url = (0, _utils.getServerURL)(Object.assign(server, {
|
36
42
|
host: server.iphost
|
37
43
|
}), 'ht' + 'tp');
|
@@ -39,16 +45,12 @@ let commitID = (0, _child_process.execSync)('git log --first-parent --pretty="fo
|
|
39
45
|
cwd: cwd
|
40
46
|
}).toString() || '';
|
41
47
|
let [latestCommitHash, lastCommitHash] = commitID.split('\n');
|
42
|
-
let script = 'var Objlist = {};for (i in componentList) {try { if (componentList[i].prototype.isReactComponent) Objlist[i] = componentList[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;';
|
43
|
-
|
44
|
-
// Variable getting part end //
|
48
|
+
let script = 'var Objlist = {};for (i in componentList) {try { if (componentList[i].prototype.isReactComponent) Objlist[i] = componentList[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;'; // Variable getting part end //
|
45
49
|
|
46
50
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.compareBranch', referBranch);
|
47
51
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.TestBranch', currentBranch);
|
48
52
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.isExecuted', true);
|
49
|
-
(0, _utils.log)('Test Branch Name :- ', currentBranch);
|
50
|
-
|
51
|
-
// function declaration part //
|
53
|
+
(0, _utils.log)('Test Branch Name :- ', currentBranch); // function declaration part //
|
52
54
|
|
53
55
|
let closeServer = serverInstance => {
|
54
56
|
(0, _utils.log)('Docs service stopped!');
|
@@ -60,9 +62,9 @@ let closeServer = serverInstance => {
|
|
60
62
|
http.close();
|
61
63
|
https.close();
|
62
64
|
wdm.close();
|
63
|
-
};
|
65
|
+
}; //eslint-disable-next-line
|
66
|
+
|
64
67
|
|
65
|
-
//eslint-disable-next-line
|
66
68
|
let afterFirstScreenShotCollected = () => {
|
67
69
|
closeServer(docsServerInstance);
|
68
70
|
(0, _utils.switchBranch)('git', referBranch).then(() => {
|
@@ -72,6 +74,7 @@ let afterFirstScreenShotCollected = () => {
|
|
72
74
|
});
|
73
75
|
});
|
74
76
|
};
|
77
|
+
|
75
78
|
let onSStestEnd = (status, resultObject, message) => {
|
76
79
|
if (status) {
|
77
80
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.endTime', Date.now());
|
@@ -79,8 +82,8 @@ let onSStestEnd = (status, resultObject, message) => {
|
|
79
82
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.result', resultObject);
|
80
83
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.message', message);
|
81
84
|
(0, _jsonHelper.setTestInfoStatus)(resultFileName, true);
|
82
|
-
(0, _utils.log)(message);
|
83
|
-
|
85
|
+
(0, _utils.log)(message); //'Screenshot test completed successfully.'
|
86
|
+
|
84
87
|
closeServer(docsServerInstance);
|
85
88
|
} else {
|
86
89
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.isPassed', false);
|
@@ -95,6 +98,7 @@ let onSStestEnd = (status, resultObject, message) => {
|
|
95
98
|
throw new Error('Component list undefined! Please check component Docs');
|
96
99
|
}
|
97
100
|
};
|
101
|
+
|
98
102
|
let run = (listOfComponents = [], configObject) => {
|
99
103
|
docsServerInstance = (0, _docsServerCore.default)(true);
|
100
104
|
docsServerInstance.app.use((0, _SSTMiddleware.default)(docsServerInstance.compiler, mData => {
|
@@ -103,11 +107,13 @@ let run = (listOfComponents = [], configObject) => {
|
|
103
107
|
configObject.impactedComponentList = finalResultObject.impactedComponentList;
|
104
108
|
configObject.unDocsComList = finalResultObject.unDocsComList;
|
105
109
|
}
|
110
|
+
|
106
111
|
_screenshotTest.default.run(configObject, (status, finalObj, message) => {
|
107
112
|
onSStestEnd(status, finalObj, message);
|
108
113
|
});
|
109
114
|
}));
|
110
115
|
};
|
116
|
+
|
111
117
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.startTime', Date.now());
|
112
118
|
(0, _utils.ssTestHack)();
|
113
119
|
let scrObject = {
|
@@ -125,6 +131,7 @@ let scrObject = {
|
|
125
131
|
script,
|
126
132
|
tableName
|
127
133
|
};
|
134
|
+
|
128
135
|
if (isImpactRun) {
|
129
136
|
if (!isStore) {
|
130
137
|
(0, _utils.getDependenciesImpactList)(currentBranch, referBranch, tokenGit, serviceName).then(impactedList => {
|
package/lib/servers/server.js
CHANGED
@@ -1,19 +1,30 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
4
5
|
var _https = _interopRequireDefault(require("https"));
|
6
|
+
|
5
7
|
var _webpack = _interopRequireDefault(require("webpack"));
|
8
|
+
|
6
9
|
var _express = _interopRequireDefault(require("express"));
|
10
|
+
|
7
11
|
var _ws = _interopRequireDefault(require("ws"));
|
12
|
+
|
8
13
|
var _compression = _interopRequireDefault(require("compression"));
|
14
|
+
|
9
15
|
var _webpackDevMiddleware = _interopRequireDefault(require("webpack-dev-middleware"));
|
16
|
+
|
10
17
|
var _httpProxyMiddleware = require("http-proxy-middleware");
|
18
|
+
|
11
19
|
var _HMRMiddleware = _interopRequireDefault(require("../middlewares/HMRMiddleware"));
|
20
|
+
|
12
21
|
var _utils = require("../utils");
|
22
|
+
|
13
23
|
var _httpsOptions = require("./httpsOptions");
|
24
|
+
|
14
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
// import fs from 'fs';
|
16
26
|
|
27
|
+
// import fs from 'fs';
|
17
28
|
let options = (0, _utils.getOptions)();
|
18
29
|
let {
|
19
30
|
app: {
|
@@ -37,17 +48,20 @@ const {
|
|
37
48
|
writeToDisk
|
38
49
|
} = options.impactService;
|
39
50
|
const app = (0, _express.default)();
|
51
|
+
|
40
52
|
if (hasMock) {
|
41
53
|
app.use(server.mockPrefix, (0, _httpProxyMiddleware.createProxyMiddleware)({
|
42
54
|
target: 'ht' + `tp://localhost:${mockPort}`,
|
43
55
|
changeOrigin: true
|
44
56
|
}));
|
45
57
|
}
|
58
|
+
|
46
59
|
app.use(_express.default.json());
|
47
60
|
app.use(_express.default.urlencoded({
|
48
61
|
extended: true
|
49
62
|
}));
|
50
63
|
let config;
|
64
|
+
|
51
65
|
if (mode === 'prod') {
|
52
66
|
config = require('../configs/webpack.prod.config');
|
53
67
|
app.use((0, _compression.default)());
|
@@ -55,8 +69,8 @@ if (mode === 'prod') {
|
|
55
69
|
config = require('../configs/webpack.dev.config');
|
56
70
|
} else {
|
57
71
|
throw new Error('You must configure valid option in mode');
|
58
|
-
}
|
59
|
-
|
72
|
+
} // console.log({ contextURL });
|
73
|
+
|
60
74
|
|
61
75
|
let compiler = (0, _webpack.default)(config);
|
62
76
|
let webpackServerOptions = {
|
@@ -70,22 +84,25 @@ let webpackServerOptions = {
|
|
70
84
|
},
|
71
85
|
compress: mode === 'prod'
|
72
86
|
};
|
87
|
+
|
73
88
|
if (options.app.disableWatch) {
|
74
89
|
webpackServerOptions.watchOptions = {
|
75
90
|
ignored: /./
|
76
91
|
};
|
77
92
|
}
|
93
|
+
|
78
94
|
if (writeToDisk) {
|
79
95
|
webpackServerOptions.writeToDisk = true;
|
80
96
|
}
|
97
|
+
|
81
98
|
app.use((0, _webpackDevMiddleware.default)(compiler, webpackServerOptions));
|
82
99
|
app.use((0, _HMRMiddleware.default)(compiler, {
|
83
100
|
path: '/sockjs-node/info'
|
84
101
|
}));
|
85
102
|
app.use((req, res, next) => {
|
86
103
|
//console.log('origin', req.get('origin'));
|
87
|
-
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*');
|
88
|
-
|
104
|
+
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
|
105
|
+
|
89
106
|
res.setHeader('Access-Control-Allow-Private-Network', true);
|
90
107
|
res.setHeader('Access-Control-Allow-Credentials', true);
|
91
108
|
next();
|
@@ -96,7 +113,9 @@ app.options('/*', (req, res) => {
|
|
96
113
|
app.use('/wms/*', (req, res) => {
|
97
114
|
res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
|
98
115
|
});
|
116
|
+
|
99
117
|
const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
|
118
|
+
|
100
119
|
const wss = new _ws.default.Server({
|
101
120
|
server: httpsServer
|
102
121
|
});
|
@@ -116,6 +135,7 @@ app.post('/wmsmockapi', (req, res) => {
|
|
116
135
|
let {
|
117
136
|
body
|
118
137
|
} = req;
|
138
|
+
|
119
139
|
try {
|
120
140
|
ws.send(JSON.stringify(body));
|
121
141
|
} catch (e) {
|
@@ -131,10 +151,12 @@ compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
|
|
131
151
|
});
|
132
152
|
compiler.hooks.done.tap('ReactCLI', () => {
|
133
153
|
const indexHtml = webpackCompilation.assets['index.html'];
|
154
|
+
|
134
155
|
if (indexHtml) {
|
135
156
|
initalHTML = indexHtml.source();
|
136
157
|
}
|
137
158
|
});
|
159
|
+
|
138
160
|
if (contextURL) {
|
139
161
|
app.use(contextURL, _express.default.static(context));
|
140
162
|
app.use(`${contextURL}/*`, (req, res) => {
|
@@ -144,17 +166,20 @@ if (contextURL) {
|
|
144
166
|
app.use(_express.default.static(context));
|
145
167
|
app.use('/*', _express.default.static(context));
|
146
168
|
}
|
169
|
+
|
147
170
|
httpsServer.listen(port, err => {
|
148
171
|
if (err) {
|
149
172
|
throw err;
|
150
173
|
}
|
174
|
+
|
151
175
|
(0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
|
152
176
|
});
|
177
|
+
|
153
178
|
if (isCompatableHttp2) {
|
154
179
|
const http2 = require('http2');
|
155
|
-
const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions);
|
156
180
|
|
157
|
-
// eslint-disable-next-line no-unused-vars
|
181
|
+
const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
|
182
|
+
|
158
183
|
http2Server.on('stream', (stream, headers) => {
|
159
184
|
stream.respond({
|
160
185
|
'content-type': 'text/html',
|
@@ -167,6 +192,7 @@ if (isCompatableHttp2) {
|
|
167
192
|
if (err) {
|
168
193
|
throw err;
|
169
194
|
}
|
195
|
+
|
170
196
|
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
171
197
|
host,
|
172
198
|
domain,
|
@@ -176,11 +202,13 @@ if (isCompatableHttp2) {
|
|
176
202
|
} else {
|
177
203
|
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
178
204
|
}
|
205
|
+
|
179
206
|
let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
|
180
207
|
app.listen(httpPort, err => {
|
181
208
|
if (err) {
|
182
209
|
throw err;
|
183
210
|
}
|
211
|
+
|
184
212
|
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
185
213
|
host,
|
186
214
|
domain,
|
package/lib/servers/ssServer.js
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _screenshotTest = _interopRequireDefault(require("@zohodesk/screenshot-test"));
|
4
|
+
|
4
5
|
var _jsonHelper = require("../utils/jsonHelper");
|
6
|
+
|
5
7
|
var _utils = require("../utils");
|
8
|
+
|
6
9
|
var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
|
10
|
+
|
7
11
|
var _SSTMiddleware = _interopRequireDefault(require("../middlewares/SSTMiddleware"));
|
12
|
+
|
8
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
9
15
|
let options = (0, _utils.getOptions)();
|
10
16
|
let impactedComponentObject = null;
|
11
17
|
let docsServerInstance;
|
@@ -21,6 +27,7 @@ let {
|
|
21
27
|
server
|
22
28
|
}
|
23
29
|
} = options;
|
30
|
+
|
24
31
|
function closeServer(serverInstance) {
|
25
32
|
(0, _utils.log)('Docs service stopped!');
|
26
33
|
let {
|
@@ -32,10 +39,12 @@ function closeServer(serverInstance) {
|
|
32
39
|
https.close();
|
33
40
|
wdm.close();
|
34
41
|
}
|
42
|
+
|
35
43
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.compareBranch', referBranch);
|
36
44
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.TestBranch', currentBranch);
|
37
45
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isExecuted', true);
|
38
46
|
(0, _utils.log)('Test Branch Name :- ', currentBranch);
|
47
|
+
|
39
48
|
let afterFirstScreenShotCollected = () => {
|
40
49
|
closeServer(docsServerInstance);
|
41
50
|
(0, _utils.switchBranch)('git', referBranch).then(() => {
|
@@ -45,6 +54,7 @@ let afterFirstScreenShotCollected = () => {
|
|
45
54
|
});
|
46
55
|
});
|
47
56
|
};
|
57
|
+
|
48
58
|
let onSStestEnd = (status, resultObject, isLastRun, runSSTest) => {
|
49
59
|
if (status) {
|
50
60
|
if (!isLastRun) {
|
@@ -72,13 +82,17 @@ let onSStestEnd = (status, resultObject, isLastRun, runSSTest) => {
|
|
72
82
|
throw new Error('Component list undefined! Please check component Docs');
|
73
83
|
}
|
74
84
|
};
|
85
|
+
|
75
86
|
(0, _utils.ssTestHack)();
|
87
|
+
|
76
88
|
let getDocsServerInstance = beforeJobs => {
|
77
89
|
if (typeof beforeJobs === 'function') {
|
78
90
|
beforeJobs();
|
79
91
|
}
|
92
|
+
|
80
93
|
return (0, _docsServerCore.default)(true);
|
81
94
|
};
|
95
|
+
|
82
96
|
let runSSTest = (onBefore, isLastRun, mode, branch, listOfComponents) => {
|
83
97
|
let url = (0, _utils.getServerURL)(Object.assign(server, {
|
84
98
|
host: server.iphost
|
@@ -86,6 +100,7 @@ let runSSTest = (onBefore, isLastRun, mode, branch, listOfComponents) => {
|
|
86
100
|
docsServerInstance = getDocsServerInstance(onBefore);
|
87
101
|
docsServerInstance.app.use((0, _SSTMiddleware.default)(docsServerInstance.compiler, mData => {
|
88
102
|
impactedComponentObject = (0, _utils.getComponents)(mData, listOfComponents);
|
103
|
+
|
89
104
|
_screenshotTest.default.run({
|
90
105
|
branch,
|
91
106
|
seleniumHub: seleniumHub,
|
@@ -100,6 +115,7 @@ let runSSTest = (onBefore, isLastRun, mode, branch, listOfComponents) => {
|
|
100
115
|
});
|
101
116
|
}));
|
102
117
|
};
|
118
|
+
|
103
119
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.startTime', Date.now());
|
104
120
|
(0, _utils.getDependenciesImpactList)(currentBranch, referBranch).then(impactedList => {
|
105
121
|
(0, _utils.log)('from here ');
|
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"
|
@@ -8,21 +8,27 @@ window.ClientCoverage = {
|
|
8
8
|
localStorage.setItem(property, JSON.stringify(defaultVal));
|
9
9
|
return defaultVal;
|
10
10
|
}
|
11
|
+
|
11
12
|
localStorage.setItem(property, JSON.stringify(defaultVal));
|
12
13
|
return defaultVal || {};
|
13
14
|
},
|
15
|
+
|
14
16
|
clearLocalStorage(property) {
|
15
17
|
localStorage.removeItem(property);
|
16
18
|
}
|
19
|
+
|
17
20
|
},
|
18
21
|
JS: {
|
19
22
|
jsMethodInstrumentObject: {},
|
20
23
|
jsStorageKey: 'jsClientCoverageObject',
|
24
|
+
|
21
25
|
init() {
|
22
26
|
this.jsMethodInstrumentObject = ClientCoverage.LocalStorageWrapper.getLocalStorage(this.jsStorageKey, this.jsMethodInstrumentObject);
|
23
27
|
},
|
28
|
+
|
24
29
|
visitMethod(jsFileName, jsMethodName) {
|
25
30
|
this.init();
|
31
|
+
|
26
32
|
if (this.jsMethodInstrumentObject.hasOwnProperty(jsFileName)) {
|
27
33
|
if (!this.jsMethodInstrumentObject[jsFileName].includes(jsMethodName)) {
|
28
34
|
this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
|
@@ -31,27 +37,35 @@ window.ClientCoverage = {
|
|
31
37
|
this.jsMethodInstrumentObject[jsFileName] = [];
|
32
38
|
this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
|
33
39
|
}
|
40
|
+
|
34
41
|
localStorage.setItem(this.jsStorageKey, JSON.stringify(this.jsMethodInstrumentObject));
|
35
42
|
},
|
43
|
+
|
36
44
|
clear() {
|
37
45
|
this.jsMethodInstrumentObject = {};
|
38
46
|
ClientCoverage.LocalStorageWrapper.clearLocalStorage(this.jsStorageKey);
|
39
47
|
},
|
48
|
+
|
40
49
|
getData() {
|
41
50
|
return {
|
42
51
|
methods: this.jsMethodInstrumentObject
|
43
52
|
};
|
44
53
|
}
|
54
|
+
|
45
55
|
},
|
56
|
+
|
46
57
|
getCoverageData() {
|
47
58
|
return {
|
48
59
|
JS: this.JS.getData()
|
49
60
|
};
|
50
61
|
},
|
62
|
+
|
51
63
|
clear() {
|
52
64
|
this.JS.clear();
|
53
65
|
},
|
66
|
+
|
54
67
|
init() {
|
55
68
|
this.JS.init();
|
56
69
|
}
|
70
|
+
|
57
71
|
};
|
@@ -1,34 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _querystring = _interopRequireDefault(require("querystring"));
|
4
|
+
|
4
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
5
7
|
let log = (...args) => {
|
6
8
|
let print = console;
|
7
9
|
print.log(...args);
|
8
|
-
};
|
10
|
+
}; // eslint-disable-next-line no-undef
|
11
|
+
|
9
12
|
|
10
|
-
// eslint-disable-next-line no-undef
|
11
13
|
let options = _querystring.default.parse(__resourceQuery.slice(1));
|
14
|
+
|
12
15
|
window.WebSocket = window.WebSocket || window.MozWebSocket;
|
13
16
|
let connection = new WebSocket(options.wmsPath);
|
17
|
+
|
14
18
|
connection.onopen = () => {
|
15
19
|
// connection is opened and ready to use
|
16
20
|
log('open');
|
17
21
|
};
|
22
|
+
|
18
23
|
connection.onerror = error => {
|
19
24
|
// an error occurred when sending/receiving data
|
20
25
|
throw error;
|
21
26
|
};
|
27
|
+
|
22
28
|
connection.onmessage = message => {
|
23
29
|
// try to decode json (I assume that each message
|
24
30
|
// from server is json)
|
25
31
|
try {
|
26
|
-
let json = JSON.parse(message.data);
|
27
|
-
|
32
|
+
let json = JSON.parse(message.data); // eslint-disable-next-line no-undef
|
33
|
+
|
28
34
|
Collaboration.handleCustomMessage(json);
|
29
35
|
} catch (e) {
|
30
36
|
log('This doesn\'t look like a valid JSON: ', message.data);
|
31
37
|
return;
|
32
|
-
}
|
33
|
-
|
38
|
+
} // handle incoming message
|
39
|
+
|
34
40
|
};
|