@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/utils/fileUtils.js
CHANGED
@@ -4,21 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.copy = void 0;
|
7
|
+
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
8
10
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
9
12
|
var _index = require("./index");
|
13
|
+
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
11
16
|
let removeDirectory = dirPath => {
|
12
17
|
_fs.default.readdirSync(dirPath).forEach(fileOrDir => {
|
13
18
|
let fileOrDirPath = _path.default.join(dirPath, fileOrDir);
|
19
|
+
|
14
20
|
if (_fs.default.statSync(fileOrDirPath).isDirectory()) {
|
15
21
|
removeDirectory(fileOrDirPath);
|
16
22
|
} else {
|
17
23
|
_fs.default.unlinkSync(fileOrDirPath);
|
18
24
|
}
|
19
25
|
});
|
26
|
+
|
20
27
|
_fs.default.rmdirSync(dirPath);
|
21
28
|
};
|
29
|
+
|
22
30
|
let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
23
31
|
let {
|
24
32
|
ext,
|
@@ -26,6 +34,7 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
26
34
|
name,
|
27
35
|
root
|
28
36
|
} = _path.default.parse(targetPath);
|
37
|
+
|
29
38
|
if (changeExt[ext]) {
|
30
39
|
ext = changeExt[ext];
|
31
40
|
targetPath = _path.default.format({
|
@@ -37,7 +46,9 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
37
46
|
}
|
38
47
|
|
39
48
|
let readStream = _fs.default.createReadStream(srcPath);
|
49
|
+
|
40
50
|
let writeStream = _fs.default.createWriteStream(targetPath);
|
51
|
+
|
41
52
|
readStream.pipe(writeStream);
|
42
53
|
writeStream.on('finish', () => {
|
43
54
|
if (!isCopy) {
|
@@ -45,23 +56,29 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
45
56
|
}
|
46
57
|
});
|
47
58
|
};
|
59
|
+
|
48
60
|
let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, changeExt) => {
|
49
61
|
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
50
62
|
let fromPath = _path.default.join(srcPath, fileOrDir);
|
63
|
+
|
51
64
|
let toPath = targetPath;
|
65
|
+
|
52
66
|
if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
|
53
67
|
toPath = _path.default.join(targetPath, fileOrDir);
|
54
68
|
}
|
69
|
+
|
55
70
|
if (_fs.default.statSync(fromPath).isDirectory()) {
|
56
71
|
if (!_fs.default.existsSync(toPath)) {
|
57
72
|
_fs.default.mkdirSync(toPath);
|
58
73
|
}
|
74
|
+
|
59
75
|
iterateDirectory(fromPath, toPath, isCopy, extensions, flatten, changeExt);
|
60
76
|
} else {
|
61
77
|
if (extensions) {
|
62
78
|
let {
|
63
79
|
ext
|
64
80
|
} = _path.default.parse(fromPath);
|
81
|
+
|
65
82
|
if (extensions.indexOf(ext) !== -1) {
|
66
83
|
copyFile(fromPath, toPath, true, changeExt);
|
67
84
|
}
|
@@ -71,29 +88,38 @@ let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, change
|
|
71
88
|
}
|
72
89
|
});
|
73
90
|
};
|
91
|
+
|
74
92
|
let copy = (srcPath, targetPath, isCopy, exts, flatten, changeExt = {}) => {
|
75
93
|
if (_fs.default.statSync(srcPath).isDirectory()) {
|
76
94
|
if (!_fs.default.existsSync(targetPath)) {
|
77
95
|
_fs.default.mkdirSync(targetPath);
|
78
96
|
}
|
97
|
+
|
79
98
|
let {
|
80
99
|
name
|
81
100
|
} = _path.default.parse(srcPath);
|
101
|
+
|
82
102
|
let originPath = targetPath;
|
103
|
+
|
83
104
|
if (flatten !== 'flatten') {
|
84
105
|
originPath = _path.default.join(targetPath, name);
|
106
|
+
|
85
107
|
if (!_fs.default.existsSync(originPath)) {
|
86
108
|
_fs.default.mkdirSync(originPath);
|
87
109
|
}
|
88
110
|
}
|
111
|
+
|
89
112
|
iterateDirectory(srcPath, originPath, isCopy, exts, flatten, changeExt);
|
90
113
|
} else {
|
91
114
|
/* direct file copy issue there but that feature not needed i think*/
|
92
115
|
copyFile(srcPath, targetPath, isCopy, changeExt);
|
93
116
|
}
|
117
|
+
|
94
118
|
if (!isCopy) {
|
95
119
|
removeDirectory(srcPath);
|
96
120
|
}
|
121
|
+
|
97
122
|
(0, _index.log)(isCopy ? 'Folder/file are copied!' : 'Folder/file are moved!');
|
98
123
|
};
|
124
|
+
|
99
125
|
exports.copy = copy;
|
@@ -4,26 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
8
10
|
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
|
11
15
|
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
12
16
|
let fromPath = _path.default.join(srcPath, fileOrDir);
|
17
|
+
|
13
18
|
let toPath = targetPath;
|
19
|
+
|
14
20
|
if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
|
15
21
|
toPath = _path.default.join(targetPath, fileOrDir);
|
16
22
|
}
|
23
|
+
|
17
24
|
if (_fs.default.statSync(fromPath).isDirectory()) {
|
18
25
|
if (!_fs.default.existsSync(toPath)) {
|
19
26
|
_fs.default.mkdirSync(toPath);
|
20
27
|
}
|
28
|
+
|
21
29
|
iterateDirectory(fromPath, toPath, extensions, flatten, cb);
|
22
30
|
} else {
|
23
31
|
if (extensions) {
|
24
32
|
let {
|
25
33
|
ext
|
26
34
|
} = _path.default.parse(fromPath);
|
35
|
+
|
27
36
|
if (extensions.indexOf(ext) !== -1) {
|
28
37
|
cb(fromPath, toPath);
|
29
38
|
}
|
@@ -33,5 +42,6 @@ let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
|
|
33
42
|
}
|
34
43
|
});
|
35
44
|
};
|
45
|
+
|
36
46
|
var _default = iterateDirectory;
|
37
47
|
exports.default = _default;
|
@@ -4,20 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
let eliminateDuplicates = inputList => {
|
8
9
|
let outputList = [];
|
9
10
|
let tempObj = {};
|
11
|
+
|
10
12
|
for (let i = 0; i < inputList.length; i++) {
|
11
13
|
tempObj[inputList[i]] = 1;
|
12
14
|
}
|
15
|
+
|
13
16
|
for (let j in tempObj) {
|
14
17
|
if (tempObj[j]) {
|
15
18
|
outputList.push(j);
|
16
19
|
}
|
17
20
|
}
|
21
|
+
|
18
22
|
outputList = outputList.filter(item => item);
|
19
23
|
return outputList;
|
20
24
|
};
|
25
|
+
|
21
26
|
let removeExtn = componentObjectList => {
|
22
27
|
let fileNameArray = [];
|
23
28
|
componentObjectList.forEach(fileObject => {
|
@@ -26,31 +31,41 @@ let removeExtn = componentObjectList => {
|
|
26
31
|
});
|
27
32
|
return fileNameArray;
|
28
33
|
};
|
34
|
+
|
29
35
|
let getChangedFileName = impactedObject => {
|
30
36
|
let changedComponentsList = [];
|
37
|
+
|
31
38
|
if (impactedObject.ADDED && impactedObject.ADDED.length) {
|
32
39
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.ADDED));
|
33
40
|
}
|
41
|
+
|
34
42
|
if (impactedObject.UPDATED && impactedObject.UPDATED.length) {
|
35
43
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.UPDATED));
|
36
44
|
}
|
45
|
+
|
37
46
|
if (impactedObject.REMOVED && impactedObject.REMOVED.length) {
|
38
47
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.REMOVED));
|
39
48
|
}
|
49
|
+
|
40
50
|
return changedComponentsList;
|
41
51
|
};
|
52
|
+
|
42
53
|
let referencedbyList = [];
|
54
|
+
|
43
55
|
let getReferencedBy = (moduleDataObject, fileName) => {
|
44
56
|
if (moduleDataObject[fileName]) {
|
45
57
|
let referenceObject = moduleDataObject[fileName];
|
46
58
|
let referencedbyObject = referenceObject.referencedby;
|
59
|
+
|
47
60
|
if (referencedbyObject.length) {
|
48
61
|
if (!referencedbyList.includes(referenceObject.docsName)) {
|
49
62
|
referencedbyList.push(referenceObject.docsName);
|
50
63
|
}
|
64
|
+
|
51
65
|
referencedbyObject.forEach(referencedByFile => {
|
52
66
|
if (!referencedbyList.includes(moduleDataObject[referencedByFile].docsName)) {
|
53
67
|
let result = getReferencedBy(moduleDataObject, referencedByFile);
|
68
|
+
|
54
69
|
if (typeof result === 'string') {
|
55
70
|
referencedbyList.push(result);
|
56
71
|
}
|
@@ -60,8 +75,10 @@ let getReferencedBy = (moduleDataObject, fileName) => {
|
|
60
75
|
return fileName;
|
61
76
|
}
|
62
77
|
}
|
78
|
+
|
63
79
|
return referencedbyList;
|
64
80
|
};
|
81
|
+
|
65
82
|
let checkDocs = AppComponentObject => {
|
66
83
|
let unDocsComponentNameList = [];
|
67
84
|
Object.keys(AppComponentObject).forEach(actionKey => {
|
@@ -79,6 +96,7 @@ let checkDocs = AppComponentObject => {
|
|
79
96
|
});
|
80
97
|
return unDocsComponentNameList;
|
81
98
|
};
|
99
|
+
|
82
100
|
var _default = (mDataStr, ComponentObj) => {
|
83
101
|
let mDataObject = JSON.parse(mDataStr);
|
84
102
|
let impactedComponentList = [];
|
@@ -87,9 +105,11 @@ var _default = (mDataStr, ComponentObj) => {
|
|
87
105
|
if (libraryName === 'AppSource') {
|
88
106
|
unDocsComList = checkDocs(ComponentObj[libraryName]);
|
89
107
|
}
|
108
|
+
|
90
109
|
let totalChangedFilesList = getChangedFileName(ComponentObj[libraryName]);
|
91
110
|
totalChangedFilesList.forEach(changedFileName => {
|
92
111
|
let referencedByComponents = getReferencedBy(mDataObject, changedFileName);
|
112
|
+
|
93
113
|
if (Array.isArray(referencedByComponents)) {
|
94
114
|
impactedComponentList = impactedComponentList.concat(referencedByComponents);
|
95
115
|
} else if (typeof referencedByComponents === 'string') {
|
@@ -102,4 +122,5 @@ var _default = (mDataStr, ComponentObj) => {
|
|
102
122
|
unDocsComList: unDocsComList
|
103
123
|
};
|
104
124
|
};
|
125
|
+
|
105
126
|
exports.default = _default;
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _child_process = require("child_process");
|
9
|
+
|
8
10
|
var _default = (type = 'git', cwd = process.cwd()) => {
|
9
11
|
let results;
|
12
|
+
|
10
13
|
if (type === 'git') {
|
11
14
|
results = (0, _child_process.spawnSync)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
12
15
|
encoding: 'utf8',
|
@@ -18,7 +21,9 @@ var _default = (type = 'git', cwd = process.cwd()) => {
|
|
18
21
|
cwd
|
19
22
|
});
|
20
23
|
}
|
24
|
+
|
21
25
|
let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
|
22
26
|
return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
|
23
27
|
};
|
28
|
+
|
24
29
|
exports.default = _default;
|
@@ -4,19 +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 _request = _interopRequireDefault(require("./request"));
|
11
|
+
|
9
12
|
var _libraryImpactConfig = _interopRequireDefault(require("./libraryImpactConfig"));
|
13
|
+
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
11
16
|
let dependencies = ['@zohodesk/components', '@zohodesk/dot', '@zohodesk/icons', '@zohodesk/svg', '@zohodesk/variables'];
|
17
|
+
|
12
18
|
let getCurrentDependenciesInfo = () => {
|
13
19
|
let packageJson = require(_path.default.join(process.cwd(), 'package.json'));
|
20
|
+
|
14
21
|
let info = {};
|
22
|
+
|
15
23
|
for (let dependency of dependencies) {
|
16
24
|
info[dependency] = packageJson.dependencies[dependency];
|
17
25
|
}
|
26
|
+
|
18
27
|
return info;
|
19
28
|
};
|
29
|
+
|
20
30
|
let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject) => {
|
21
31
|
let url = `${'ht'}${'tps'}://zgit.csez.zohocorpin.com/api/v4/projects/1143/repository/files/jsapps%2Fsupportapp%2Fpackage.json?ref=${branch}`;
|
22
32
|
(0, _request.default)({
|
@@ -32,12 +42,15 @@ let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject
|
|
32
42
|
dependencies: depend
|
33
43
|
} = JSON.parse(Buffer.from(content, 'base64').toString());
|
34
44
|
let info = {};
|
45
|
+
|
35
46
|
for (let dependency of dependencies) {
|
36
47
|
info[dependency] = depend[dependency];
|
37
48
|
}
|
49
|
+
|
38
50
|
resolve(info);
|
39
51
|
}).catch(reject);
|
40
52
|
});
|
53
|
+
|
41
54
|
let getDependencyChangeset = (dependency, version) => {
|
42
55
|
return new Promise(resolve => {
|
43
56
|
let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
|
@@ -49,10 +62,12 @@ let getDependencyChangeset = (dependency, version) => {
|
|
49
62
|
if (body == "") {
|
50
63
|
console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
|
51
64
|
}
|
65
|
+
|
52
66
|
resolve(body);
|
53
67
|
});
|
54
68
|
});
|
55
69
|
};
|
70
|
+
|
56
71
|
let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
|
57
72
|
let diff = {
|
58
73
|
[appName]: {}
|
@@ -77,9 +92,11 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
|
|
77
92
|
name,
|
78
93
|
ext
|
79
94
|
} = _path.default.parse(FILEPATH);
|
95
|
+
|
80
96
|
if (!diff[appName][key]) {
|
81
97
|
diff[appName][key] = [];
|
82
98
|
}
|
99
|
+
|
83
100
|
diff[appName][key].push({
|
84
101
|
name: name + ext,
|
85
102
|
FILEPATH
|
@@ -90,11 +107,13 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
|
|
90
107
|
resolve(diff);
|
91
108
|
});
|
92
109
|
});
|
110
|
+
|
93
111
|
var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary') => new Promise(resolve => {
|
94
112
|
let currentDependencies = getCurrentDependenciesInfo();
|
95
113
|
getLiveDependenciesInfo(liveBranch, tokenGit).then(liveDependencies => {
|
96
114
|
let diff = {};
|
97
115
|
let promises = [];
|
116
|
+
|
98
117
|
for (let dependency of dependencies) {
|
99
118
|
promises.push(new Promise(resolve => {
|
100
119
|
if (currentDependencies[dependency] !== liveDependencies[dependency]) {
|
@@ -114,6 +133,7 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
|
|
114
133
|
}
|
115
134
|
}));
|
116
135
|
}
|
136
|
+
|
117
137
|
promises.push(new Promise(resolve => {
|
118
138
|
getImpactDiff(srcBranch, liveBranch, 'AppSource').then(impacts => {
|
119
139
|
Object.assign(diff, impacts);
|
@@ -127,4 +147,5 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
|
|
127
147
|
throw e;
|
128
148
|
});
|
129
149
|
});
|
150
|
+
|
130
151
|
exports.default = _default;
|
package/lib/utils/getHash.js
CHANGED
@@ -4,15 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = getHash;
|
7
|
+
|
7
8
|
var _crypto = _interopRequireDefault(require("crypto"));
|
9
|
+
|
8
10
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
function getHash(file, size = 20, isPath = false) {
|
11
15
|
let hash = _crypto.default.createHash('md5');
|
16
|
+
|
12
17
|
let fileNew = file;
|
18
|
+
|
13
19
|
if (isPath) {
|
14
20
|
fileNew = _fs.default.readFileSync(file);
|
15
21
|
}
|
22
|
+
|
16
23
|
hash.update(fileNew);
|
17
24
|
hash = hash.digest('hex');
|
18
25
|
return hash ? hash.substring(0, size) : null;
|
package/lib/utils/getIp.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
let os = require('os');
|
4
|
+
|
4
5
|
module.exports = function getIP() {
|
5
6
|
let ifaces = os.networkInterfaces();
|
6
7
|
let ips = [];
|
@@ -9,6 +10,7 @@ module.exports = function getIP() {
|
|
9
10
|
if ('IPv4' !== iface.family || iface.internal !== false) {
|
10
11
|
return null;
|
11
12
|
}
|
13
|
+
|
12
14
|
return iface.address;
|
13
15
|
}).filter(a => a);
|
14
16
|
ips = ips.concat(a);
|
package/lib/utils/getOptions.js
CHANGED
@@ -4,21 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _child_process = require("child_process");
|
9
|
+
|
8
10
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
9
12
|
var _path = _interopRequireDefault(require("path"));
|
13
|
+
|
10
14
|
var _schemas = _interopRequireDefault(require("../schemas"));
|
15
|
+
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
// import { argv } from 'process';
|
13
17
|
|
14
|
-
|
15
|
-
// console.log('argv', argv);
|
18
|
+
// import { argv } from 'process';
|
19
|
+
const args = process.argv.slice(2); // console.log('argv', argv);
|
16
20
|
|
17
|
-
const NPM_CONFIG_PREFIX = 'npm_config_';
|
18
|
-
// TODO: we have to do option parse logic little better
|
21
|
+
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
19
22
|
// if user use react-cli stritly without using npm scripts options won't work,
|
20
23
|
// So we have to write our own option parse logic or some other library
|
21
|
-
|
22
24
|
// console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
|
23
25
|
// console.log('Object.keys(process.env).filter(s => s.startsWith(\'npm_config_\') && s.includes(\'clone\')', Object.keys(process.env).filter(s => s.startsWith('npm_config_') && s.includes('clone')));
|
24
26
|
// // clone:type
|
@@ -32,24 +34,31 @@ Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEac
|
|
32
34
|
});
|
33
35
|
keysWithColon.forEach(key => {
|
34
36
|
let nkey = key.replace(/:/g, '_');
|
37
|
+
|
35
38
|
if (processEnv[nkey]) {
|
36
39
|
throw Error('there is some options conflict', key, nkey);
|
37
40
|
}
|
41
|
+
|
38
42
|
processEnv[nkey] = processEnv[key];
|
39
43
|
});
|
44
|
+
|
40
45
|
function getNpmVersion() {
|
41
46
|
// require("child_process").
|
42
47
|
let vers = '6';
|
48
|
+
|
43
49
|
try {
|
44
50
|
[vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
|
45
51
|
} catch (error) {
|
46
52
|
console.log(error);
|
47
53
|
}
|
54
|
+
|
48
55
|
return vers;
|
49
56
|
}
|
57
|
+
|
50
58
|
function getCWD() {
|
51
59
|
// require("child_process").
|
52
60
|
let cwd = process.cwd();
|
61
|
+
|
53
62
|
try {
|
54
63
|
let ress = (0, _child_process.execSync)('npm bin').toString();
|
55
64
|
let i = ress.lastIndexOf('node_modules');
|
@@ -57,33 +66,39 @@ function getCWD() {
|
|
57
66
|
} catch (error) {
|
58
67
|
console.log(error);
|
59
68
|
}
|
69
|
+
|
60
70
|
return cwd;
|
61
|
-
}
|
71
|
+
} // experimental argumnet parsing logic
|
72
|
+
|
62
73
|
|
63
|
-
// experimental argumnet parsing logic
|
64
74
|
args.forEach(option => {
|
65
75
|
if (/^--./.test(option)) {
|
66
|
-
let equIndex = option.indexOf('=');
|
67
|
-
|
76
|
+
let equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
77
|
+
|
68
78
|
let key = option.slice(2, equIndex);
|
69
79
|
let value = option.slice(equIndex + 1);
|
80
|
+
|
70
81
|
if (equIndex === -1) {
|
71
82
|
key = option.slice(2);
|
72
83
|
value = true;
|
73
84
|
}
|
85
|
+
|
74
86
|
key = key.replace(/-|:/g, '_');
|
75
87
|
processEnv[key] = value;
|
76
88
|
}
|
77
89
|
});
|
90
|
+
|
78
91
|
let defaulter = (target, source) => {
|
79
92
|
let defaultObject = {};
|
80
93
|
Object.keys(target).forEach(key => {
|
81
94
|
let data = target[key];
|
95
|
+
|
82
96
|
if (data && typeof data === 'object') {
|
83
97
|
if (Array.isArray(data)) {
|
84
98
|
defaultObject[key] = source[key] || data;
|
85
99
|
} else if (typeof data.cli === 'string') {
|
86
100
|
let cliData;
|
101
|
+
|
87
102
|
if (typeof processEnv[data.cli] === 'string') {
|
88
103
|
cliData = processEnv[data.cli];
|
89
104
|
} else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
|
@@ -91,9 +106,11 @@ let defaulter = (target, source) => {
|
|
91
106
|
} else {
|
92
107
|
cliData = source && source[key] || data.value;
|
93
108
|
}
|
109
|
+
|
94
110
|
if (typeof data.value === 'boolean') {
|
95
111
|
cliData = cliData === 'true' || cliData === true ? true : cliData === 'false' || cliData === false || cliData === '' ? false : data.value;
|
96
112
|
}
|
113
|
+
|
97
114
|
defaultObject[key] = cliData;
|
98
115
|
} else {
|
99
116
|
defaultObject[key] = defaulter(data, source && source[key] ? source[key] : Array.isArray(target[key]) ? [] : {});
|
@@ -104,9 +121,8 @@ let defaulter = (target, source) => {
|
|
104
121
|
});
|
105
122
|
return defaultObject;
|
106
123
|
};
|
107
|
-
global.reactCLIOptions = null;
|
108
124
|
|
109
|
-
// function selectn(obj, key) {
|
125
|
+
global.reactCLIOptions = null; // function selectn(obj, key) {
|
110
126
|
// let temp = obj;
|
111
127
|
// let keys = key.split('.');
|
112
128
|
// for (let i = 0; i < keys.length; i++) {
|
@@ -121,28 +137,36 @@ function deprecationSupport(options) {
|
|
121
137
|
if (options.app.hasRTL === true) {
|
122
138
|
options.app.plugins.hasRTL = true;
|
123
139
|
}
|
140
|
+
|
124
141
|
if (options.docs.hasRTL === true) {
|
125
142
|
options.docs.plugins.hasRTL = true;
|
126
143
|
}
|
144
|
+
|
127
145
|
if (options.app.rtlExclude.length > 0) {
|
128
146
|
options.app.exclude.rtl = options.app.rtlExclude;
|
129
147
|
}
|
148
|
+
|
130
149
|
if (options.docs.rtlExclude.length > 0) {
|
131
150
|
options.docs.exclude.rtl = options.docs.rtlExclude;
|
132
151
|
}
|
133
152
|
}
|
153
|
+
|
134
154
|
let getOptions = () => {
|
135
155
|
if (global.reactCLIOptions) {
|
136
156
|
return global.reactCLIOptions;
|
137
157
|
}
|
158
|
+
|
138
159
|
let appPath = process.cwd();
|
139
160
|
let userSchemas;
|
161
|
+
|
140
162
|
let packagePath = _path.default.join(appPath, 'package.json');
|
163
|
+
|
141
164
|
if (_fs.default.existsSync(packagePath)) {
|
142
165
|
userSchemas = require(packagePath)['react-cli'] || {};
|
143
166
|
}
|
144
|
-
|
145
|
-
// for future may be for npm 8 edge cases
|
167
|
+
|
168
|
+
let options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
169
|
+
|
146
170
|
options.npmVersion = getNpmVersion();
|
147
171
|
options.cwd = getCWD();
|
148
172
|
deprecationSupport(options);
|
@@ -150,5 +174,6 @@ let getOptions = () => {
|
|
150
174
|
global.reactCLIOptions = options;
|
151
175
|
return options;
|
152
176
|
};
|
177
|
+
|
153
178
|
var _default = getOptions;
|
154
179
|
exports.default = _default;
|
@@ -4,25 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
let getServerURL = (serverInfo, protocol) => {
|
8
9
|
let {
|
9
10
|
host,
|
10
11
|
domain,
|
11
12
|
port
|
12
13
|
} = serverInfo;
|
14
|
+
|
13
15
|
if (protocol) {
|
14
16
|
if (protocol === 'ht' + 'tp') {
|
15
17
|
port = Number(port) + 1;
|
18
|
+
|
16
19
|
if (domain) {
|
17
20
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${Number(port) + 1}`;
|
18
21
|
}
|
22
|
+
|
19
23
|
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
20
24
|
}
|
21
25
|
}
|
26
|
+
|
22
27
|
if (domain) {
|
23
28
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${port}`;
|
24
29
|
}
|
30
|
+
|
25
31
|
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
26
32
|
};
|
33
|
+
|
27
34
|
var _default = getServerURL;
|
28
35
|
exports.default = _default;
|