@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -179
- package/.prettierrc +6 -6
- package/README.md +1028 -951
- package/bin/cli.js +483 -483
- 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/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- 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 +0 -4
- package/lib/babel/es-plugins-presets.js +0 -4
- package/lib/common/getEntries.js +0 -10
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +0 -5
- package/lib/common/splitChunks.js +2 -13
- package/lib/common/sslcertUpdater.js +6 -17
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +0 -15
- package/lib/configs/jest.config.js +8 -21
- package/lib/configs/libAlias.js +11 -2
- package/lib/configs/webpack.component.umd.config.js +0 -5
- package/lib/configs/webpack.css.umd.config.js +5 -13
- package/lib/configs/webpack.dev.config.js +13 -24
- package/lib/configs/webpack.docs.config.js +6 -12
- package/lib/configs/webpack.impact.config.js +6 -10
- package/lib/configs/webpack.prod.config.js +15 -26
- package/lib/hooks/docsProptypeHook.js +3 -7
- package/lib/jest/commitedFilesResult.js +3 -45
- package/lib/jest/coverageCollector.js +0 -11
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
- package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
- package/lib/jest/result.js +0 -22
- package/lib/jest/run.js +6 -17
- package/lib/jest/setup.js +5 -57
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
- package/lib/loaderUtils/getCSSLoaders.js +41 -28
- package/lib/loaderUtils/getDevJsLoaders.js +0 -8
- package/lib/loaderUtils/index.js +0 -3
- package/lib/loaders/docsLoader.js +0 -7
- package/lib/loaders/docsPropsLoader.js +3 -7
- package/lib/loaders/fileBountryLoader.js +0 -2
- package/lib/loaders/fileLoader.js +11 -22
- package/lib/loaders/scriptInstrumentLoader.js +5 -13
- package/lib/loaders/selectorMappingLoader.js +7 -25
- package/lib/loaders/workerLoader.js +13 -29
- package/lib/middlewares/HMRMiddleware.js +13 -26
- package/lib/middlewares/SSTMiddleware.js +0 -3
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
- package/lib/pluginUtils/getDevPlugins.js +20 -64
- package/lib/pluginUtils/getDocsPlugins.js +1 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
- package/lib/pluginUtils/getLibraryPlugins.js +0 -5
- package/lib/pluginUtils/getProdPlugins.js +32 -78
- package/lib/pluginUtils/getServerPlugins.js +0 -5
- package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
- package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
- package/lib/pluginUtils/index.js +0 -8
- package/lib/plugins/CdnChangePlugin.js +0 -14
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/EFCPlugin.js +23 -34
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +23 -32
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +70 -80
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
- package/lib/plugins/ManifestPlugin.js +0 -17
- package/lib/plugins/ModuleStatsPlugin.js +0 -23
- package/lib/plugins/OptimizeJSPlugin.js +0 -7
- package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
- package/lib/plugins/PublicPathChangePlugin.js +4 -36
- package/lib/plugins/ReportGeneratePlugin.js +4 -30
- package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
- package/lib/plugins/ResourceHintsPlugin.js +20 -27
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
- package/lib/plugins/ServiceWorkerPlugin.js +13 -29
- package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
- package/lib/plugins/SourceMapHookPlugin.js +0 -9
- package/lib/plugins/TPHashMappingPlugin.js +5 -19
- package/lib/plugins/UglifyCSSPlugin.js +0 -9
- package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
- package/lib/plugins/index.js +0 -19
- package/lib/plugins/libraryImpactPlugin.js +0 -32
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/ExcludePlugin.js +0 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
- package/lib/postcss-plugins/ValueReplacer.js +9 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
- package/lib/postcss-plugins/variableModifier.js +14 -20
- package/lib/schemas/index.js +28 -13
- package/lib/servers/clusterHubServer.js +0 -10
- package/lib/servers/devBuild.js +13 -24
- package/lib/servers/docsServer.js +0 -2
- package/lib/servers/docsServerCore.js +0 -21
- package/lib/servers/getCliPath.js +1 -10
- package/lib/servers/helpServer.js +0 -5
- package/lib/servers/httpsOptions.js +0 -4
- package/lib/servers/impactServer.js +2 -34
- package/lib/servers/mockserver.js +0 -9
- package/lib/servers/nowatchserver.js +12 -34
- package/lib/servers/scrServer.js +13 -20
- package/lib/servers/server.js +7 -35
- package/lib/servers/ssServer.js +0 -16
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +6 -12
- package/lib/utils/babelPresets.js +0 -2
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +2 -8
- package/lib/utils/copy.js +0 -6
- package/lib/utils/copyTimezones.js +0 -8
- package/lib/utils/createEventStream.js +0 -4
- package/lib/utils/cssClassNameGenerate.js +3 -19
- package/lib/utils/cssURLReplacer.js +0 -25
- package/lib/utils/dependencyPostPublish.js +0 -9
- package/lib/utils/fileUtils.js +0 -26
- package/lib/utils/folderIterator.js +0 -10
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +0 -21
- package/lib/utils/getHash.js +0 -7
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +38 -35
- package/lib/utils/getServerURL.js +0 -7
- package/lib/utils/index.js +2 -47
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +6 -29
- package/lib/utils/jsonHelper.js +2 -19
- package/lib/utils/libraryImpactConfig.js +0 -2
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/mailSender.js +0 -7
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +0 -28
- package/lib/utils/removeAttributes.js +0 -7
- package/lib/utils/repoClone.js +2 -27
- package/lib/utils/request.js +0 -12
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +4 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +0 -10
- package/lib/utils/switchBranch.js +0 -4
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/npm8.md +9 -9
- package/package.json +146 -148
- 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 -1493
- 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,29 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.copy = void 0;
|
7
|
-
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
var _index = require("./index");
|
13
|
-
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
11
|
let removeDirectory = dirPath => {
|
17
12
|
_fs.default.readdirSync(dirPath).forEach(fileOrDir => {
|
18
13
|
let fileOrDirPath = _path.default.join(dirPath, fileOrDir);
|
19
|
-
|
20
14
|
if (_fs.default.statSync(fileOrDirPath).isDirectory()) {
|
21
15
|
removeDirectory(fileOrDirPath);
|
22
16
|
} else {
|
23
17
|
_fs.default.unlinkSync(fileOrDirPath);
|
24
18
|
}
|
25
19
|
});
|
26
|
-
|
27
20
|
_fs.default.rmdirSync(dirPath);
|
28
21
|
};
|
29
|
-
|
30
22
|
let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
31
23
|
let {
|
32
24
|
ext,
|
@@ -34,7 +26,6 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
34
26
|
name,
|
35
27
|
root
|
36
28
|
} = _path.default.parse(targetPath);
|
37
|
-
|
38
29
|
if (changeExt[ext]) {
|
39
30
|
ext = changeExt[ext];
|
40
31
|
targetPath = _path.default.format({
|
@@ -46,9 +37,7 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
46
37
|
}
|
47
38
|
|
48
39
|
let readStream = _fs.default.createReadStream(srcPath);
|
49
|
-
|
50
40
|
let writeStream = _fs.default.createWriteStream(targetPath);
|
51
|
-
|
52
41
|
readStream.pipe(writeStream);
|
53
42
|
writeStream.on('finish', () => {
|
54
43
|
if (!isCopy) {
|
@@ -56,29 +45,23 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
|
|
56
45
|
}
|
57
46
|
});
|
58
47
|
};
|
59
|
-
|
60
48
|
let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, changeExt) => {
|
61
49
|
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
62
50
|
let fromPath = _path.default.join(srcPath, fileOrDir);
|
63
|
-
|
64
51
|
let toPath = targetPath;
|
65
|
-
|
66
52
|
if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
|
67
53
|
toPath = _path.default.join(targetPath, fileOrDir);
|
68
54
|
}
|
69
|
-
|
70
55
|
if (_fs.default.statSync(fromPath).isDirectory()) {
|
71
56
|
if (!_fs.default.existsSync(toPath)) {
|
72
57
|
_fs.default.mkdirSync(toPath);
|
73
58
|
}
|
74
|
-
|
75
59
|
iterateDirectory(fromPath, toPath, isCopy, extensions, flatten, changeExt);
|
76
60
|
} else {
|
77
61
|
if (extensions) {
|
78
62
|
let {
|
79
63
|
ext
|
80
64
|
} = _path.default.parse(fromPath);
|
81
|
-
|
82
65
|
if (extensions.indexOf(ext) !== -1) {
|
83
66
|
copyFile(fromPath, toPath, true, changeExt);
|
84
67
|
}
|
@@ -88,38 +71,29 @@ let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, change
|
|
88
71
|
}
|
89
72
|
});
|
90
73
|
};
|
91
|
-
|
92
74
|
let copy = (srcPath, targetPath, isCopy, exts, flatten, changeExt = {}) => {
|
93
75
|
if (_fs.default.statSync(srcPath).isDirectory()) {
|
94
76
|
if (!_fs.default.existsSync(targetPath)) {
|
95
77
|
_fs.default.mkdirSync(targetPath);
|
96
78
|
}
|
97
|
-
|
98
79
|
let {
|
99
80
|
name
|
100
81
|
} = _path.default.parse(srcPath);
|
101
|
-
|
102
82
|
let originPath = targetPath;
|
103
|
-
|
104
83
|
if (flatten !== 'flatten') {
|
105
84
|
originPath = _path.default.join(targetPath, name);
|
106
|
-
|
107
85
|
if (!_fs.default.existsSync(originPath)) {
|
108
86
|
_fs.default.mkdirSync(originPath);
|
109
87
|
}
|
110
88
|
}
|
111
|
-
|
112
89
|
iterateDirectory(srcPath, originPath, isCopy, exts, flatten, changeExt);
|
113
90
|
} else {
|
114
91
|
/* direct file copy issue there but that feature not needed i think*/
|
115
92
|
copyFile(srcPath, targetPath, isCopy, changeExt);
|
116
93
|
}
|
117
|
-
|
118
94
|
if (!isCopy) {
|
119
95
|
removeDirectory(srcPath);
|
120
96
|
}
|
121
|
-
|
122
97
|
(0, _index.log)(isCopy ? 'Folder/file are copied!' : 'Folder/file are moved!');
|
123
98
|
};
|
124
|
-
|
125
99
|
exports.copy = copy;
|
@@ -4,35 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _fs = _interopRequireDefault(require("fs"));
|
9
|
-
|
10
8
|
var _path = _interopRequireDefault(require("path"));
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
10
|
let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
|
15
11
|
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
16
12
|
let fromPath = _path.default.join(srcPath, fileOrDir);
|
17
|
-
|
18
13
|
let toPath = targetPath;
|
19
|
-
|
20
14
|
if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
|
21
15
|
toPath = _path.default.join(targetPath, fileOrDir);
|
22
16
|
}
|
23
|
-
|
24
17
|
if (_fs.default.statSync(fromPath).isDirectory()) {
|
25
18
|
if (!_fs.default.existsSync(toPath)) {
|
26
19
|
_fs.default.mkdirSync(toPath);
|
27
20
|
}
|
28
|
-
|
29
21
|
iterateDirectory(fromPath, toPath, extensions, flatten, cb);
|
30
22
|
} else {
|
31
23
|
if (extensions) {
|
32
24
|
let {
|
33
25
|
ext
|
34
26
|
} = _path.default.parse(fromPath);
|
35
|
-
|
36
27
|
if (extensions.indexOf(ext) !== -1) {
|
37
28
|
cb(fromPath, toPath);
|
38
29
|
}
|
@@ -42,6 +33,5 @@ let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
|
|
42
33
|
}
|
43
34
|
});
|
44
35
|
};
|
45
|
-
|
46
36
|
var _default = iterateDirectory;
|
47
37
|
exports.default = _default;
|
@@ -4,25 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
let eliminateDuplicates = inputList => {
|
9
8
|
let outputList = [];
|
10
9
|
let tempObj = {};
|
11
|
-
|
12
10
|
for (let i = 0; i < inputList.length; i++) {
|
13
11
|
tempObj[inputList[i]] = 1;
|
14
12
|
}
|
15
|
-
|
16
13
|
for (let j in tempObj) {
|
17
14
|
if (tempObj[j]) {
|
18
15
|
outputList.push(j);
|
19
16
|
}
|
20
17
|
}
|
21
|
-
|
22
18
|
outputList = outputList.filter(item => item);
|
23
19
|
return outputList;
|
24
20
|
};
|
25
|
-
|
26
21
|
let removeExtn = componentObjectList => {
|
27
22
|
let fileNameArray = [];
|
28
23
|
componentObjectList.forEach(fileObject => {
|
@@ -31,41 +26,31 @@ let removeExtn = componentObjectList => {
|
|
31
26
|
});
|
32
27
|
return fileNameArray;
|
33
28
|
};
|
34
|
-
|
35
29
|
let getChangedFileName = impactedObject => {
|
36
30
|
let changedComponentsList = [];
|
37
|
-
|
38
31
|
if (impactedObject.ADDED && impactedObject.ADDED.length) {
|
39
32
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.ADDED));
|
40
33
|
}
|
41
|
-
|
42
34
|
if (impactedObject.UPDATED && impactedObject.UPDATED.length) {
|
43
35
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.UPDATED));
|
44
36
|
}
|
45
|
-
|
46
37
|
if (impactedObject.REMOVED && impactedObject.REMOVED.length) {
|
47
38
|
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.REMOVED));
|
48
39
|
}
|
49
|
-
|
50
40
|
return changedComponentsList;
|
51
41
|
};
|
52
|
-
|
53
42
|
let referencedbyList = [];
|
54
|
-
|
55
43
|
let getReferencedBy = (moduleDataObject, fileName) => {
|
56
44
|
if (moduleDataObject[fileName]) {
|
57
45
|
let referenceObject = moduleDataObject[fileName];
|
58
46
|
let referencedbyObject = referenceObject.referencedby;
|
59
|
-
|
60
47
|
if (referencedbyObject.length) {
|
61
48
|
if (!referencedbyList.includes(referenceObject.docsName)) {
|
62
49
|
referencedbyList.push(referenceObject.docsName);
|
63
50
|
}
|
64
|
-
|
65
51
|
referencedbyObject.forEach(referencedByFile => {
|
66
52
|
if (!referencedbyList.includes(moduleDataObject[referencedByFile].docsName)) {
|
67
53
|
let result = getReferencedBy(moduleDataObject, referencedByFile);
|
68
|
-
|
69
54
|
if (typeof result === 'string') {
|
70
55
|
referencedbyList.push(result);
|
71
56
|
}
|
@@ -75,10 +60,8 @@ let getReferencedBy = (moduleDataObject, fileName) => {
|
|
75
60
|
return fileName;
|
76
61
|
}
|
77
62
|
}
|
78
|
-
|
79
63
|
return referencedbyList;
|
80
64
|
};
|
81
|
-
|
82
65
|
let checkDocs = AppComponentObject => {
|
83
66
|
let unDocsComponentNameList = [];
|
84
67
|
Object.keys(AppComponentObject).forEach(actionKey => {
|
@@ -96,7 +79,6 @@ let checkDocs = AppComponentObject => {
|
|
96
79
|
});
|
97
80
|
return unDocsComponentNameList;
|
98
81
|
};
|
99
|
-
|
100
82
|
var _default = (mDataStr, ComponentObj) => {
|
101
83
|
let mDataObject = JSON.parse(mDataStr);
|
102
84
|
let impactedComponentList = [];
|
@@ -105,11 +87,9 @@ var _default = (mDataStr, ComponentObj) => {
|
|
105
87
|
if (libraryName === 'AppSource') {
|
106
88
|
unDocsComList = checkDocs(ComponentObj[libraryName]);
|
107
89
|
}
|
108
|
-
|
109
90
|
let totalChangedFilesList = getChangedFileName(ComponentObj[libraryName]);
|
110
91
|
totalChangedFilesList.forEach(changedFileName => {
|
111
92
|
let referencedByComponents = getReferencedBy(mDataObject, changedFileName);
|
112
|
-
|
113
93
|
if (Array.isArray(referencedByComponents)) {
|
114
94
|
impactedComponentList = impactedComponentList.concat(referencedByComponents);
|
115
95
|
} else if (typeof referencedByComponents === 'string') {
|
@@ -122,5 +102,4 @@ var _default = (mDataStr, ComponentObj) => {
|
|
122
102
|
unDocsComList: unDocsComList
|
123
103
|
};
|
124
104
|
};
|
125
|
-
|
126
105
|
exports.default = _default;
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _child_process = require("child_process");
|
9
|
-
|
10
8
|
var _default = (type = 'git', cwd = process.cwd()) => {
|
11
9
|
let results;
|
12
|
-
|
13
10
|
if (type === 'git') {
|
14
11
|
results = (0, _child_process.spawnSync)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
15
12
|
encoding: 'utf8',
|
@@ -21,9 +18,7 @@ var _default = (type = 'git', cwd = process.cwd()) => {
|
|
21
18
|
cwd
|
22
19
|
});
|
23
20
|
}
|
24
|
-
|
25
21
|
let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
|
26
22
|
return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
|
27
23
|
};
|
28
|
-
|
29
24
|
exports.default = _default;
|
@@ -4,29 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _request = _interopRequireDefault(require("./request"));
|
11
|
-
|
12
9
|
var _libraryImpactConfig = _interopRequireDefault(require("./libraryImpactConfig"));
|
13
|
-
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
11
|
let dependencies = ['@zohodesk/components', '@zohodesk/dot', '@zohodesk/icons', '@zohodesk/svg', '@zohodesk/variables'];
|
17
|
-
|
18
12
|
let getCurrentDependenciesInfo = () => {
|
19
13
|
let packageJson = require(_path.default.join(process.cwd(), 'package.json'));
|
20
|
-
|
21
14
|
let info = {};
|
22
|
-
|
23
15
|
for (let dependency of dependencies) {
|
24
16
|
info[dependency] = packageJson.dependencies[dependency];
|
25
17
|
}
|
26
|
-
|
27
18
|
return info;
|
28
19
|
};
|
29
|
-
|
30
20
|
let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject) => {
|
31
21
|
let url = `${'ht'}${'tps'}://zgit.csez.zohocorpin.com/api/v4/projects/1143/repository/files/jsapps%2Fsupportapp%2Fpackage.json?ref=${branch}`;
|
32
22
|
(0, _request.default)({
|
@@ -42,15 +32,12 @@ let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject
|
|
42
32
|
dependencies: depend
|
43
33
|
} = JSON.parse(Buffer.from(content, 'base64').toString());
|
44
34
|
let info = {};
|
45
|
-
|
46
35
|
for (let dependency of dependencies) {
|
47
36
|
info[dependency] = depend[dependency];
|
48
37
|
}
|
49
|
-
|
50
38
|
resolve(info);
|
51
39
|
}).catch(reject);
|
52
40
|
});
|
53
|
-
|
54
41
|
let getDependencyChangeset = (dependency, version) => {
|
55
42
|
return new Promise(resolve => {
|
56
43
|
let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
|
@@ -62,12 +49,10 @@ let getDependencyChangeset = (dependency, version) => {
|
|
62
49
|
if (body == "") {
|
63
50
|
console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
|
64
51
|
}
|
65
|
-
|
66
52
|
resolve(body);
|
67
53
|
});
|
68
54
|
});
|
69
55
|
};
|
70
|
-
|
71
56
|
let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
|
72
57
|
let diff = {
|
73
58
|
[appName]: {}
|
@@ -92,11 +77,9 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
|
|
92
77
|
name,
|
93
78
|
ext
|
94
79
|
} = _path.default.parse(FILEPATH);
|
95
|
-
|
96
80
|
if (!diff[appName][key]) {
|
97
81
|
diff[appName][key] = [];
|
98
82
|
}
|
99
|
-
|
100
83
|
diff[appName][key].push({
|
101
84
|
name: name + ext,
|
102
85
|
FILEPATH
|
@@ -107,13 +90,11 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
|
|
107
90
|
resolve(diff);
|
108
91
|
});
|
109
92
|
});
|
110
|
-
|
111
93
|
var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary') => new Promise(resolve => {
|
112
94
|
let currentDependencies = getCurrentDependenciesInfo();
|
113
95
|
getLiveDependenciesInfo(liveBranch, tokenGit).then(liveDependencies => {
|
114
96
|
let diff = {};
|
115
97
|
let promises = [];
|
116
|
-
|
117
98
|
for (let dependency of dependencies) {
|
118
99
|
promises.push(new Promise(resolve => {
|
119
100
|
if (currentDependencies[dependency] !== liveDependencies[dependency]) {
|
@@ -133,7 +114,6 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
|
|
133
114
|
}
|
134
115
|
}));
|
135
116
|
}
|
136
|
-
|
137
117
|
promises.push(new Promise(resolve => {
|
138
118
|
getImpactDiff(srcBranch, liveBranch, 'AppSource').then(impacts => {
|
139
119
|
Object.assign(diff, impacts);
|
@@ -147,5 +127,4 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
|
|
147
127
|
throw e;
|
148
128
|
});
|
149
129
|
});
|
150
|
-
|
151
130
|
exports.default = _default;
|
package/lib/utils/getHash.js
CHANGED
@@ -4,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = getHash;
|
7
|
-
|
8
7
|
var _crypto = _interopRequireDefault(require("crypto"));
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
10
|
function getHash(file, size = 20, isPath = false) {
|
15
11
|
let hash = _crypto.default.createHash('md5');
|
16
|
-
|
17
12
|
let fileNew = file;
|
18
|
-
|
19
13
|
if (isPath) {
|
20
14
|
fileNew = _fs.default.readFileSync(file);
|
21
15
|
}
|
22
|
-
|
23
16
|
hash.update(fileNew);
|
24
17
|
hash = hash.digest('hex');
|
25
18
|
return hash ? hash.substring(0, size) : null;
|
package/lib/utils/getIp.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
let os = require('os');
|
4
|
-
|
5
4
|
module.exports = function getIP() {
|
6
5
|
let ifaces = os.networkInterfaces();
|
7
6
|
let ips = [];
|
@@ -10,7 +9,6 @@ module.exports = function getIP() {
|
|
10
9
|
if ('IPv4' !== iface.family || iface.internal !== false) {
|
11
10
|
return null;
|
12
11
|
}
|
13
|
-
|
14
12
|
return iface.address;
|
15
13
|
}).filter(a => a);
|
16
14
|
ips = ips.concat(a);
|
package/lib/utils/getOptions.js
CHANGED
@@ -4,23 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _child_process = require("child_process");
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
var _path = _interopRequireDefault(require("path"));
|
13
|
-
|
14
10
|
var _schemas = _interopRequireDefault(require("../schemas"));
|
15
|
-
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
12
|
// import { argv } from 'process';
|
19
|
-
const args = process.argv.slice(2); // console.log('argv', argv);
|
20
13
|
|
21
|
-
const
|
14
|
+
const args = process.argv.slice(2);
|
15
|
+
// console.log('argv', argv);
|
16
|
+
|
17
|
+
const NPM_CONFIG_PREFIX = 'npm_config_';
|
18
|
+
// TODO: we have to do option parse logic little better
|
22
19
|
// if user use react-cli stritly without using npm scripts options won't work,
|
23
20
|
// So we have to write our own option parse logic or some other library
|
21
|
+
|
24
22
|
// console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
|
25
23
|
// 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')));
|
26
24
|
// // clone:type
|
@@ -34,31 +32,24 @@ Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEac
|
|
34
32
|
});
|
35
33
|
keysWithColon.forEach(key => {
|
36
34
|
let nkey = key.replace(/:/g, '_');
|
37
|
-
|
38
35
|
if (processEnv[nkey]) {
|
39
36
|
throw Error('there is some options conflict', key, nkey);
|
40
37
|
}
|
41
|
-
|
42
38
|
processEnv[nkey] = processEnv[key];
|
43
39
|
});
|
44
|
-
|
45
40
|
function getNpmVersion() {
|
46
41
|
// require("child_process").
|
47
42
|
let vers = '6';
|
48
|
-
|
49
43
|
try {
|
50
44
|
[vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
|
51
45
|
} catch (error) {
|
52
46
|
console.log(error);
|
53
47
|
}
|
54
|
-
|
55
48
|
return vers;
|
56
49
|
}
|
57
|
-
|
58
50
|
function getCWD() {
|
59
51
|
// require("child_process").
|
60
52
|
let cwd = process.cwd();
|
61
|
-
|
62
53
|
try {
|
63
54
|
let ress = (0, _child_process.execSync)('npm bin').toString();
|
64
55
|
let i = ress.lastIndexOf('node_modules');
|
@@ -66,39 +57,33 @@ function getCWD() {
|
|
66
57
|
} catch (error) {
|
67
58
|
console.log(error);
|
68
59
|
}
|
69
|
-
|
70
60
|
return cwd;
|
71
|
-
}
|
72
|
-
|
61
|
+
}
|
73
62
|
|
63
|
+
// experimental argumnet parsing logic
|
74
64
|
args.forEach(option => {
|
75
65
|
if (/^--./.test(option)) {
|
76
|
-
let equIndex = option.indexOf('=');
|
77
|
-
|
66
|
+
let equIndex = option.indexOf('=');
|
67
|
+
// equIndex = equIndex === -1 ? option.length : equIndex;
|
78
68
|
let key = option.slice(2, equIndex);
|
79
69
|
let value = option.slice(equIndex + 1);
|
80
|
-
|
81
70
|
if (equIndex === -1) {
|
82
71
|
key = option.slice(2);
|
83
72
|
value = true;
|
84
73
|
}
|
85
|
-
|
86
74
|
key = key.replace(/-|:/g, '_');
|
87
75
|
processEnv[key] = value;
|
88
76
|
}
|
89
77
|
});
|
90
|
-
|
91
78
|
let defaulter = (target, source) => {
|
92
79
|
let defaultObject = {};
|
93
80
|
Object.keys(target).forEach(key => {
|
94
81
|
let data = target[key];
|
95
|
-
|
96
82
|
if (data && typeof data === 'object') {
|
97
83
|
if (Array.isArray(data)) {
|
98
84
|
defaultObject[key] = source[key] || data;
|
99
85
|
} else if (typeof data.cli === 'string') {
|
100
86
|
let cliData;
|
101
|
-
|
102
87
|
if (typeof processEnv[data.cli] === 'string') {
|
103
88
|
cliData = processEnv[data.cli];
|
104
89
|
} else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
|
@@ -106,11 +91,9 @@ let defaulter = (target, source) => {
|
|
106
91
|
} else {
|
107
92
|
cliData = source && source[key] || data.value;
|
108
93
|
}
|
109
|
-
|
110
94
|
if (typeof data.value === 'boolean') {
|
111
95
|
cliData = cliData === 'true' || cliData === true ? true : cliData === 'false' || cliData === false || cliData === '' ? false : data.value;
|
112
96
|
}
|
113
|
-
|
114
97
|
defaultObject[key] = cliData;
|
115
98
|
} else {
|
116
99
|
defaultObject[key] = defaulter(data, source && source[key] ? source[key] : Array.isArray(target[key]) ? [] : {});
|
@@ -121,31 +104,51 @@ let defaulter = (target, source) => {
|
|
121
104
|
});
|
122
105
|
return defaultObject;
|
123
106
|
};
|
124
|
-
|
125
107
|
global.reactCLIOptions = null;
|
126
108
|
|
109
|
+
// function selectn(obj, key) {
|
110
|
+
// let temp = obj;
|
111
|
+
// let keys = key.split('.');
|
112
|
+
// for (let i = 0; i < keys.length; i++) {
|
113
|
+
// const element = keys[i];
|
114
|
+
// temp = temp && temp[element];
|
115
|
+
// }
|
116
|
+
// return temp;
|
117
|
+
// }
|
118
|
+
|
119
|
+
function deprecationSupport(options) {
|
120
|
+
// if (selectn(options, ".app.hasRTL") === true) {
|
121
|
+
if (options.app.hasRTL === true) {
|
122
|
+
options.app.plugins.hasRTL = true;
|
123
|
+
}
|
124
|
+
if (options.docs.hasRTL === true) {
|
125
|
+
options.docs.plugins.hasRTL = true;
|
126
|
+
}
|
127
|
+
if (options.app.rtlExclude.length > 0) {
|
128
|
+
options.app.exclude.rtl = options.app.rtlExclude;
|
129
|
+
}
|
130
|
+
if (options.docs.rtlExclude.length > 0) {
|
131
|
+
options.docs.exclude.rtl = options.docs.rtlExclude;
|
132
|
+
}
|
133
|
+
}
|
127
134
|
let getOptions = () => {
|
128
135
|
if (global.reactCLIOptions) {
|
129
136
|
return global.reactCLIOptions;
|
130
137
|
}
|
131
|
-
|
132
138
|
let appPath = process.cwd();
|
133
139
|
let userSchemas;
|
134
|
-
|
135
140
|
let packagePath = _path.default.join(appPath, 'package.json');
|
136
|
-
|
137
141
|
if (_fs.default.existsSync(packagePath)) {
|
138
142
|
userSchemas = require(packagePath)['react-cli'] || {};
|
139
143
|
}
|
140
|
-
|
141
|
-
|
142
|
-
|
144
|
+
let options = defaulter(_schemas.default, userSchemas || {});
|
145
|
+
// for future may be for npm 8 edge cases
|
143
146
|
options.npmVersion = getNpmVersion();
|
144
147
|
options.cwd = getCWD();
|
148
|
+
deprecationSupport(options);
|
145
149
|
options.packageVersion = process.env.npm_package_version;
|
146
150
|
global.reactCLIOptions = options;
|
147
151
|
return options;
|
148
152
|
};
|
149
|
-
|
150
153
|
var _default = getOptions;
|
151
154
|
exports.default = _default;
|
@@ -4,32 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
let getServerURL = (serverInfo, protocol) => {
|
9
8
|
let {
|
10
9
|
host,
|
11
10
|
domain,
|
12
11
|
port
|
13
12
|
} = serverInfo;
|
14
|
-
|
15
13
|
if (protocol) {
|
16
14
|
if (protocol === 'ht' + 'tp') {
|
17
15
|
port = Number(port) + 1;
|
18
|
-
|
19
16
|
if (domain) {
|
20
17
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${Number(port) + 1}`;
|
21
18
|
}
|
22
|
-
|
23
19
|
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
24
20
|
}
|
25
21
|
}
|
26
|
-
|
27
22
|
if (domain) {
|
28
23
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${port}`;
|
29
24
|
}
|
30
|
-
|
31
25
|
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
32
26
|
};
|
33
|
-
|
34
27
|
var _default = getServerURL;
|
35
28
|
exports.default = _default;
|