@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171
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 +1 -0
- package/.eslintrc.js +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +859 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +99 -84
- package/lib/configs/webpack.docs.config.js +65 -57
- package/lib/configs/webpack.impact.config.js +109 -0
- package/lib/configs/webpack.prod.config.js +147 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +368 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +541 -65
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- 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 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
@@ -1,100 +1,63 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var
|
3
|
+
var _express = _interopRequireDefault(require("express"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _gitlab = require("gitlab");
|
6
6
|
|
7
|
-
var
|
7
|
+
var _esprima = _interopRequireDefault(require("esprima"));
|
8
8
|
|
9
|
-
var
|
10
|
-
|
11
|
-
var _esprima = require('esprima');
|
12
|
-
|
13
|
-
var _esprima2 = _interopRequireDefault(_esprima);
|
14
|
-
|
15
|
-
var _utils = require('../utils');
|
9
|
+
var _utils = require("../utils");
|
16
10
|
|
17
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
let options = (0, _utils.getOptions)();
|
14
|
+
let {
|
15
|
+
impact: {
|
16
|
+
server
|
17
|
+
}
|
18
|
+
} = options;
|
19
|
+
let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'p');
|
20
|
+
let {
|
21
|
+
port
|
22
|
+
} = server;
|
23
|
+
const services = new _gitlab.ProjectsBundle({
|
29
24
|
url: 'https://git.csez.zohocorpin.com',
|
30
25
|
token: 'n6aqQz3RfzqRGPyMTPy8'
|
31
26
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
app.use(_express2.default.json());
|
36
|
-
app.use(_express2.default.urlencoded({
|
27
|
+
let app = (0, _express.default)();
|
28
|
+
app.use(_express.default.json());
|
29
|
+
app.use(_express.default.urlencoded({
|
37
30
|
extended: true
|
38
31
|
}));
|
39
32
|
|
40
|
-
app.post('/impact/build', function (req, res) {
|
41
|
-
req.setTimeout(0);
|
42
|
-
var subUrl = '/logs/reactbuildinfo.txt';
|
43
|
-
var build = req.body;
|
44
|
-
|
45
|
-
var url = build.buildUrl.substr(0, build.buildUrl.lastIndexOf('/'));
|
46
|
-
url = url + subUrl;
|
47
|
-
getDetails(url, function (body, esprimaObj, componentObj, err) {
|
48
|
-
if (err) {
|
49
|
-
return err;
|
50
|
-
}
|
51
|
-
var responseObj = {};
|
52
|
-
Object.keys(esprimaObj).forEach(function (file) {
|
53
|
-
responseObj[file] = [];
|
54
|
-
body[file].forEach(function (changedLine) {
|
55
|
-
Object.keys(esprimaObj[file]).forEach(function (method) {
|
56
|
-
if (esprimaObj[file][method].includes(changedLine)) {
|
57
|
-
if (!responseObj[file].includes(method)) {
|
58
|
-
responseObj[file].push(method);
|
59
|
-
}
|
60
|
-
}
|
61
|
-
});
|
62
|
-
});
|
63
|
-
if (!responseObj[file].length) {
|
64
|
-
delete responseObj[file];
|
65
|
-
}
|
66
|
-
});
|
67
|
-
|
68
|
-
var resObj = {
|
69
|
-
chnagedMethods: responseObj,
|
70
|
-
changedLocators: componentObj
|
71
|
-
};
|
72
|
-
res.send(resObj);
|
73
|
-
res.end();
|
74
|
-
});
|
75
|
-
});
|
76
33
|
function traverseJSON(parsed, file) {
|
77
|
-
|
78
|
-
parsed.forEach(
|
34
|
+
let parsedObj = {};
|
35
|
+
parsed.forEach(Block => {
|
79
36
|
if (Block.type === 'FunctionDeclaration' || Block.type === 'ExportDefaultDeclaration' || Block.type === 'ExportNamedDeclaration') {
|
80
|
-
|
37
|
+
let ParsedTemp;
|
38
|
+
|
81
39
|
if (Block.type === 'FunctionDeclaration') {
|
82
40
|
ParsedTemp = Block;
|
83
41
|
} else {
|
84
42
|
ParsedTemp = Block.declaration;
|
85
43
|
}
|
44
|
+
|
86
45
|
if (ParsedTemp) {
|
87
46
|
if (ParsedTemp.id) {
|
88
|
-
|
47
|
+
let funcname = ParsedTemp.id.name;
|
48
|
+
|
89
49
|
if (funcname !== 'mapStateToProps') {
|
90
50
|
if (!funcname.includes('_')) {
|
91
51
|
if (!Object.prototype.hasOwnProperty.call(parsedObj, 'file')) {
|
92
52
|
parsedObj[file] = {};
|
93
53
|
}
|
94
|
-
|
95
|
-
|
54
|
+
|
55
|
+
let tempArray = [];
|
56
|
+
|
57
|
+
for (let j = ParsedTemp.loc.start.line; j < ParsedTemp.loc.end.line; j++) {
|
96
58
|
tempArray.push(j);
|
97
59
|
}
|
60
|
+
|
98
61
|
parsedObj[file][funcname] = tempArray;
|
99
62
|
}
|
100
63
|
}
|
@@ -104,44 +67,42 @@ function traverseJSON(parsed, file) {
|
|
104
67
|
});
|
105
68
|
return parsedObj;
|
106
69
|
}
|
70
|
+
|
107
71
|
function getDetails(url, callback) {
|
108
|
-
|
109
|
-
|
110
|
-
(0, _utils.request)({
|
111
|
-
|
72
|
+
let changeObj = {};
|
73
|
+
let compObj = {};
|
74
|
+
(0, _utils.request)({
|
75
|
+
url
|
76
|
+
}).then(res => {
|
77
|
+
let body = JSON.parse(res.body);
|
78
|
+
|
112
79
|
if (body.includes('Source_Changeset')) {
|
113
|
-
|
114
|
-
changeSet = void 0;
|
80
|
+
let branch, changeSet;
|
115
81
|
body = body.split('\n');
|
116
|
-
body.forEach(
|
82
|
+
body.forEach(content => {
|
117
83
|
if (content.includes('Source_Changeset')) {
|
118
|
-
|
119
|
-
_content$split2 = _slicedToArray(_content$split, 2),
|
120
|
-
__changeSet = _content$split2[1];
|
121
|
-
|
84
|
+
let [, __changeSet] = content.split('=');
|
122
85
|
changeSet = __changeSet;
|
123
86
|
}
|
124
|
-
if (content.includes('SourceCoLabel')) {
|
125
|
-
var _content$split3 = content.split('='),
|
126
|
-
_content$split4 = _slicedToArray(_content$split3, 1),
|
127
|
-
__branch = _content$split4[0];
|
128
87
|
|
88
|
+
if (content.includes('SourceCoLabel')) {
|
89
|
+
let [__branch] = content.split('=');
|
129
90
|
branch = __branch;
|
130
91
|
}
|
131
92
|
});
|
132
|
-
services.Commits.diff(1143, changeSet
|
133
|
-
|
134
|
-
|
135
|
-
|
93
|
+
services.Commits.diff(1143, changeSet //'587efd32ce14620750a38ab74bc744fc52f2943a '
|
94
|
+
).then(result => {
|
95
|
+
let promises = [];
|
96
|
+
|
136
97
|
if (result) {
|
137
|
-
result.forEach(
|
138
|
-
|
139
|
-
|
98
|
+
result.forEach(change => {
|
99
|
+
let p = new Promise(resolve => {
|
100
|
+
let filename = change.new_path;
|
140
101
|
changeObj[filename] = [];
|
141
102
|
compObj[filename] = [];
|
142
|
-
|
143
|
-
|
144
|
-
diffList.forEach(
|
103
|
+
let diffList = change.diff.split('\n');
|
104
|
+
let tempObj = {};
|
105
|
+
diffList.forEach(diff => {
|
145
106
|
if (diff.indexOf('data-id') >= 0) {
|
146
107
|
if (diff.indexOf('//') >= 0) {
|
147
108
|
if (diff.substr(diff.indexOf('//') + 1).includes('data-id')) {
|
@@ -150,22 +111,27 @@ function getDetails(url, callback) {
|
|
150
111
|
tempObj.changedId = null;
|
151
112
|
}
|
152
113
|
}
|
114
|
+
|
153
115
|
if (!diff.indexOf('-')) {
|
154
116
|
//eslint-disable-next-line
|
155
117
|
tempObj.defaultId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
|
156
|
-
|
118
|
+
let tempIndex = diffList.indexOf(diff);
|
119
|
+
|
157
120
|
if (diffList[tempIndex + 1].indexOf('data-id') === -1) {
|
158
121
|
tempObj.changedId = null;
|
159
122
|
}
|
160
123
|
}
|
124
|
+
|
161
125
|
if (!diff.indexOf('+')) {
|
162
126
|
//eslint-disable-next-line
|
163
127
|
tempObj.changedId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
|
164
|
-
|
165
|
-
|
128
|
+
let tempIndex = diffList.indexOf(diff);
|
129
|
+
|
130
|
+
if (diffList[tempIndex - 1].indexOf('data-id') === -1) {
|
166
131
|
tempObj.defaultId = null;
|
167
132
|
}
|
168
133
|
}
|
134
|
+
|
169
135
|
if (Object.prototype.hasOwnProperty.call(tempObj, 'defaultId') && Object.prototype.hasOwnProperty.call(tempObj, 'changedId')) {
|
170
136
|
if (tempObj.defaultId !== tempObj.changedId) {
|
171
137
|
compObj[filename].push(tempObj);
|
@@ -173,34 +139,39 @@ function getDetails(url, callback) {
|
|
173
139
|
}
|
174
140
|
}
|
175
141
|
}
|
142
|
+
|
176
143
|
if (diff.startsWith('@')) {
|
177
|
-
|
178
|
-
|
179
|
-
|
144
|
+
let [, content] = diff.split('@@');
|
145
|
+
let tempList = content.split(' ');
|
146
|
+
let startingLine = parseInt(tempList[1].split(',')[0]) * -1 + 3;
|
147
|
+
let furtherLines = parseInt(tempList[2].split(',')[0]) + 3;
|
180
148
|
|
181
|
-
var tempList = content.split(' ');
|
182
|
-
var startingLine = parseInt(tempList[1].split(',')[0]) * -1 + 3;
|
183
|
-
var furtherLines = parseInt(tempList[2].split(',')[0]) + 3;
|
184
149
|
if (parseInt(tempList[1].split(',')[1]) > 6) {
|
185
150
|
changeObj[filename].push(startingLine);
|
186
151
|
}
|
152
|
+
|
187
153
|
if (parseInt(tempList[2].split(',')[1]) > 6) {
|
188
|
-
|
189
|
-
|
154
|
+
let endValue = parseInt(tempList[2].split(',')[1]) - 6;
|
155
|
+
|
156
|
+
for (let i = furtherLines; i < furtherLines + endValue; i++) {
|
190
157
|
changeObj[filename].push(i);
|
191
158
|
}
|
192
159
|
}
|
193
160
|
}
|
194
161
|
});
|
162
|
+
|
195
163
|
if (!filename.includes('.spec.js') && !filename.includes('.docs.js') && !filename.includes('.css') && filename.includes('.js')) {
|
196
164
|
try {
|
197
|
-
services.RepositoryFiles.show(1143, filename, branch).then(
|
198
|
-
|
199
|
-
|
165
|
+
services.RepositoryFiles.show(1143, filename, branch).then(res => {
|
166
|
+
let code = Buffer.from(res.content, 'base64').toString('ascii');
|
167
|
+
|
168
|
+
let parsed = _esprima.default.parseModule(code, {
|
200
169
|
jsx: true,
|
201
170
|
loc: true
|
202
171
|
});
|
203
|
-
|
172
|
+
|
173
|
+
let methodDetail = traverseJSON(parsed.body, filename);
|
174
|
+
|
204
175
|
if (Object.keys(methodDetail).length) {
|
205
176
|
resolve(methodDetail);
|
206
177
|
} else {
|
@@ -216,21 +187,58 @@ function getDetails(url, callback) {
|
|
216
187
|
});
|
217
188
|
promises.push(p);
|
218
189
|
});
|
219
|
-
Promise.all(promises).then(
|
220
|
-
callback(changeObj, Object.assign
|
190
|
+
Promise.all(promises).then(resPromise => {
|
191
|
+
callback(changeObj, Object.assign({}, ...resPromise), compObj);
|
221
192
|
});
|
222
193
|
}
|
223
194
|
});
|
224
195
|
}
|
225
|
-
}).catch(
|
226
|
-
return err;
|
227
|
-
});
|
196
|
+
}).catch(err => err);
|
228
197
|
}
|
229
198
|
|
230
|
-
app.
|
199
|
+
app.post('/impact/build', (req, res) => {
|
200
|
+
req.setTimeout(0);
|
201
|
+
let subUrl = '/logs/reactbuildinfo.txt';
|
202
|
+
let {
|
203
|
+
body: build
|
204
|
+
} = req;
|
205
|
+
let url = build.buildUrl.substr(0, build.buildUrl.lastIndexOf('/'));
|
206
|
+
url = url + subUrl;
|
207
|
+
getDetails(url, (body, esprimaObj, componentObj, err) => {
|
208
|
+
if (err) {
|
209
|
+
return err;
|
210
|
+
}
|
211
|
+
|
212
|
+
let responseObj = {};
|
213
|
+
Object.keys(esprimaObj).forEach(file => {
|
214
|
+
responseObj[file] = [];
|
215
|
+
body[file].forEach(changedLine => {
|
216
|
+
Object.keys(esprimaObj[file]).forEach(method => {
|
217
|
+
if (esprimaObj[file][method].includes(changedLine)) {
|
218
|
+
if (!responseObj[file].includes(method)) {
|
219
|
+
responseObj[file].push(method);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
});
|
223
|
+
});
|
224
|
+
|
225
|
+
if (!responseObj[file].length) {
|
226
|
+
delete responseObj[file];
|
227
|
+
}
|
228
|
+
});
|
229
|
+
let resObj = {
|
230
|
+
chnagedMethods: responseObj,
|
231
|
+
changedLocators: componentObj
|
232
|
+
};
|
233
|
+
res.send(resObj);
|
234
|
+
res.end();
|
235
|
+
});
|
236
|
+
});
|
237
|
+
app.listen(port, err => {
|
231
238
|
if (err) {
|
232
239
|
throw err;
|
233
240
|
}
|
234
|
-
|
241
|
+
|
242
|
+
(0, _utils.log)(`Listening at ${serverUrl}/impact/build/`);
|
235
243
|
(0, _utils.log)('payload like => {buildUrl:test_build_url}');
|
236
244
|
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _express = _interopRequireDefault(require("express"));
|
4
|
+
|
5
|
+
var _fs = _interopRequireDefault(require("fs"));
|
6
|
+
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
8
|
+
|
9
|
+
var _utils = require("../utils");
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
13
|
+
let options = (0, _utils.getOptions)();
|
14
|
+
let {
|
15
|
+
app: {
|
16
|
+
server: {
|
17
|
+
mockPort
|
18
|
+
}
|
19
|
+
}
|
20
|
+
} = options;
|
21
|
+
const app = (0, _express.default)();
|
22
|
+
app.use(_express.default.json());
|
23
|
+
app.use(_express.default.urlencoded({
|
24
|
+
extended: true
|
25
|
+
}));
|
26
|
+
let appPath = process.cwd();
|
27
|
+
|
28
|
+
let mockServerPath = _path.default.join(appPath, 'mockapi', 'index.js');
|
29
|
+
|
30
|
+
if (_fs.default.existsSync(mockServerPath)) {
|
31
|
+
let mockServer = require(mockServerPath);
|
32
|
+
|
33
|
+
mockServer(app);
|
34
|
+
} else {
|
35
|
+
(0, _utils.log)('You must export a function from mockapi folder by only we can provide mock api hook');
|
36
|
+
}
|
37
|
+
|
38
|
+
app.listen(mockPort, err => {
|
39
|
+
if (err) {
|
40
|
+
(0, _utils.log)('error', err);
|
41
|
+
} else {
|
42
|
+
(0, _utils.log)(`mock server listening port: ${mockPort}`);
|
43
|
+
}
|
44
|
+
});
|
@@ -0,0 +1,200 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
5
|
+
var _https = _interopRequireDefault(require("https"));
|
6
|
+
|
7
|
+
var _express = _interopRequireDefault(require("express"));
|
8
|
+
|
9
|
+
var _ws = _interopRequireDefault(require("ws"));
|
10
|
+
|
11
|
+
var _httpProxyMiddleware = require("http-proxy-middleware");
|
12
|
+
|
13
|
+
var _utils = require("../utils");
|
14
|
+
|
15
|
+
var _httpsOptions = require("./httpsOptions");
|
16
|
+
|
17
|
+
var _devBuild = require("./devBuild");
|
18
|
+
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
|
+
|
21
|
+
// import webpack from 'webpack';
|
22
|
+
let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
|
23
|
+
|
24
|
+
let {
|
25
|
+
app: {
|
26
|
+
context,
|
27
|
+
server
|
28
|
+
}
|
29
|
+
} = options;
|
30
|
+
let {
|
31
|
+
host,
|
32
|
+
port,
|
33
|
+
domain,
|
34
|
+
disableContextURL,
|
35
|
+
hasMock,
|
36
|
+
mockPort
|
37
|
+
} = server;
|
38
|
+
let isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
|
39
|
+
let contextURL = disableContextURL ? '' : `/${context}`;
|
40
|
+
let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
|
41
|
+
const {
|
42
|
+
zipname,
|
43
|
+
cssSelectorZipPath,
|
44
|
+
outputFolderLocation
|
45
|
+
} = (0, _devBuild.getPaths)();
|
46
|
+
const app = (0, _express.default)();
|
47
|
+
|
48
|
+
if (hasMock) {
|
49
|
+
app.use(server.mockPrefix, (0, _httpProxyMiddleware.createProxyMiddleware)({
|
50
|
+
target: 'ht' + `tp://localhost:${mockPort}`,
|
51
|
+
changeOrigin: true
|
52
|
+
}));
|
53
|
+
} // Nb@$#3NGscc
|
54
|
+
|
55
|
+
|
56
|
+
app.use(_express.default.json());
|
57
|
+
app.use(_express.default.urlencoded({
|
58
|
+
extended: true
|
59
|
+
}));
|
60
|
+
|
61
|
+
const staticPart = _express.default.static(outputFolderLocation, {
|
62
|
+
cacheControl: true,
|
63
|
+
setHeaders: function (res) {
|
64
|
+
if (options.app.enableDevCache) {
|
65
|
+
res.setHeader('Cache-Control', 'public, max-age=604800');
|
66
|
+
}
|
67
|
+
|
68
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
if (contextURL === '') {
|
73
|
+
app.use(staticPart);
|
74
|
+
} else {
|
75
|
+
app.use(contextURL, staticPart);
|
76
|
+
}
|
77
|
+
|
78
|
+
app.use((req, res, next) => {
|
79
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
80
|
+
next();
|
81
|
+
}).use(`${contextURL}/fonts`, _express.default.static(`${context}/fonts`));
|
82
|
+
app.use('/wms/*', (req, res) => {
|
83
|
+
res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
|
84
|
+
});
|
85
|
+
|
86
|
+
const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
|
87
|
+
|
88
|
+
const wss = new _ws.default.Server({
|
89
|
+
server: httpsServer
|
90
|
+
});
|
91
|
+
let wsPool = [];
|
92
|
+
wss.on('connection', ws => {
|
93
|
+
wsPool.push(ws);
|
94
|
+
ws.on('close', () => {
|
95
|
+
wsPool = wsPool.filter(ws1 => ws1 !== ws);
|
96
|
+
});
|
97
|
+
ws.on('message', message => {
|
98
|
+
(0, _utils.log)('received: %s', message);
|
99
|
+
});
|
100
|
+
ws.send('something');
|
101
|
+
});
|
102
|
+
app.post('/wmsmockapi', (req, res) => {
|
103
|
+
wsPool.forEach(ws => {
|
104
|
+
let {
|
105
|
+
body
|
106
|
+
} = req;
|
107
|
+
|
108
|
+
try {
|
109
|
+
ws.send(JSON.stringify(body));
|
110
|
+
} catch (e) {
|
111
|
+
(0, _utils.log)(e, body);
|
112
|
+
}
|
113
|
+
});
|
114
|
+
res.send('success');
|
115
|
+
}); // let webpackCompilation;
|
116
|
+
// compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
|
117
|
+
// webpackCompilation = compilation;
|
118
|
+
// });
|
119
|
+
|
120
|
+
if (zipname) {
|
121
|
+
app.use(`/zips/${zipname}.zip`, (req, res) => {
|
122
|
+
res.download(_path.default.join(process.cwd(), cssSelectorZipPath), err => {
|
123
|
+
if (err) {
|
124
|
+
throw err;
|
125
|
+
}
|
126
|
+
|
127
|
+
console.log(`${zipname}.zip downloaded`);
|
128
|
+
});
|
129
|
+
});
|
130
|
+
app.use('/zips/build.zip', (req, res) => {
|
131
|
+
res.download(_path.default.join(process.cwd(), 'build.zip'), err => {
|
132
|
+
if (err) {
|
133
|
+
throw err;
|
134
|
+
}
|
135
|
+
|
136
|
+
console.log('build.zip downloaded');
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
140
|
+
|
141
|
+
if (contextURL) {
|
142
|
+
app.use(contextURL, _express.default.static(context));
|
143
|
+
app.use(`${contextURL}/*`, (req, res) => {
|
144
|
+
// let indexHtml = webpackCompilation.assets['index.html'];
|
145
|
+
res.sendFile(_path.default.join(outputFolderLocation, 'index.html')); // let indexHtml = webpackCompilation.assets['index.html'];
|
146
|
+
// res.send(indexHtml && indexHtml.source());
|
147
|
+
});
|
148
|
+
} else {
|
149
|
+
app.use(_express.default.static(context));
|
150
|
+
app.use('/*', _express.default.static(context));
|
151
|
+
}
|
152
|
+
|
153
|
+
httpsServer.listen(port, err => {
|
154
|
+
if (err) {
|
155
|
+
throw err;
|
156
|
+
}
|
157
|
+
|
158
|
+
(0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
|
159
|
+
});
|
160
|
+
|
161
|
+
if (isCompatableHttp2) {
|
162
|
+
const http2 = require('http2');
|
163
|
+
|
164
|
+
const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
|
165
|
+
|
166
|
+
http2Server.on('stream', (stream, headers) => {
|
167
|
+
stream.respond({
|
168
|
+
'content-type': 'text/html',
|
169
|
+
':status': 200
|
170
|
+
});
|
171
|
+
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
172
|
+
});
|
173
|
+
let http2Port = Number(port) + 1;
|
174
|
+
http2Server.listen(http2Port, err => {
|
175
|
+
if (err) {
|
176
|
+
throw err;
|
177
|
+
}
|
178
|
+
|
179
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
180
|
+
host,
|
181
|
+
domain,
|
182
|
+
port: http2Port
|
183
|
+
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
184
|
+
});
|
185
|
+
} else {
|
186
|
+
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
187
|
+
}
|
188
|
+
|
189
|
+
let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
|
190
|
+
app.listen(httpPort, err => {
|
191
|
+
if (err) {
|
192
|
+
throw err;
|
193
|
+
}
|
194
|
+
|
195
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
196
|
+
host,
|
197
|
+
domain,
|
198
|
+
port: httpPort
|
199
|
+
}, 'ht' + 'tp')}${contextURL}/`);
|
200
|
+
});
|