@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
package/lib/utils/index.js
CHANGED
@@ -1,114 +1,329 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
var _exportNames = {
|
7
|
+
log: true,
|
8
|
+
writeFile: true,
|
9
|
+
makeDir: true,
|
10
|
+
getInfoFromPublicPaths: true,
|
11
|
+
getLibraryConflict: true,
|
12
|
+
getOptions: true,
|
13
|
+
createEventStream: true,
|
14
|
+
getServerURL: true,
|
15
|
+
getCurrentBranch: true,
|
16
|
+
switchBranch: true,
|
17
|
+
pullOrigin: true,
|
18
|
+
request: true,
|
19
|
+
jsonHelper: true,
|
20
|
+
getDependenciesImpactList: true,
|
21
|
+
getComponents: true,
|
22
|
+
ssTestHack: true
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "createEventStream", {
|
11
25
|
enumerable: true,
|
12
|
-
get: function
|
13
|
-
return
|
26
|
+
get: function () {
|
27
|
+
return _createEventStream.default;
|
14
28
|
}
|
15
29
|
});
|
16
|
-
|
17
|
-
var _createEventStream = require('./createEventStream');
|
18
|
-
|
19
|
-
Object.defineProperty(exports, 'createEventStream', {
|
30
|
+
Object.defineProperty(exports, "getComponents", {
|
20
31
|
enumerable: true,
|
21
|
-
get: function
|
22
|
-
return
|
32
|
+
get: function () {
|
33
|
+
return _getComponents.default;
|
23
34
|
}
|
24
35
|
});
|
25
|
-
|
26
|
-
var _getServerURL = require('./getServerURL');
|
27
|
-
|
28
|
-
Object.defineProperty(exports, 'getServerURL', {
|
36
|
+
Object.defineProperty(exports, "getCurrentBranch", {
|
29
37
|
enumerable: true,
|
30
|
-
get: function
|
31
|
-
return
|
38
|
+
get: function () {
|
39
|
+
return _getCurrentBranch.default;
|
32
40
|
}
|
33
41
|
});
|
34
|
-
|
35
|
-
var _getCurrentBranch = require('./getCurrentBranch');
|
36
|
-
|
37
|
-
Object.defineProperty(exports, 'getCurrentBranch', {
|
42
|
+
Object.defineProperty(exports, "getDependenciesImpactList", {
|
38
43
|
enumerable: true,
|
39
|
-
get: function
|
40
|
-
return
|
44
|
+
get: function () {
|
45
|
+
return _getDependenciesImpactList.default;
|
41
46
|
}
|
42
47
|
});
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
Object.defineProperty(exports, 'request', {
|
48
|
+
exports.getLibraryConflict = exports.getInfoFromPublicPaths = void 0;
|
49
|
+
Object.defineProperty(exports, "getOptions", {
|
47
50
|
enumerable: true,
|
48
|
-
get: function
|
49
|
-
return
|
51
|
+
get: function () {
|
52
|
+
return _getOptions.default;
|
50
53
|
}
|
51
54
|
});
|
55
|
+
Object.defineProperty(exports, "getServerURL", {
|
56
|
+
enumerable: true,
|
57
|
+
get: function () {
|
58
|
+
return _getServerURL.default;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
Object.defineProperty(exports, "jsonHelper", {
|
62
|
+
enumerable: true,
|
63
|
+
get: function () {
|
64
|
+
return _jsonHelper.default;
|
65
|
+
}
|
66
|
+
});
|
67
|
+
exports.makeDir = exports.log = void 0;
|
68
|
+
Object.defineProperty(exports, "pullOrigin", {
|
69
|
+
enumerable: true,
|
70
|
+
get: function () {
|
71
|
+
return _pullOrigin.default;
|
72
|
+
}
|
73
|
+
});
|
74
|
+
Object.defineProperty(exports, "request", {
|
75
|
+
enumerable: true,
|
76
|
+
get: function () {
|
77
|
+
return _request.default;
|
78
|
+
}
|
79
|
+
});
|
80
|
+
Object.defineProperty(exports, "ssTestHack", {
|
81
|
+
enumerable: true,
|
82
|
+
get: function () {
|
83
|
+
return _ssTestHack.default;
|
84
|
+
}
|
85
|
+
});
|
86
|
+
Object.defineProperty(exports, "switchBranch", {
|
87
|
+
enumerable: true,
|
88
|
+
get: function () {
|
89
|
+
return _switchBranch.default;
|
90
|
+
}
|
91
|
+
});
|
92
|
+
exports.writeFile = void 0;
|
93
|
+
|
94
|
+
var _stream = require("stream");
|
95
|
+
|
96
|
+
var _fs = _interopRequireDefault(require("fs"));
|
97
|
+
|
98
|
+
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
99
|
+
|
100
|
+
var _createEventStream = _interopRequireDefault(require("./createEventStream"));
|
101
|
+
|
102
|
+
var _getServerURL = _interopRequireDefault(require("./getServerURL"));
|
103
|
+
|
104
|
+
var _getCurrentBranch = _interopRequireDefault(require("./getCurrentBranch"));
|
105
|
+
|
106
|
+
var _switchBranch = _interopRequireDefault(require("./switchBranch"));
|
107
|
+
|
108
|
+
var _pullOrigin = _interopRequireDefault(require("./pullOrigin"));
|
52
109
|
|
53
|
-
var
|
110
|
+
var _request = _interopRequireDefault(require("./request"));
|
111
|
+
|
112
|
+
var _jsonHelper = _interopRequireDefault(require("./jsonHelper"));
|
113
|
+
|
114
|
+
var _reinstallDependencies = require("./reinstallDependencies");
|
115
|
+
|
116
|
+
Object.keys(_reinstallDependencies).forEach(function (key) {
|
117
|
+
if (key === "default" || key === "__esModule") return;
|
118
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
119
|
+
if (key in exports && exports[key] === _reinstallDependencies[key]) return;
|
120
|
+
Object.defineProperty(exports, key, {
|
121
|
+
enumerable: true,
|
122
|
+
get: function () {
|
123
|
+
return _reinstallDependencies[key];
|
124
|
+
}
|
125
|
+
});
|
126
|
+
});
|
127
|
+
|
128
|
+
var _cssURLReplacer = require("./cssURLReplacer");
|
129
|
+
|
130
|
+
Object.keys(_cssURLReplacer).forEach(function (key) {
|
131
|
+
if (key === "default" || key === "__esModule") return;
|
132
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
133
|
+
if (key in exports && exports[key] === _cssURLReplacer[key]) return;
|
134
|
+
Object.defineProperty(exports, key, {
|
135
|
+
enumerable: true,
|
136
|
+
get: function () {
|
137
|
+
return _cssURLReplacer[key];
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
|
142
|
+
var _initPreCommitHook = require("./initPreCommitHook");
|
54
143
|
|
55
144
|
Object.keys(_initPreCommitHook).forEach(function (key) {
|
56
145
|
if (key === "default" || key === "__esModule") return;
|
146
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
147
|
+
if (key in exports && exports[key] === _initPreCommitHook[key]) return;
|
57
148
|
Object.defineProperty(exports, key, {
|
58
149
|
enumerable: true,
|
59
|
-
get: function
|
150
|
+
get: function () {
|
60
151
|
return _initPreCommitHook[key];
|
61
152
|
}
|
62
153
|
});
|
63
154
|
});
|
64
155
|
|
65
|
-
var
|
156
|
+
var _getDependenciesImpactList = _interopRequireDefault(require("./getDependenciesImpactList"));
|
66
157
|
|
67
|
-
var
|
158
|
+
var _getComponents = _interopRequireDefault(require("./getComponents"));
|
68
159
|
|
69
|
-
var
|
160
|
+
var _ssTestHack = _interopRequireDefault(require("./ssTestHack"));
|
70
161
|
|
71
162
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
72
163
|
|
73
|
-
|
74
|
-
|
75
|
-
print.log
|
164
|
+
let log = (...info) => {
|
165
|
+
let print = console;
|
166
|
+
print.log(...info);
|
76
167
|
};
|
77
168
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
inStr.push(src);
|
90
|
-
inStr.push(null);
|
91
|
-
}
|
92
|
-
var outStr = _fs2.default.createWriteStream(outputPath);
|
93
|
-
outStr.on('error', function () {
|
94
|
-
reject();
|
95
|
-
});
|
96
|
-
outStr.on('finish', function () {
|
97
|
-
resolve();
|
98
|
-
});
|
169
|
+
exports.log = log;
|
170
|
+
|
171
|
+
let writeFile = (outputPath, src, isPath = false) => new Promise((resolve, reject) => {
|
172
|
+
let inStr;
|
173
|
+
|
174
|
+
if (isPath) {
|
175
|
+
inStr = _fs.default.createReadStream(src);
|
176
|
+
} else {
|
177
|
+
inStr = new _stream.Readable();
|
178
|
+
|
179
|
+
inStr._read = () => true;
|
99
180
|
|
100
|
-
inStr.
|
181
|
+
inStr.push(src);
|
182
|
+
inStr.push(null);
|
183
|
+
}
|
184
|
+
|
185
|
+
let outStr = _fs.default.createWriteStream(outputPath);
|
186
|
+
|
187
|
+
outStr.on('error', err => {
|
188
|
+
reject(err);
|
101
189
|
});
|
102
|
-
|
190
|
+
outStr.on('finish', () => {
|
191
|
+
resolve();
|
192
|
+
});
|
193
|
+
inStr.pipe(outStr);
|
194
|
+
});
|
103
195
|
|
104
|
-
|
196
|
+
exports.writeFile = writeFile;
|
197
|
+
|
198
|
+
let makeDir = paths => {
|
105
199
|
if (typeof paths === 'string') {
|
106
200
|
//eslint-disable-next-line
|
107
201
|
paths = [paths];
|
108
202
|
}
|
109
|
-
|
110
|
-
|
111
|
-
|
203
|
+
|
204
|
+
paths.forEach(path => {
|
205
|
+
if (!_fs.default.existsSync(path)) {
|
206
|
+
_fs.default.mkdirSync(path);
|
207
|
+
}
|
208
|
+
});
|
209
|
+
};
|
210
|
+
|
211
|
+
exports.makeDir = makeDir;
|
212
|
+
|
213
|
+
let getInfoFromPublicPaths = publicPaths => {
|
214
|
+
let rootFolder = '',
|
215
|
+
image = '',
|
216
|
+
font = '';
|
217
|
+
|
218
|
+
if (publicPaths && !Array.isArray(publicPaths) && typeof publicPaths === 'object' && !publicPaths.callback) {
|
219
|
+
let [cdn] = Object.keys(publicPaths);
|
220
|
+
rootFolder = `${cdn}/`;
|
221
|
+
|
222
|
+
if (publicPaths[cdn].font) {
|
223
|
+
font = publicPaths[cdn].font; //eslint-disable-line
|
112
224
|
}
|
225
|
+
|
226
|
+
if (publicPaths[cdn].image) {
|
227
|
+
image = publicPaths[cdn].image; //eslint-disable-line
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
return {
|
232
|
+
rootFolder,
|
233
|
+
image,
|
234
|
+
font
|
235
|
+
};
|
236
|
+
};
|
237
|
+
|
238
|
+
exports.getInfoFromPublicPaths = getInfoFromPublicPaths;
|
239
|
+
|
240
|
+
let getLibraryConflict = (moduleObject, impactObj, changesOnly) => {
|
241
|
+
let srcChanges = [];
|
242
|
+
let libraryChanges = [];
|
243
|
+
let overallSourceList = [];
|
244
|
+
let allImpactArray = [];
|
245
|
+
let impactThere = true;
|
246
|
+
let whichLibrary = "";
|
247
|
+
moduleObject = JSON.parse(moduleObject);
|
248
|
+
Object.keys(impactObj).forEach(library => {
|
249
|
+
Object.keys(impactObj[library]).forEach(action => {
|
250
|
+
if (action !== 'REMOVED') {
|
251
|
+
impactObj[library][action].forEach(srcObject => {
|
252
|
+
let fileName = srcObject["FILEPATH"];
|
253
|
+
|
254
|
+
if (library == "AppSource") {
|
255
|
+
fileName = fileName.replace("jsapps/supportapp", ".");
|
256
|
+
srcChanges.push(fileName);
|
257
|
+
} else {
|
258
|
+
fileName = fileName.replace("jsapps/" + library + "/src", "./node_modules/@zohodesk/" + library + "/lib");
|
259
|
+
libraryChanges.push(fileName);
|
260
|
+
}
|
261
|
+
});
|
262
|
+
}
|
263
|
+
});
|
113
264
|
});
|
114
|
-
|
265
|
+
|
266
|
+
if (!changesOnly) {
|
267
|
+
srcChanges = [];
|
268
|
+
|
269
|
+
if (libraryChanges.length > 0) {
|
270
|
+
libraryChanges.forEach(mdataLibKey => {
|
271
|
+
if (moduleObject[mdataLibKey]) {
|
272
|
+
moduleObject[mdataLibKey].referencedby.forEach(refByFileName => {
|
273
|
+
if (refByFileName.indexOf("@zohodesk") == -1) {
|
274
|
+
if (srcChanges.indexOf(refByFileName) == -1) {
|
275
|
+
srcChanges.push(refByFileName);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
});
|
279
|
+
}
|
280
|
+
});
|
281
|
+
} else {}
|
282
|
+
}
|
283
|
+
|
284
|
+
if (srcChanges.length > 0) {
|
285
|
+
srcChanges.forEach(srcFile => {
|
286
|
+
let cacheObject = {};
|
287
|
+
cacheObject.sourceName = srcFile;
|
288
|
+
let cacheLibraryList = [];
|
289
|
+
|
290
|
+
if (libraryChanges.length > 0) {
|
291
|
+
libraryChanges.forEach(mdataKey => {
|
292
|
+
if (moduleObject[mdataKey]) {
|
293
|
+
if (moduleObject[mdataKey].referencedby.indexOf(srcFile) > -1) {
|
294
|
+
mdataKey = mdataKey.replace("./node_modules/", "");
|
295
|
+
cacheLibraryList.push(mdataKey);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
});
|
299
|
+
} else {
|
300
|
+
impactThere = false;
|
301
|
+
whichLibrary = 'No library file changes between target branch!';
|
302
|
+
}
|
303
|
+
|
304
|
+
if (cacheLibraryList.length > 0) {
|
305
|
+
cacheObject.impactedBy = cacheLibraryList;
|
306
|
+
allImpactArray.push(cacheObject);
|
307
|
+
} else {
|
308
|
+
impactThere = false;
|
309
|
+
whichLibrary = "No component file changes!";
|
310
|
+
}
|
311
|
+
});
|
312
|
+
} else {
|
313
|
+
impactThere = false;
|
314
|
+
whichLibrary = "No component file changes!";
|
315
|
+
}
|
316
|
+
|
317
|
+
log('\n');
|
318
|
+
log('You can see the HTML out at coverageTest/impactLibrary.html!');
|
319
|
+
log('\x1b[33m%s\x1b[0m', '************************************************************ \n ');
|
320
|
+
return {
|
321
|
+
response: allImpactArray,
|
322
|
+
result: {
|
323
|
+
status: impactThere,
|
324
|
+
message: whichLibrary
|
325
|
+
}
|
326
|
+
};
|
327
|
+
};
|
328
|
+
|
329
|
+
exports.getLibraryConflict = getLibraryConflict;
|
package/lib/utils/init.js
CHANGED
@@ -1,62 +1,82 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.initPreCommitHook = exports.getGitRootDir =
|
6
|
+
exports.initPreCommitHook = exports.getGitRootDir = void 0;
|
7
7
|
|
8
|
-
var _fs = require(
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _child_process = require("child_process");
|
13
13
|
|
14
|
-
var
|
15
|
-
|
16
|
-
var _child_process = require('child_process');
|
17
|
-
|
18
|
-
var _index = require('./index');
|
14
|
+
var _index = require("./index");
|
19
15
|
|
20
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
17
|
|
22
|
-
|
23
|
-
var getGitRootDir = exports.getGitRootDir = function getGitRootDir() {
|
18
|
+
let getGitRootDir = () => {
|
24
19
|
try {
|
25
20
|
return (0, _child_process.execSync)('git rev-parse --show-toplevel').toString();
|
26
21
|
} catch (e) {
|
27
22
|
return false;
|
28
23
|
}
|
24
|
+
}; //eslint-disable-next-line
|
25
|
+
|
26
|
+
|
27
|
+
exports.getGitRootDir = getGitRootDir;
|
28
|
+
|
29
|
+
let copyEslintConfig = rootDir => {
|
30
|
+
rootDir = rootDir.replace(/\r?\n|\r/g, ''); //eslint-disable-line
|
31
|
+
|
32
|
+
let srcPath = _path.default.join(__dirname, '..', '..', '.eslintrc.js');
|
33
|
+
|
34
|
+
let targetPath = _path.default.join(rootDir, '.eslintrc.js');
|
35
|
+
|
36
|
+
if (!_fs.default.existsSync(targetPath)) {
|
37
|
+
let src = _fs.default.readFileSync(srcPath).toString();
|
38
|
+
|
39
|
+
_fs.default.writeFileSync(targetPath, src);
|
40
|
+
|
41
|
+
(0, _index.log)('Eslint config added in project root path');
|
42
|
+
}
|
29
43
|
};
|
30
44
|
|
31
|
-
|
32
|
-
|
45
|
+
let initPreCommitHook = (forReactCLI = false) => {
|
46
|
+
let gitRootDir = getGitRootDir(); //copyEslintConfig(gitRootDir || process.cwd());
|
33
47
|
|
34
|
-
var gitRootDir = getGitRootDir();
|
35
48
|
if (gitRootDir) {
|
36
|
-
|
49
|
+
let precommit = _fs.default.readFileSync(_path.default.join(__dirname, '../sh/pre-commit.sh')).toString();
|
50
|
+
|
51
|
+
let targetPath = _path.default.join(gitRootDir, '.git', 'hooks', 'pre-commit').replace(/\s/g, '');
|
52
|
+
|
53
|
+
if (_fs.default.existsSync(`${targetPath}.sample`)) {
|
54
|
+
precommit = precommit.replace('${PREFIX_PATH}', //eslint-disable-line
|
55
|
+
process.cwd().replace(/\\/g, '/'));
|
56
|
+
|
57
|
+
_fs.default.renameSync(`${targetPath}.sample`, targetPath);
|
37
58
|
|
38
|
-
|
59
|
+
_fs.default.writeFileSync(targetPath, precommit);
|
39
60
|
|
40
|
-
if (_fs2.default.existsSync(targetPath + '.sample')) {
|
41
|
-
precommit = precommit.replace('${PREFIX_PATH}', process.cwd()); //eslint-disable-line
|
42
|
-
_fs2.default.renameSync(targetPath + '.sample', targetPath);
|
43
|
-
_fs2.default.writeFileSync(targetPath, precommit);
|
44
61
|
(0, _index.log)('pre-commit hook added');
|
45
62
|
}
|
46
63
|
|
47
|
-
|
64
|
+
let packagePath = _path.default.join(process.cwd(), 'package.json');
|
65
|
+
|
48
66
|
try {
|
49
|
-
|
67
|
+
let packageJson = require(packagePath);
|
50
68
|
|
51
69
|
if (packageJson.scripts.lint !== 'react-cli lint') {
|
52
70
|
packageJson.scripts.lint = forReactCLI ? 'eslint ./src' : 'react-cli lint';
|
53
71
|
|
54
|
-
|
72
|
+
_fs.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
|
73
|
+
|
55
74
|
(0, _index.log)('lint script added in your package.json');
|
56
75
|
}
|
57
76
|
} catch (e) {
|
58
|
-
|
59
|
-
console.log('package.json not found');
|
77
|
+
(0, _index.log)('package.json not found');
|
60
78
|
}
|
61
79
|
}
|
62
|
-
};
|
80
|
+
};
|
81
|
+
|
82
|
+
exports.initPreCommitHook = initPreCommitHook;
|
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.getRunnerDetail = exports.fileHandler = void 0;
|
7
|
+
|
8
|
+
let fs = require('fs');
|
9
|
+
|
10
|
+
let os = require('os');
|
11
|
+
|
12
|
+
let {
|
13
|
+
getCurrentBranch
|
14
|
+
} = require('./');
|
15
|
+
|
16
|
+
let getRunnerDetail = () => {
|
17
|
+
let defaultObj = {
|
18
|
+
jobDetails: {
|
19
|
+
isRunByLocal: true,
|
20
|
+
hostName: os.hostname(),
|
21
|
+
platForm: os.type(),
|
22
|
+
branchName: getCurrentBranch('git', process.cwd())
|
23
|
+
}
|
24
|
+
};
|
25
|
+
return defaultObj;
|
26
|
+
};
|
27
|
+
|
28
|
+
exports.getRunnerDetail = getRunnerDetail;
|
29
|
+
let fileHandler = {
|
30
|
+
readFile: (path, callback = null) => {
|
31
|
+
if (fs.existsSync(path)) {
|
32
|
+
if (callback === null) {
|
33
|
+
return fs.readFileSync(path);
|
34
|
+
}
|
35
|
+
|
36
|
+
callback(fs.readFileSync(path));
|
37
|
+
} else {
|
38
|
+
return fileHandler.writeFile(path, getRunnerDetail());
|
39
|
+
}
|
40
|
+
},
|
41
|
+
writeFile: (path, data) => {
|
42
|
+
fs.writeFileSync(path, JSON.stringify(data));
|
43
|
+
return JSON.stringify(data);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
exports.fileHandler = fileHandler;
|
47
|
+
|
48
|
+
const isObject = obj => obj && obj.constructor === {}.constructor;
|
49
|
+
|
50
|
+
const isArray = obj => obj && obj.constructor === [].constructor; // In below funtion
|
51
|
+
// this function is for concat two json object like _.extend,
|
52
|
+
// if botha array we concat them
|
53
|
+
// if both object we use call this function recurcively
|
54
|
+
// if both differend data type we will just assign it
|
55
|
+
|
56
|
+
|
57
|
+
let jsonConcate = (receiverObj, senterObj) => {
|
58
|
+
Object.keys(senterObj).map(key => {
|
59
|
+
if (Object.prototype.hasOwnProperty.call(receiverObj, key)) {
|
60
|
+
if (isObject(receiverObj[key]) && isObject(senterObj[key])) {
|
61
|
+
jsonConcate(receiverObj[key], senterObj[key]);
|
62
|
+
} else if (isArray(receiverObj[key]) && isArray(senterObj[key])) {
|
63
|
+
receiverObj[key] = receiverObj[key].concat(senterObj[key]);
|
64
|
+
} else {
|
65
|
+
receiverObj[key] = senterObj[key];
|
66
|
+
}
|
67
|
+
} else {
|
68
|
+
receiverObj[key] = senterObj[key];
|
69
|
+
}
|
70
|
+
|
71
|
+
return key;
|
72
|
+
});
|
73
|
+
return receiverObj;
|
74
|
+
};
|
75
|
+
|
76
|
+
exports.jsonConcate = jsonConcate;
|
77
|
+
|
78
|
+
let jsonHelper = (path, pathArray, value) => {
|
79
|
+
let tempObj = {};
|
80
|
+
|
81
|
+
if (typeof pathArray === 'string') {
|
82
|
+
pathArray = pathArray.split('.'); //eslint-disable-line no-param-reassign
|
83
|
+
}
|
84
|
+
|
85
|
+
pathArray.slice(0).reverse().map(key => {
|
86
|
+
tempObj = {};
|
87
|
+
tempObj[key] = value;
|
88
|
+
value = tempObj; // eslint-disable-line no-param-reassign
|
89
|
+
|
90
|
+
return key;
|
91
|
+
});
|
92
|
+
let overAllObj = jsonConcate(JSON.parse(fileHandler.readFile(path)), tempObj);
|
93
|
+
fileHandler.writeFile(path, overAllObj);
|
94
|
+
};
|
95
|
+
|
96
|
+
exports.jsonHelper = jsonHelper;
|
97
|
+
|
98
|
+
let setTestInfoStatus = (filepath, status) => {
|
99
|
+
let buildObject = JSON.parse(fileHandler.readFile(filepath));
|
100
|
+
|
101
|
+
if (!buildObject.testInfo || buildObject.testInfo.isBuildVerified !== false) {
|
102
|
+
jsonHelper(filepath, 'testInfo.isBuildVerified', status);
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
exports.setTestInfoStatus = setTestInfoStatus;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _utils = require("../utils");
|
9
|
+
|
10
|
+
let options = (0, _utils.getOptions)();
|
11
|
+
let {
|
12
|
+
impactService: {
|
13
|
+
componentServiceName,
|
14
|
+
svgServiceName,
|
15
|
+
iconServiceName,
|
16
|
+
variableServiceName,
|
17
|
+
dotServiceName,
|
18
|
+
sourceServiceName
|
19
|
+
}
|
20
|
+
} = options;
|
21
|
+
var _default = {
|
22
|
+
AppSource: {
|
23
|
+
impactService: sourceServiceName,
|
24
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
25
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080"
|
26
|
+
},
|
27
|
+
"components": {
|
28
|
+
projectId: "5515",
|
29
|
+
impactService: componentServiceName,
|
30
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
31
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080",
|
32
|
+
name: "@zohodesk/components"
|
33
|
+
},
|
34
|
+
"dot": {
|
35
|
+
projectId: "5515",
|
36
|
+
impactService: dotServiceName,
|
37
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
38
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080",
|
39
|
+
name: "@zohodesk/dot"
|
40
|
+
},
|
41
|
+
"svg": {
|
42
|
+
projectId: "5515",
|
43
|
+
impactService: svgServiceName,
|
44
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
45
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080",
|
46
|
+
name: "@zohodesk/svg"
|
47
|
+
},
|
48
|
+
"icons": {
|
49
|
+
projectId: "5515",
|
50
|
+
impactService: iconServiceName,
|
51
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
52
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080",
|
53
|
+
name: "@zohodesk/icons"
|
54
|
+
},
|
55
|
+
"variables": {
|
56
|
+
projectId: "5515",
|
57
|
+
impactService: variableServiceName,
|
58
|
+
gitDomain: "ht" + "tps://zgit.csez.zohocorpin.com",
|
59
|
+
impactDomain: "ht" + "tp://desk-automation.csez.zohocorpin.com:8080",
|
60
|
+
name: "@zohodesk/variables"
|
61
|
+
}
|
62
|
+
};
|
63
|
+
exports.default = _default;
|