@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3
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/README.md +18 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +13 -2
- package/lib/babel/es-plugins-presets.js +14 -3
- package/lib/common/buildEs.js +0 -1
- package/lib/common/getEntries.js +13 -2
- package/lib/common/getPublicPathConfig.js +6 -0
- package/lib/common/index.js +6 -1
- package/lib/common/runPreProcess.js +15 -6
- package/lib/common/splitChunks.js +21 -2
- package/lib/common/sslcertUpdater.js +18 -7
- package/lib/common/templateParameters.js +2 -0
- package/lib/common/testPattern.js +21 -10
- package/lib/common/valueReplacer.js +16 -1
- package/lib/configs/jest.config.js +11 -2
- package/lib/configs/libAlias.js +16 -10
- package/lib/configs/resolvers.js +16 -6
- package/lib/configs/webpack.component.umd.config.js +6 -1
- package/lib/configs/webpack.css.umd.config.js +14 -6
- package/lib/configs/webpack.dev.config.js +14 -1
- package/lib/configs/webpack.docs.config.js +9 -1
- package/lib/configs/webpack.impact.config.js +8 -1
- package/lib/configs/webpack.prod.config.js +17 -4
- package/lib/constants.js +18 -9
- package/lib/deprecationLogger.js +7 -0
- package/lib/hooks/docsProptypeHook.js +8 -4
- package/lib/jest/commitedFilesResult.js +46 -4
- package/lib/jest/coverageCollector.js +12 -1
- package/lib/jest/jsonMaker.js +6 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
- package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
- package/lib/jest/result.js +23 -1
- package/lib/jest/run.js +18 -7
- package/lib/jest/setup.js +60 -8
- package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
- package/lib/loaderUtils/getCSSLoaders.js +22 -10
- package/lib/loaderUtils/getDevJsLoaders.js +13 -4
- package/lib/loaderUtils/index.js +4 -1
- package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
- package/lib/loaderUtils/windowsModification.js +3 -2
- package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
- package/lib/loaders/composeLoader.js +37 -13
- package/lib/loaders/docsLoader.js +12 -1
- package/lib/loaders/docsPropsLoader.js +8 -4
- package/lib/loaders/enhancedReactLiveConverter.js +23 -2
- package/lib/loaders/fileBountryLoader.js +3 -1
- package/lib/loaders/fileLoader.js +23 -12
- package/lib/loaders/markdownLoader.js +19 -14
- package/lib/loaders/reactLiveConvertor.js +15 -5
- package/lib/loaders/scriptInstrumentLoader.js +16 -7
- package/lib/loaders/selectorMappingLoader.js +26 -7
- package/lib/loaders/workerLoader.js +24 -9
- package/lib/logger.js +4 -0
- package/lib/middlewares/HMRMiddleware.js +27 -13
- package/lib/middlewares/SSTMiddleware.js +5 -1
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
- package/lib/pluginUtils/getDevPlugins.js +42 -9
- package/lib/pluginUtils/getDocsPlugins.js +13 -3
- package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
- package/lib/pluginUtils/getLibraryPlugins.js +8 -2
- package/lib/pluginUtils/getProdPlugins.js +47 -8
- package/lib/pluginUtils/getServerPlugins.js +8 -2
- package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
- package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
- package/lib/pluginUtils/index.js +9 -1
- package/lib/plugins/CdnChangePlugin.js +18 -2
- package/lib/plugins/CleanupStatsPlugin.js +5 -0
- package/lib/plugins/CssOrderControlPlugin.js +6 -3
- package/lib/plugins/CustomAttributePlugin.js +19 -14
- package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
- package/lib/plugins/EFCPlugin.js +34 -20
- package/lib/plugins/EFCTemplatePlugin.js +30 -19
- package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
- package/lib/plugins/EventsHandlingPlugin.js +4 -2
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
- package/lib/plugins/I18nSplitPlugin/index.js +24 -13
- 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 +8 -1
- package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
- package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
- package/lib/plugins/ManifestPlugin.js +18 -1
- package/lib/plugins/MinifyPlugin.js +10 -1
- package/lib/plugins/ModuleStatsPlugin.js +24 -1
- package/lib/plugins/OptimizeJSPlugin.js +10 -2
- package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
- package/lib/plugins/PublicPathChangePlugin.js +39 -6
- package/lib/plugins/ReportGeneratePlugin.js +32 -5
- package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
- package/lib/plugins/ResourceHintsPlugin.js +13 -4
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
- package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
- package/lib/plugins/SelectorPlugin.js +32 -6
- package/lib/plugins/ServiceWorkerPlugin.js +22 -5
- package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
- package/lib/plugins/SourceMapHookPlugin.js +12 -2
- package/lib/plugins/StatsPlugin.js +14 -0
- package/lib/plugins/TPHashMappingPlugin.js +18 -3
- package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
- package/lib/plugins/VariableConversionCollector.js +42 -15
- package/lib/plugins/index.js +20 -1
- package/lib/plugins/libraryImpactPlugin.js +33 -1
- package/lib/plugins/utils/classHandling.js +6 -0
- package/lib/plugins/utils/fileHandling.js +15 -6
- package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
- package/lib/plugins/variableConvertorUtils.js +29 -14
- package/lib/plugins/webpackwatchrunplugin.js +5 -0
- package/lib/postcss-plugins/EmptyPlugin.js +4 -3
- package/lib/postcss-plugins/ExcludePlugin.js +5 -1
- package/lib/postcss-plugins/IncludePlugin.js +5 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
- package/lib/postcss-plugins/SelectorReplace.js +16 -1
- package/lib/postcss-plugins/ValueReplacer.js +6 -7
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
- package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
- package/lib/schemas/index.js +10 -3
- package/lib/servers/clusterHubServer.js +11 -1
- package/lib/servers/devBuild.js +26 -14
- package/lib/servers/docsServer.js +3 -1
- package/lib/servers/docsServerCore.js +22 -1
- package/lib/servers/getCliPath.js +9 -0
- package/lib/servers/helpServer.js +6 -1
- package/lib/servers/httpsOptions.js +8 -2
- package/lib/servers/impactServer.js +35 -3
- package/lib/servers/mockserver.js +10 -1
- package/lib/servers/nowatchserver.js +37 -12
- package/lib/servers/requireLocalOrGlobal.js +17 -6
- package/lib/servers/scrServer.js +21 -14
- package/lib/servers/server.js +36 -6
- package/lib/servers/ssServer.js +17 -1
- package/lib/templates/CoverageScriptTemplate.js +14 -0
- package/lib/templates/WMSTemplate.js +13 -7
- package/lib/templates/linterConstant.js +4 -2
- package/lib/utils/babelPresets.js +7 -3
- package/lib/utils/clean.js +9 -3
- package/lib/utils/copy.js +7 -1
- package/lib/utils/copyTimezones.js +9 -1
- package/lib/utils/createEventStream.js +6 -1
- package/lib/utils/cssClassNameGenerate.js +30 -10
- package/lib/utils/cssURLReplacer.js +22 -1
- package/lib/utils/dependencyPostPublish.js +10 -1
- package/lib/utils/deprecationSupport.js +32 -7
- package/lib/utils/fileUtils.js +28 -1
- package/lib/utils/folderIterator.js +13 -2
- package/lib/utils/getComponents.js +21 -0
- package/lib/utils/getCurrentBranch.js +5 -0
- package/lib/utils/getDependenciesImpactList.js +22 -1
- package/lib/utils/getFileType.js +10 -2
- package/lib/utils/getHash.js +8 -1
- package/lib/utils/getIp.js +2 -0
- package/lib/utils/getOptions.js +53 -16
- package/lib/utils/getServerURL.js +10 -1
- package/lib/utils/index.js +51 -4
- package/lib/utils/init.js +1 -0
- package/lib/utils/initPreCommitHook.js +30 -7
- package/lib/utils/jsonHelper.js +22 -3
- package/lib/utils/libraryImpactConfig.js +5 -2
- 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/log.js +1 -0
- package/lib/utils/mailSender.js +8 -1
- package/lib/utils/object-manipulation.js +17 -1
- package/lib/utils/pullOrigin.js +4 -0
- package/lib/utils/reinstallDependencies.js +29 -1
- package/lib/utils/removeAttributes.js +8 -1
- package/lib/utils/repoClone.js +28 -3
- package/lib/utils/request.js +12 -0
- package/lib/utils/rtl.js +17 -5
- package/lib/utils/selectorReplacer.js +16 -10
- package/lib/utils/setEnvVariables.js +2 -0
- package/lib/utils/ssTestHack.js +11 -1
- package/lib/utils/switchBranch.js +5 -0
- package/lib/utils/typeCheck.js +1 -0
- package/lib/utils/urlConcat.js +4 -0
- package/lib/utils/useExitCleanup.js +10 -9
- package/lib/utils/variableConverter.js +31 -22
- package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
- package/package.json +3 -2
- package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
- package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
- package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
- package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
- package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
- package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
- package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
- package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
- package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
- package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
- package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
- package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
- package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
- package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
- package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
- package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
- package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
- package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
- package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
- package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
- package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
- package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
- package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -1,10 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
4
5
|
var _fs = _interopRequireDefault(require("fs"));
|
6
|
+
|
5
7
|
var _express = _interopRequireDefault(require("express"));
|
8
|
+
|
6
9
|
var _utils = require("../utils");
|
7
|
-
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
8
13
|
let options = (0, _utils.getOptions)();
|
9
14
|
let {
|
10
15
|
cluster: {
|
@@ -13,13 +18,17 @@ let {
|
|
13
18
|
} = options;
|
14
19
|
let app = (0, _express.default)();
|
15
20
|
let appPath = process.cwd();
|
21
|
+
|
16
22
|
let clusterConfigPath = _path.default.join(appPath, 'clusterConfig.js');
|
23
|
+
|
17
24
|
let config;
|
25
|
+
|
18
26
|
if (_fs.default.existsSync(clusterConfigPath)) {
|
19
27
|
config = require(clusterConfigPath);
|
20
28
|
} else {
|
21
29
|
throw new Error(`clusterConfig.js doen't exist under following path - ${clusterConfigPath}`);
|
22
30
|
}
|
31
|
+
|
23
32
|
app.get('/clusterhub/nodes', (req, res) => {
|
24
33
|
res.send(JSON.stringify(config.cluster));
|
25
34
|
});
|
@@ -28,5 +37,6 @@ app.listen(server.port, err => {
|
|
28
37
|
if (err) {
|
29
38
|
throw err;
|
30
39
|
}
|
40
|
+
|
31
41
|
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'ht' + 'tp')}/clusterhub/`);
|
32
42
|
});
|
package/lib/servers/devBuild.js
CHANGED
@@ -4,15 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getPaths = getPaths;
|
7
|
+
|
7
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
8
10
|
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
9
12
|
var _child_process = require("child_process");
|
13
|
+
|
10
14
|
var _utils = require("../utils");
|
15
|
+
|
11
16
|
var _getCliPath = require("./getCliPath");
|
17
|
+
|
12
18
|
var _logger = require("../logger");
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
16
23
|
// NOTE: need to discuss about in below codes,
|
17
24
|
// when we run webpack the usable options that comes for npm run not working as automatical
|
18
25
|
// we are use this option always --disable_watch=true reason for now no need for
|
@@ -26,63 +33,68 @@ const {
|
|
26
33
|
cssSelectorZipPath
|
27
34
|
} = options.impactService;
|
28
35
|
const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
|
36
|
+
|
29
37
|
const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
|
38
|
+
|
30
39
|
function execSyncDefalut(command) {
|
31
40
|
(0, _logger.messageLogger)(' command running ==>', command);
|
32
41
|
return (0, _child_process.execSync)(command, {
|
33
42
|
stdio: 'inherit'
|
34
43
|
});
|
35
44
|
}
|
45
|
+
|
36
46
|
const isQuiet = 'q';
|
37
|
-
const webpack = (0, _getCliPath.getCliPath)('webpack');
|
38
|
-
// messageLogger('webpack === > ', webpack, fs.existsSync(webpack));
|
47
|
+
const webpack = (0, _getCliPath.getCliPath)('webpack'); // messageLogger('webpack === > ', webpack, fs.existsSync(webpack));
|
39
48
|
|
40
49
|
if (_fs.default.existsSync(outputFolderLocation)) {
|
41
50
|
execSyncDefalut(`rm -rf ${outputFolder}`);
|
42
51
|
(0, _logger.messageLogger)(`previous ${outputFolder} removed`);
|
43
52
|
}
|
53
|
+
|
44
54
|
if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
|
45
55
|
execSyncDefalut('rm build.zip');
|
46
56
|
(0, _logger.messageLogger)('previous build.zip removed');
|
47
|
-
}
|
48
|
-
// execSyncDefalut(`${webpack } --version`);
|
57
|
+
} // execSyncDefalut(`${webpack } --version`);
|
49
58
|
// execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
50
59
|
|
60
|
+
|
51
61
|
(0, _logger.messageLogger)('webpack compilation starts...');
|
52
|
-
const startTime = Date.now();
|
53
|
-
// const result = spawnSync(
|
62
|
+
const startTime = Date.now(); // const result = spawnSync(
|
54
63
|
// webpack,
|
55
64
|
// ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
|
56
65
|
// args
|
57
66
|
// ),
|
58
67
|
// { stdio: 'inherit' }
|
59
68
|
// );
|
60
|
-
|
61
69
|
// --disable_watch=true
|
70
|
+
|
62
71
|
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
63
72
|
result && (0, _logger.messageLogger)(result);
|
73
|
+
|
64
74
|
if (result && result.stderr) {
|
65
75
|
throw result.stderr;
|
66
76
|
}
|
77
|
+
|
67
78
|
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
79
|
+
|
68
80
|
if (zipname) {
|
69
81
|
execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
|
70
82
|
(0, _logger.messageLogger)('build.zip file created');
|
71
83
|
const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
|
72
84
|
execSyncDefalut(`rm -rf ${zipname}`);
|
85
|
+
|
73
86
|
if (result && result.stderr) {
|
74
87
|
(0, _logger.messageLogger)('zip file not created', cssSelectorZipPath);
|
75
88
|
console.error(result.stderr);
|
76
89
|
} else {
|
77
90
|
(0, _logger.messageLogger)('zip file created', cssSelectorZipPath);
|
78
91
|
}
|
79
|
-
}
|
80
|
-
|
81
|
-
// npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
82
|
-
|
92
|
+
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
83
93
|
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
84
94
|
|
95
|
+
|
85
96
|
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
97
|
+
|
86
98
|
function getPaths() {
|
87
99
|
return {
|
88
100
|
zipname,
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
|
4
|
-
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
5
7
|
(0, _docsServerCore.default)();
|
@@ -4,17 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
8
10
|
var _https = _interopRequireDefault(require("https"));
|
11
|
+
|
9
12
|
var _webpack = _interopRequireDefault(require("webpack"));
|
13
|
+
|
10
14
|
var _express = _interopRequireDefault(require("express"));
|
15
|
+
|
11
16
|
var _child_process = require("child_process");
|
17
|
+
|
12
18
|
var _webpackDevMiddleware = _interopRequireDefault(require("webpack-dev-middleware"));
|
19
|
+
|
13
20
|
var _HMRMiddleware = _interopRequireDefault(require("../middlewares/HMRMiddleware"));
|
21
|
+
|
14
22
|
var _utils = require("../utils");
|
23
|
+
|
15
24
|
var _webpackDocs = _interopRequireDefault(require("../configs/webpack.docs.config"));
|
25
|
+
|
16
26
|
var _httpsOptions = require("./httpsOptions");
|
17
|
-
|
27
|
+
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
|
+
|
18
30
|
// import fs from 'fs';
|
19
31
|
var _default = isSSTest => {
|
20
32
|
const options = (0, _utils.getOptions)();
|
@@ -70,33 +82,41 @@ var _default = isSSTest => {
|
|
70
82
|
version: require('../../package.json').version
|
71
83
|
});
|
72
84
|
});
|
85
|
+
|
73
86
|
if (branch) {
|
74
87
|
app.post('/repo/merge', (req, res) => {
|
75
88
|
const {
|
76
89
|
ref
|
77
90
|
} = req.body;
|
91
|
+
|
78
92
|
if (ref && ref.endsWith(branch)) {
|
79
93
|
(0, _child_process.spawnSync)('git', ['pull', 'origin', branch], {
|
80
94
|
stdio: 'inherit'
|
81
95
|
});
|
82
96
|
}
|
97
|
+
|
83
98
|
res.send('done');
|
84
99
|
});
|
85
100
|
}
|
101
|
+
|
86
102
|
const httpsServer = _https.default.createServer(httpsOptions, app);
|
103
|
+
|
87
104
|
if (!isSSTest) {
|
88
105
|
httpsServer.listen(port, err => {
|
89
106
|
if (err) {
|
90
107
|
throw err;
|
91
108
|
}
|
109
|
+
|
92
110
|
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'htt' + 'ps')}/docs/`);
|
93
111
|
});
|
94
112
|
}
|
113
|
+
|
95
114
|
const httpPort = Number(port) + 1;
|
96
115
|
const http = app.listen(httpPort, err => {
|
97
116
|
if (err) {
|
98
117
|
throw err;
|
99
118
|
}
|
119
|
+
|
100
120
|
if (isSSTest) {
|
101
121
|
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(Object.assign(server, {
|
102
122
|
host: iphost,
|
@@ -118,4 +138,5 @@ var _default = isSSTest => {
|
|
118
138
|
wdm
|
119
139
|
};
|
120
140
|
};
|
141
|
+
|
121
142
|
exports.default = _default;
|
@@ -4,14 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getCliPath = getCliPath;
|
7
|
+
|
7
8
|
var _path = require("path");
|
9
|
+
|
8
10
|
var _os = require("os");
|
11
|
+
|
9
12
|
var _fs = require("fs");
|
13
|
+
|
10
14
|
var _constants = require("../constants");
|
15
|
+
|
11
16
|
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
17
|
+
|
12
18
|
const _getCliPath = libName => (0, _path.join)(_constants.cliNodeModulesPath, '.bin', libName);
|
19
|
+
|
13
20
|
const suffixExt = isWindows ? '.cmd' : '';
|
21
|
+
|
14
22
|
function getCliPath(libName) {
|
15
23
|
const cliPath = _getCliPath(libName + suffixExt);
|
24
|
+
|
16
25
|
return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
|
17
26
|
}
|
@@ -1,9 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
4
5
|
var _express = _interopRequireDefault(require("express"));
|
6
|
+
|
5
7
|
var _utils = require("../utils");
|
6
|
-
|
8
|
+
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
|
7
11
|
let options = (0, _utils.getOptions)();
|
8
12
|
let {
|
9
13
|
help: {
|
@@ -20,5 +24,6 @@ app.listen(port, err => {
|
|
20
24
|
if (err) {
|
21
25
|
throw err;
|
22
26
|
}
|
27
|
+
|
23
28
|
(0, _utils.log)(`Listening at ${serverUrl}/help/`);
|
24
29
|
});
|
@@ -5,22 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.httpsOptions = httpsOptions;
|
7
7
|
exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
|
8
|
+
|
8
9
|
var _logger = require("../logger");
|
10
|
+
|
9
11
|
var _requireLocalOrGlobal = require("./requireLocalOrGlobal");
|
12
|
+
|
10
13
|
const globalCertificate = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk-private/client_dev_cert');
|
14
|
+
|
11
15
|
function httpsOptions(options) {
|
12
16
|
const {
|
13
17
|
httpsCerts
|
14
18
|
} = options.app.server;
|
15
|
-
const certificate = (0, _requireLocalOrGlobal.requireLocalOrGlobal)(httpsCerts);
|
16
|
-
// TODO: in future we may do some version based check. certificate.version
|
19
|
+
const certificate = (0, _requireLocalOrGlobal.requireLocalOrGlobal)(httpsCerts); // TODO: in future we may do some version based check. certificate.version
|
17
20
|
|
18
21
|
return certificate.httpsOptions;
|
19
22
|
}
|
23
|
+
|
20
24
|
function httpsOptionsWithUserFriendlyError(options) {
|
21
25
|
const {
|
22
26
|
httpsCerts
|
23
27
|
} = options.app.server;
|
28
|
+
|
24
29
|
if (typeof httpsCerts === 'string' && httpsCerts) {
|
25
30
|
try {
|
26
31
|
const certificate = httpsOptions(options);
|
@@ -31,6 +36,7 @@ function httpsOptionsWithUserFriendlyError(options) {
|
|
31
36
|
} else {
|
32
37
|
(0, _logger.errorLogger)(error);
|
33
38
|
}
|
39
|
+
|
34
40
|
process.exit(0);
|
35
41
|
}
|
36
42
|
} else if (globalCertificate) {
|
@@ -1,10 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _express = _interopRequireDefault(require("express"));
|
4
|
+
|
4
5
|
var _gitlab = require("gitlab");
|
6
|
+
|
5
7
|
var _esprima = _interopRequireDefault(require("esprima"));
|
8
|
+
|
6
9
|
var _utils = require("../utils");
|
7
|
-
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
8
13
|
let options = (0, _utils.getOptions)();
|
9
14
|
let {
|
10
15
|
impact: {
|
@@ -24,28 +29,35 @@ app.use(_express.default.json());
|
|
24
29
|
app.use(_express.default.urlencoded({
|
25
30
|
extended: true
|
26
31
|
}));
|
32
|
+
|
27
33
|
function traverseJSON(parsed, file) {
|
28
34
|
let parsedObj = {};
|
29
35
|
parsed.forEach(Block => {
|
30
36
|
if (Block.type === 'FunctionDeclaration' || Block.type === 'ExportDefaultDeclaration' || Block.type === 'ExportNamedDeclaration') {
|
31
37
|
let ParsedTemp;
|
38
|
+
|
32
39
|
if (Block.type === 'FunctionDeclaration') {
|
33
40
|
ParsedTemp = Block;
|
34
41
|
} else {
|
35
42
|
ParsedTemp = Block.declaration;
|
36
43
|
}
|
44
|
+
|
37
45
|
if (ParsedTemp) {
|
38
46
|
if (ParsedTemp.id) {
|
39
47
|
let funcname = ParsedTemp.id.name;
|
48
|
+
|
40
49
|
if (funcname !== 'mapStateToProps') {
|
41
50
|
if (!funcname.includes('_')) {
|
42
51
|
if (!Object.prototype.hasOwnProperty.call(parsedObj, 'file')) {
|
43
52
|
parsedObj[file] = {};
|
44
53
|
}
|
54
|
+
|
45
55
|
let tempArray = [];
|
56
|
+
|
46
57
|
for (let j = ParsedTemp.loc.start.line; j < ParsedTemp.loc.end.line; j++) {
|
47
58
|
tempArray.push(j);
|
48
59
|
}
|
60
|
+
|
49
61
|
parsedObj[file][funcname] = tempArray;
|
50
62
|
}
|
51
63
|
}
|
@@ -55,6 +67,7 @@ function traverseJSON(parsed, file) {
|
|
55
67
|
});
|
56
68
|
return parsedObj;
|
57
69
|
}
|
70
|
+
|
58
71
|
function getDetails(url, callback) {
|
59
72
|
let changeObj = {};
|
60
73
|
let compObj = {};
|
@@ -62,6 +75,7 @@ function getDetails(url, callback) {
|
|
62
75
|
url
|
63
76
|
}).then(res => {
|
64
77
|
let body = JSON.parse(res.body);
|
78
|
+
|
65
79
|
if (body.includes('Source_Changeset')) {
|
66
80
|
let branch, changeSet;
|
67
81
|
body = body.split('\n');
|
@@ -70,15 +84,16 @@ function getDetails(url, callback) {
|
|
70
84
|
let [, __changeSet] = content.split('=');
|
71
85
|
changeSet = __changeSet;
|
72
86
|
}
|
87
|
+
|
73
88
|
if (content.includes('SourceCoLabel')) {
|
74
89
|
let [__branch] = content.split('=');
|
75
90
|
branch = __branch;
|
76
91
|
}
|
77
92
|
});
|
78
|
-
services.Commits.diff(1143, changeSet
|
79
|
-
//'587efd32ce14620750a38ab74bc744fc52f2943a '
|
93
|
+
services.Commits.diff(1143, changeSet //'587efd32ce14620750a38ab74bc744fc52f2943a '
|
80
94
|
).then(result => {
|
81
95
|
let promises = [];
|
96
|
+
|
82
97
|
if (result) {
|
83
98
|
result.forEach(change => {
|
84
99
|
let p = new Promise(resolve => {
|
@@ -96,22 +111,27 @@ function getDetails(url, callback) {
|
|
96
111
|
tempObj.changedId = null;
|
97
112
|
}
|
98
113
|
}
|
114
|
+
|
99
115
|
if (!diff.indexOf('-')) {
|
100
116
|
//eslint-disable-next-line
|
101
117
|
tempObj.defaultId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
|
102
118
|
let tempIndex = diffList.indexOf(diff);
|
119
|
+
|
103
120
|
if (diffList[tempIndex + 1].indexOf('data-id') === -1) {
|
104
121
|
tempObj.changedId = null;
|
105
122
|
}
|
106
123
|
}
|
124
|
+
|
107
125
|
if (!diff.indexOf('+')) {
|
108
126
|
//eslint-disable-next-line
|
109
127
|
tempObj.changedId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
|
110
128
|
let tempIndex = diffList.indexOf(diff);
|
129
|
+
|
111
130
|
if (diffList[tempIndex - 1].indexOf('data-id') === -1) {
|
112
131
|
tempObj.defaultId = null;
|
113
132
|
}
|
114
133
|
}
|
134
|
+
|
115
135
|
if (Object.prototype.hasOwnProperty.call(tempObj, 'defaultId') && Object.prototype.hasOwnProperty.call(tempObj, 'changedId')) {
|
116
136
|
if (tempObj.defaultId !== tempObj.changedId) {
|
117
137
|
compObj[filename].push(tempObj);
|
@@ -119,31 +139,39 @@ function getDetails(url, callback) {
|
|
119
139
|
}
|
120
140
|
}
|
121
141
|
}
|
142
|
+
|
122
143
|
if (diff.startsWith('@')) {
|
123
144
|
let [, content] = diff.split('@@');
|
124
145
|
let tempList = content.split(' ');
|
125
146
|
let startingLine = parseInt(tempList[1].split(',')[0]) * -1 + 3;
|
126
147
|
let furtherLines = parseInt(tempList[2].split(',')[0]) + 3;
|
148
|
+
|
127
149
|
if (parseInt(tempList[1].split(',')[1]) > 6) {
|
128
150
|
changeObj[filename].push(startingLine);
|
129
151
|
}
|
152
|
+
|
130
153
|
if (parseInt(tempList[2].split(',')[1]) > 6) {
|
131
154
|
let endValue = parseInt(tempList[2].split(',')[1]) - 6;
|
155
|
+
|
132
156
|
for (let i = furtherLines; i < furtherLines + endValue; i++) {
|
133
157
|
changeObj[filename].push(i);
|
134
158
|
}
|
135
159
|
}
|
136
160
|
}
|
137
161
|
});
|
162
|
+
|
138
163
|
if (!filename.includes('.spec.js') && !filename.includes('.docs.js') && !filename.includes('.css') && filename.includes('.js')) {
|
139
164
|
try {
|
140
165
|
services.RepositoryFiles.show(1143, filename, branch).then(res => {
|
141
166
|
let code = Buffer.from(res.content, 'base64').toString('ascii');
|
167
|
+
|
142
168
|
let parsed = _esprima.default.parseModule(code, {
|
143
169
|
jsx: true,
|
144
170
|
loc: true
|
145
171
|
});
|
172
|
+
|
146
173
|
let methodDetail = traverseJSON(parsed.body, filename);
|
174
|
+
|
147
175
|
if (Object.keys(methodDetail).length) {
|
148
176
|
resolve(methodDetail);
|
149
177
|
} else {
|
@@ -167,6 +195,7 @@ function getDetails(url, callback) {
|
|
167
195
|
}
|
168
196
|
}).catch(err => err);
|
169
197
|
}
|
198
|
+
|
170
199
|
app.post('/impact/build', (req, res) => {
|
171
200
|
req.setTimeout(0);
|
172
201
|
let subUrl = '/logs/reactbuildinfo.txt';
|
@@ -179,6 +208,7 @@ app.post('/impact/build', (req, res) => {
|
|
179
208
|
if (err) {
|
180
209
|
return err;
|
181
210
|
}
|
211
|
+
|
182
212
|
let responseObj = {};
|
183
213
|
Object.keys(esprimaObj).forEach(file => {
|
184
214
|
responseObj[file] = [];
|
@@ -191,6 +221,7 @@ app.post('/impact/build', (req, res) => {
|
|
191
221
|
}
|
192
222
|
});
|
193
223
|
});
|
224
|
+
|
194
225
|
if (!responseObj[file].length) {
|
195
226
|
delete responseObj[file];
|
196
227
|
}
|
@@ -207,6 +238,7 @@ app.listen(port, err => {
|
|
207
238
|
if (err) {
|
208
239
|
throw err;
|
209
240
|
}
|
241
|
+
|
210
242
|
(0, _utils.log)(`Listening at ${serverUrl}/impact/build/`);
|
211
243
|
(0, _utils.log)('payload like => {buildUrl:test_build_url}');
|
212
244
|
});
|
@@ -1,10 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _express = _interopRequireDefault(require("express"));
|
4
|
+
|
4
5
|
var _fs = _interopRequireDefault(require("fs"));
|
6
|
+
|
5
7
|
var _path = _interopRequireDefault(require("path"));
|
8
|
+
|
6
9
|
var _utils = require("../utils");
|
7
|
-
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
8
13
|
let options = (0, _utils.getOptions)();
|
9
14
|
let {
|
10
15
|
app: {
|
@@ -19,13 +24,17 @@ app.use(_express.default.urlencoded({
|
|
19
24
|
extended: true
|
20
25
|
}));
|
21
26
|
let appPath = process.cwd();
|
27
|
+
|
22
28
|
let mockServerPath = _path.default.join(appPath, 'mockapi', 'index.js');
|
29
|
+
|
23
30
|
if (_fs.default.existsSync(mockServerPath)) {
|
24
31
|
let mockServer = require(mockServerPath);
|
32
|
+
|
25
33
|
mockServer(app);
|
26
34
|
} else {
|
27
35
|
(0, _utils.log)('You must export a function from mockapi folder by only we can provide mock api hook');
|
28
36
|
}
|
37
|
+
|
29
38
|
app.listen(mockPort, err => {
|
30
39
|
if (err) {
|
31
40
|
(0, _utils.log)('error', err);
|