@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.js +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +855 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +98 -84
- package/lib/configs/webpack.docs.config.js +64 -57
- package/lib/configs/webpack.impact.config.js +108 -0
- package/lib/configs/webpack.prod.config.js +146 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +365 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +534 -66
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
@@ -0,0 +1,126 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
let eliminateDuplicates = inputList => {
|
9
|
+
let outputList = [];
|
10
|
+
let tempObj = {};
|
11
|
+
|
12
|
+
for (let i = 0; i < inputList.length; i++) {
|
13
|
+
tempObj[inputList[i]] = 1;
|
14
|
+
}
|
15
|
+
|
16
|
+
for (let j in tempObj) {
|
17
|
+
if (tempObj[j]) {
|
18
|
+
outputList.push(j);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
outputList = outputList.filter(item => item);
|
23
|
+
return outputList;
|
24
|
+
};
|
25
|
+
|
26
|
+
let removeExtn = componentObjectList => {
|
27
|
+
let fileNameArray = [];
|
28
|
+
componentObjectList.forEach(fileObject => {
|
29
|
+
let filename = fileObject.name.includes('.docs.js') ? fileObject.name.replace('.docs.js', '') : fileObject.name.replace('.js', '');
|
30
|
+
fileNameArray.push(filename);
|
31
|
+
});
|
32
|
+
return fileNameArray;
|
33
|
+
};
|
34
|
+
|
35
|
+
let getChangedFileName = impactedObject => {
|
36
|
+
let changedComponentsList = [];
|
37
|
+
|
38
|
+
if (impactedObject.ADDED && impactedObject.ADDED.length) {
|
39
|
+
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.ADDED));
|
40
|
+
}
|
41
|
+
|
42
|
+
if (impactedObject.UPDATED && impactedObject.UPDATED.length) {
|
43
|
+
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.UPDATED));
|
44
|
+
}
|
45
|
+
|
46
|
+
if (impactedObject.REMOVED && impactedObject.REMOVED.length) {
|
47
|
+
changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.REMOVED));
|
48
|
+
}
|
49
|
+
|
50
|
+
return changedComponentsList;
|
51
|
+
};
|
52
|
+
|
53
|
+
let referencedbyList = [];
|
54
|
+
|
55
|
+
let getReferencedBy = (moduleDataObject, fileName) => {
|
56
|
+
if (moduleDataObject[fileName]) {
|
57
|
+
let referenceObject = moduleDataObject[fileName];
|
58
|
+
let referencedbyObject = referenceObject.referencedby;
|
59
|
+
|
60
|
+
if (referencedbyObject.length) {
|
61
|
+
if (!referencedbyList.includes(referenceObject.docsName)) {
|
62
|
+
referencedbyList.push(referenceObject.docsName);
|
63
|
+
}
|
64
|
+
|
65
|
+
referencedbyObject.forEach(referencedByFile => {
|
66
|
+
if (!referencedbyList.includes(moduleDataObject[referencedByFile].docsName)) {
|
67
|
+
let result = getReferencedBy(moduleDataObject, referencedByFile);
|
68
|
+
|
69
|
+
if (typeof result === 'string') {
|
70
|
+
referencedbyList.push(result);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
});
|
74
|
+
} else {
|
75
|
+
return fileName;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
return referencedbyList;
|
80
|
+
};
|
81
|
+
|
82
|
+
let checkDocs = AppComponentObject => {
|
83
|
+
let unDocsComponentNameList = [];
|
84
|
+
Object.keys(AppComponentObject).forEach(actionKey => {
|
85
|
+
AppComponentObject[actionKey].forEach(compObj => {
|
86
|
+
if (compObj.FILEPATH.includes('/src/components/')) {
|
87
|
+
if (compObj.name.includes('.js') || compObj.name.includes('.css')) {
|
88
|
+
if (!compObj.name.includes('.docs.')) {
|
89
|
+
if (!compObj.FILEPATH.includes('/src/components/docs/')) {
|
90
|
+
unDocsComponentNameList.push(process.cwd() + compObj.FILEPATH.replace('jsapps/supportapp', ''));
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
return unDocsComponentNameList;
|
98
|
+
};
|
99
|
+
|
100
|
+
var _default = (mDataStr, ComponentObj) => {
|
101
|
+
let mDataObject = JSON.parse(mDataStr);
|
102
|
+
let impactedComponentList = [];
|
103
|
+
let unDocsComList = [];
|
104
|
+
Object.keys(ComponentObj).forEach(libraryName => {
|
105
|
+
if (libraryName === 'AppSource') {
|
106
|
+
unDocsComList = checkDocs(ComponentObj[libraryName]);
|
107
|
+
}
|
108
|
+
|
109
|
+
let totalChangedFilesList = getChangedFileName(ComponentObj[libraryName]);
|
110
|
+
totalChangedFilesList.forEach(changedFileName => {
|
111
|
+
let referencedByComponents = getReferencedBy(mDataObject, changedFileName);
|
112
|
+
|
113
|
+
if (Array.isArray(referencedByComponents)) {
|
114
|
+
impactedComponentList = impactedComponentList.concat(referencedByComponents);
|
115
|
+
} else if (typeof referencedByComponents === 'string') {
|
116
|
+
impactedComponentList.push(referencedByComponents);
|
117
|
+
}
|
118
|
+
});
|
119
|
+
});
|
120
|
+
return {
|
121
|
+
impactedComponentList: eliminateDuplicates(impactedComponentList),
|
122
|
+
unDocsComList: unDocsComList
|
123
|
+
};
|
124
|
+
};
|
125
|
+
|
126
|
+
exports.default = _default;
|
@@ -1,35 +1,29 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var
|
8
|
+
var _child_process = require("child_process");
|
8
9
|
|
9
|
-
var
|
10
|
+
var _default = (type = 'git', cwd = process.cwd()) => {
|
11
|
+
let results;
|
10
12
|
|
11
|
-
exports.default = function () {
|
12
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'git';
|
13
|
-
var cwd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : __dirname;
|
14
|
-
|
15
|
-
var results = void 0;
|
16
13
|
if (type === 'git') {
|
17
14
|
results = (0, _child_process.spawnSync)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
18
15
|
encoding: 'utf8',
|
19
|
-
cwd
|
16
|
+
cwd
|
20
17
|
});
|
21
18
|
} else if (type === 'hg') {
|
22
19
|
results = (0, _child_process.spawnSync)('hg', ['identify', '-b'], {
|
23
20
|
encoding: 'utf8',
|
24
|
-
cwd
|
21
|
+
cwd
|
25
22
|
});
|
26
23
|
}
|
27
24
|
|
28
|
-
|
29
|
-
return d;
|
30
|
-
}),
|
31
|
-
_results$output$filte2 = _slicedToArray(_results$output$filte, 1),
|
32
|
-
currentBranch = _results$output$filte2[0];
|
33
|
-
|
25
|
+
let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
|
34
26
|
return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
|
35
|
-
};
|
27
|
+
};
|
28
|
+
|
29
|
+
exports.default = _default;
|
@@ -0,0 +1,151 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
10
|
+
var _request = _interopRequireDefault(require("./request"));
|
11
|
+
|
12
|
+
var _libraryImpactConfig = _interopRequireDefault(require("./libraryImpactConfig"));
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
let dependencies = ['@zohodesk/components', '@zohodesk/dot', '@zohodesk/icons', '@zohodesk/svg', '@zohodesk/variables'];
|
17
|
+
|
18
|
+
let getCurrentDependenciesInfo = () => {
|
19
|
+
let packageJson = require(_path.default.join(process.cwd(), 'package.json'));
|
20
|
+
|
21
|
+
let info = {};
|
22
|
+
|
23
|
+
for (let dependency of dependencies) {
|
24
|
+
info[dependency] = packageJson.dependencies[dependency];
|
25
|
+
}
|
26
|
+
|
27
|
+
return info;
|
28
|
+
};
|
29
|
+
|
30
|
+
let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject) => {
|
31
|
+
let url = `${'ht'}${'tps'}://zgit.csez.zohocorpin.com/api/v4/projects/1143/repository/files/jsapps%2Fsupportapp%2Fpackage.json?ref=${branch}`;
|
32
|
+
(0, _request.default)({
|
33
|
+
url,
|
34
|
+
headers: {
|
35
|
+
'PRIVATE-TOKEN': tokenGit
|
36
|
+
}
|
37
|
+
}).then(res => {
|
38
|
+
let {
|
39
|
+
content
|
40
|
+
} = JSON.parse(res.body);
|
41
|
+
let {
|
42
|
+
dependencies: depend
|
43
|
+
} = JSON.parse(Buffer.from(content, 'base64').toString());
|
44
|
+
let info = {};
|
45
|
+
|
46
|
+
for (let dependency of dependencies) {
|
47
|
+
info[dependency] = depend[dependency];
|
48
|
+
}
|
49
|
+
|
50
|
+
resolve(info);
|
51
|
+
}).catch(reject);
|
52
|
+
});
|
53
|
+
|
54
|
+
let getDependencyChangeset = (dependency, version) => {
|
55
|
+
return new Promise(resolve => {
|
56
|
+
let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
|
57
|
+
(0, _request.default)({
|
58
|
+
url
|
59
|
+
}).then(({
|
60
|
+
body
|
61
|
+
}) => {
|
62
|
+
if (body == "") {
|
63
|
+
console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
|
64
|
+
}
|
65
|
+
|
66
|
+
resolve(body);
|
67
|
+
});
|
68
|
+
});
|
69
|
+
};
|
70
|
+
|
71
|
+
let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
|
72
|
+
let diff = {
|
73
|
+
[appName]: {}
|
74
|
+
};
|
75
|
+
let domain = _libraryImpactConfig.default[appName].impactDomain;
|
76
|
+
let serviceName = _libraryImpactConfig.default[appName].impactService;
|
77
|
+
(0, _request.default)({
|
78
|
+
url: `${domain}/impact/ImpactModuleAction.do?action=getCommitDiffFileDetail&serviceName=${serviceName}&masterBranchCommitHash=${targetBranch}&buildCommitHash=${srcBranch}`
|
79
|
+
}).then(res => {
|
80
|
+
let {
|
81
|
+
body
|
82
|
+
} = res;
|
83
|
+
let {
|
84
|
+
DIFF_FILES
|
85
|
+
} = JSON.parse(body);
|
86
|
+
Object.keys(DIFF_FILES).forEach(key => {
|
87
|
+
DIFF_FILES[key].forEach(({
|
88
|
+
FILEPATH
|
89
|
+
}) => {
|
90
|
+
if (FILEPATH.includes(`jsapps/${appName === 'AppSource' ? 'supportapp/src' : appName}`) && FILEPATH.endsWith('.js') && !FILEPATH.includes('.spec')) {
|
91
|
+
let {
|
92
|
+
name,
|
93
|
+
ext
|
94
|
+
} = _path.default.parse(FILEPATH);
|
95
|
+
|
96
|
+
if (!diff[appName][key]) {
|
97
|
+
diff[appName][key] = [];
|
98
|
+
}
|
99
|
+
|
100
|
+
diff[appName][key].push({
|
101
|
+
name: name + ext,
|
102
|
+
FILEPATH
|
103
|
+
});
|
104
|
+
}
|
105
|
+
});
|
106
|
+
});
|
107
|
+
resolve(diff);
|
108
|
+
});
|
109
|
+
});
|
110
|
+
|
111
|
+
var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary') => new Promise(resolve => {
|
112
|
+
let currentDependencies = getCurrentDependenciesInfo();
|
113
|
+
getLiveDependenciesInfo(liveBranch, tokenGit).then(liveDependencies => {
|
114
|
+
let diff = {};
|
115
|
+
let promises = [];
|
116
|
+
|
117
|
+
for (let dependency of dependencies) {
|
118
|
+
promises.push(new Promise(resolve => {
|
119
|
+
if (currentDependencies[dependency] !== liveDependencies[dependency]) {
|
120
|
+
let sanitizedName = dependency.replace('@', '').replace(/\//g, '_');
|
121
|
+
let [, folderName] = sanitizedName.split('_');
|
122
|
+
diff[folderName] = {};
|
123
|
+
let p1 = getDependencyChangeset(sanitizedName, currentDependencies[dependency]);
|
124
|
+
let p2 = getDependencyChangeset(sanitizedName, liveDependencies[dependency]);
|
125
|
+
Promise.all([p1, p2]).then(([currentChangeset, liveChangeset]) => {
|
126
|
+
getImpactDiff(liveChangeset, currentChangeset, folderName).then(impacts => {
|
127
|
+
Object.assign(diff, impacts);
|
128
|
+
resolve();
|
129
|
+
});
|
130
|
+
});
|
131
|
+
} else {
|
132
|
+
resolve();
|
133
|
+
}
|
134
|
+
}));
|
135
|
+
}
|
136
|
+
|
137
|
+
promises.push(new Promise(resolve => {
|
138
|
+
getImpactDiff(srcBranch, liveBranch, 'AppSource').then(impacts => {
|
139
|
+
Object.assign(diff, impacts);
|
140
|
+
resolve();
|
141
|
+
});
|
142
|
+
}));
|
143
|
+
Promise.all(promises).then(() => {
|
144
|
+
resolve(diff);
|
145
|
+
});
|
146
|
+
}).catch(e => {
|
147
|
+
throw e;
|
148
|
+
});
|
149
|
+
});
|
150
|
+
|
151
|
+
exports.default = _default;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = getHash;
|
7
|
+
|
8
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
9
|
+
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function getHash(file, size = 20, isPath = false) {
|
15
|
+
let hash = _crypto.default.createHash('md5');
|
16
|
+
|
17
|
+
let fileNew = file;
|
18
|
+
|
19
|
+
if (isPath) {
|
20
|
+
fileNew = _fs.default.readFileSync(file);
|
21
|
+
}
|
22
|
+
|
23
|
+
hash.update(fileNew);
|
24
|
+
hash = hash.digest('hex');
|
25
|
+
return hash ? hash.substring(0, size) : null;
|
26
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
let os = require('os');
|
4
|
+
|
5
|
+
module.exports = function getIP() {
|
6
|
+
let ifaces = os.networkInterfaces();
|
7
|
+
let ips = [];
|
8
|
+
Object.keys(ifaces).forEach(ifname => {
|
9
|
+
let a = ifaces[ifname].map(iface => {
|
10
|
+
if ('IPv4' !== iface.family || iface.internal !== false) {
|
11
|
+
return null;
|
12
|
+
}
|
13
|
+
|
14
|
+
return iface.address;
|
15
|
+
}).filter(a => a);
|
16
|
+
ips = ips.concat(a);
|
17
|
+
});
|
18
|
+
ips.push('127.0.0.1');
|
19
|
+
return ips[0];
|
20
|
+
};
|
package/lib/utils/getOptions.js
CHANGED
@@ -1,66 +1,151 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var
|
8
|
+
var _child_process = require("child_process");
|
8
9
|
|
9
|
-
var _fs = require(
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
10
11
|
|
11
|
-
var
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
12
13
|
|
13
|
-
var
|
14
|
+
var _schemas = _interopRequireDefault(require("../schemas"));
|
14
15
|
|
15
|
-
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
17
|
|
17
|
-
|
18
|
+
// import { argv } from 'process';
|
19
|
+
const args = process.argv.slice(2); // console.log('argv', argv);
|
20
|
+
|
21
|
+
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
22
|
+
// if user use react-cli stritly without using npm scripts options won't work,
|
23
|
+
// So we have to write our own option parse logic or some other library
|
24
|
+
// console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
|
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')));
|
26
|
+
// // clone:type
|
27
|
+
|
28
|
+
const processEnv = {};
|
29
|
+
let keysWithColon = [];
|
30
|
+
Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEach(key => {
|
31
|
+
let nkey = key.slice(NPM_CONFIG_PREFIX.length);
|
32
|
+
processEnv[nkey] = process.env[key];
|
33
|
+
nkey.includes(':') && keysWithColon.push(nkey);
|
34
|
+
});
|
35
|
+
keysWithColon.forEach(key => {
|
36
|
+
let nkey = key.replace(/:/g, '_');
|
18
37
|
|
19
|
-
|
38
|
+
if (processEnv[nkey]) {
|
39
|
+
throw Error('there is some options conflict', key, nkey);
|
40
|
+
}
|
41
|
+
|
42
|
+
processEnv[nkey] = processEnv[key];
|
43
|
+
});
|
44
|
+
|
45
|
+
function getNpmVersion() {
|
46
|
+
// require("child_process").
|
47
|
+
let vers = '6';
|
48
|
+
|
49
|
+
try {
|
50
|
+
[vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
|
51
|
+
} catch (error) {
|
52
|
+
console.log(error);
|
53
|
+
}
|
54
|
+
|
55
|
+
return vers;
|
56
|
+
}
|
57
|
+
|
58
|
+
function getCWD() {
|
59
|
+
// require("child_process").
|
60
|
+
let cwd = process.cwd();
|
61
|
+
|
62
|
+
try {
|
63
|
+
let ress = (0, _child_process.execSync)('npm bin').toString();
|
64
|
+
let i = ress.lastIndexOf('node_modules');
|
65
|
+
cwd = i === -1 ? cwd : ress.slice(0, i);
|
66
|
+
} catch (error) {
|
67
|
+
console.log(error);
|
68
|
+
}
|
69
|
+
|
70
|
+
return cwd;
|
71
|
+
} // experimental argumnet parsing logic
|
20
72
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22
73
|
|
23
|
-
|
24
|
-
|
74
|
+
args.forEach(option => {
|
75
|
+
if (/^--./.test(option)) {
|
76
|
+
let equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
25
77
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
78
|
+
let key = option.slice(2, equIndex);
|
79
|
+
let value = option.slice(equIndex + 1);
|
80
|
+
|
81
|
+
if (equIndex === -1) {
|
82
|
+
key = option.slice(2);
|
83
|
+
value = true;
|
84
|
+
}
|
85
|
+
|
86
|
+
key = key.replace(/-|:/g, '_');
|
87
|
+
processEnv[key] = value;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
let defaulter = (target, source) => {
|
92
|
+
let defaultObject = {};
|
93
|
+
Object.keys(target).forEach(key => {
|
94
|
+
let data = target[key];
|
95
|
+
|
96
|
+
if (data && typeof data === 'object') {
|
97
|
+
if (Array.isArray(data)) {
|
98
|
+
defaultObject[key] = source[key] || data;
|
99
|
+
} else if (typeof data.cli === 'string') {
|
100
|
+
let cliData;
|
101
|
+
|
102
|
+
if (typeof processEnv[data.cli] === 'string') {
|
103
|
+
cliData = processEnv[data.cli];
|
104
|
+
} else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
|
105
|
+
cliData = processEnv[data.cli.toLowerCase()];
|
33
106
|
} else {
|
34
107
|
cliData = source && source[key] || data.value;
|
35
108
|
}
|
109
|
+
|
36
110
|
if (typeof data.value === 'boolean') {
|
37
111
|
cliData = cliData === 'true' || cliData === true ? true : cliData === 'false' || cliData === false || cliData === '' ? false : data.value;
|
38
112
|
}
|
39
113
|
|
40
114
|
defaultObject[key] = cliData;
|
41
115
|
} else {
|
42
|
-
defaultObject[key] = defaulter(data, source && source[key] ? source[key] : {});
|
116
|
+
defaultObject[key] = defaulter(data, source && source[key] ? source[key] : Array.isArray(target[key]) ? [] : {});
|
43
117
|
}
|
44
118
|
} else {
|
45
|
-
defaultObject[key] =
|
119
|
+
defaultObject[key] = typeof source === 'object' && source[key] !== null && typeof source[key] !== 'undefined' ? source[key] : target[key];
|
46
120
|
}
|
47
121
|
});
|
48
|
-
|
49
122
|
return defaultObject;
|
50
123
|
};
|
51
124
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
125
|
+
global.reactCLIOptions = null;
|
126
|
+
|
127
|
+
let getOptions = () => {
|
128
|
+
if (global.reactCLIOptions) {
|
129
|
+
return global.reactCLIOptions;
|
130
|
+
}
|
131
|
+
|
132
|
+
let appPath = process.cwd();
|
133
|
+
let userSchemas;
|
134
|
+
|
135
|
+
let packagePath = _path.default.join(appPath, 'package.json');
|
56
136
|
|
57
|
-
if (
|
137
|
+
if (_fs.default.existsSync(packagePath)) {
|
58
138
|
userSchemas = require(packagePath)['react-cli'] || {};
|
59
139
|
}
|
60
140
|
|
61
|
-
|
141
|
+
let options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
142
|
+
|
143
|
+
options.npmVersion = getNpmVersion();
|
144
|
+
options.cwd = getCWD();
|
62
145
|
options.packageVersion = process.env.npm_package_version;
|
146
|
+
global.reactCLIOptions = options;
|
63
147
|
return options;
|
64
148
|
};
|
65
149
|
|
66
|
-
|
150
|
+
var _default = getOptions;
|
151
|
+
exports.default = _default;
|
@@ -1,18 +1,35 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
|
-
var host = serverInfo.host,
|
8
|
-
domain = serverInfo.domain,
|
9
|
-
port = serverInfo.port;
|
6
|
+
exports.default = void 0;
|
10
7
|
|
8
|
+
let getServerURL = (serverInfo, protocol) => {
|
9
|
+
let {
|
10
|
+
host,
|
11
|
+
domain,
|
12
|
+
port
|
13
|
+
} = serverInfo;
|
14
|
+
|
15
|
+
if (protocol) {
|
16
|
+
if (protocol === 'ht' + 'tp') {
|
17
|
+
port = Number(port) + 1;
|
18
|
+
|
19
|
+
if (domain) {
|
20
|
+
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${Number(port) + 1}`;
|
21
|
+
}
|
22
|
+
|
23
|
+
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
24
|
+
}
|
25
|
+
}
|
11
26
|
|
12
27
|
if (domain) {
|
13
|
-
return
|
28
|
+
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${port}`;
|
14
29
|
}
|
15
|
-
|
30
|
+
|
31
|
+
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
16
32
|
};
|
17
33
|
|
18
|
-
|
34
|
+
var _default = getServerURL;
|
35
|
+
exports.default = _default;
|