@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171

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.
Files changed (292) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +49 -10
  3. package/.prettierrc +6 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +859 -0
  6. package/bin/cli.js +215 -46
  7. package/cert/Tsicsezwild-22-23.crt +37 -0
  8. package/cert/Tsicsezwild-22-23.key +27 -0
  9. package/docs/CustomChunks.md +26 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/TODOS.md +10 -0
  14. package/docs/ValueReplacer.md +60 -0
  15. package/docs/warnings_while_install.txt +35 -0
  16. package/files/eslintrc.js +62 -0
  17. package/files/prettierrc.js +3 -0
  18. package/lib/babel/cmjs-plugins-presets.js +24 -0
  19. package/lib/babel/es-plugins-presets.js +34 -0
  20. package/lib/common/getEntries.js +33 -46
  21. package/lib/common/getPublicPathConfig.js +40 -0
  22. package/lib/common/index.js +24 -19
  23. package/lib/common/splitChunks.js +110 -25
  24. package/lib/common/sslcertUpdater.js +59 -0
  25. package/lib/common/templateParameters.js +25 -0
  26. package/lib/common/testPattern.js +69 -0
  27. package/lib/common/valueReplacer.js +55 -0
  28. package/lib/configs/jest.config.js +31 -27
  29. package/lib/configs/libAlias.js +31 -0
  30. package/lib/configs/webpack.component.umd.config.js +46 -53
  31. package/lib/configs/webpack.css.umd.config.js +47 -46
  32. package/lib/configs/webpack.dev.config.js +99 -84
  33. package/lib/configs/webpack.docs.config.js +65 -57
  34. package/lib/configs/webpack.impact.config.js +109 -0
  35. package/lib/configs/webpack.prod.config.js +147 -104
  36. package/lib/hooks/docsProptypeHook.js +32 -38
  37. package/lib/jest/commitedFilesResult.js +144 -71
  38. package/lib/jest/coverageCollector.js +68 -35
  39. package/lib/jest/jsonMaker.js +54 -0
  40. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  41. package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  43. package/lib/jest/result.js +92 -42
  44. package/lib/jest/run.js +75 -28
  45. package/lib/jest/setup.js +103 -102
  46. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  47. package/lib/loaderUtils/getCSSLoaders.js +113 -0
  48. package/lib/loaderUtils/getDevJsLoaders.js +35 -23
  49. package/lib/loaderUtils/index.js +14 -7
  50. package/lib/loaders/docsLoader.js +15 -15
  51. package/lib/loaders/docsPropsLoader.js +14 -17
  52. package/lib/loaders/fileBountryLoader.js +17 -0
  53. package/lib/loaders/fileLoader.js +47 -38
  54. package/lib/loaders/scriptInstrumentLoader.js +23 -20
  55. package/lib/loaders/selectorMappingLoader.js +75 -0
  56. package/lib/loaders/workerLoader.js +136 -0
  57. package/lib/middlewares/HMRMiddleware.js +90 -72
  58. package/lib/middlewares/SSTMiddleware.js +21 -0
  59. package/lib/pluginUtils/getDevPlugins.js +177 -30
  60. package/lib/pluginUtils/getDocsPlugins.js +36 -15
  61. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  62. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  63. package/lib/pluginUtils/getProdPlugins.js +244 -37
  64. package/lib/pluginUtils/getServerPlugins.js +8 -11
  65. package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
  66. package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
  67. package/lib/pluginUtils/index.js +36 -43
  68. package/lib/plugins/CdnChangePlugin.js +77 -0
  69. package/lib/plugins/CleanupStatsPlugin.js +28 -0
  70. package/lib/plugins/EFCPlugin.js +241 -0
  71. package/lib/plugins/EFCPlugin.md +6 -0
  72. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  73. package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
  74. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  75. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  76. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  77. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  78. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  79. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  80. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  81. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  82. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  83. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  87. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  88. package/lib/plugins/ManifestPlugin.js +86 -0
  89. package/lib/plugins/ModuleStatsPlugin.js +98 -97
  90. package/lib/plugins/OptimizeJSPlugin.js +41 -0
  91. package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
  92. package/lib/plugins/PublicPathChangePlugin.js +226 -0
  93. package/lib/plugins/ReportGeneratePlugin.js +181 -0
  94. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  95. package/lib/plugins/ResourceHintsPlugin.js +67 -0
  96. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
  97. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
  98. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  99. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
  100. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  101. package/lib/plugins/ServiceWorkerPlugin.js +107 -0
  102. package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
  103. package/lib/plugins/SourceMapHookPlugin.js +25 -59
  104. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  105. package/lib/plugins/UglifyCSSPlugin.js +39 -0
  106. package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
  107. package/lib/plugins/index.js +127 -37
  108. package/lib/plugins/libraryImpactPlugin.js +190 -0
  109. package/lib/plugins/webpackwatchrunplugin.js +26 -0
  110. package/lib/postcss-plugins/ExcludePlugin.js +23 -0
  111. package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
  112. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  113. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  114. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  115. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  116. package/lib/postcss-plugins/hoverActivePlugin.js +368 -0
  117. package/lib/postcss-plugins/variableModifier.js +243 -0
  118. package/lib/schemas/index.js +541 -65
  119. package/lib/servers/clusterHubServer.js +22 -26
  120. package/lib/servers/devBuild.js +102 -0
  121. package/lib/servers/docsServer.js +3 -5
  122. package/lib/servers/docsServerCore.js +94 -79
  123. package/lib/servers/getCliPath.js +28 -0
  124. package/lib/servers/helpServer.js +19 -21
  125. package/lib/servers/httpsOptions.js +18 -0
  126. package/lib/servers/impactServer.js +123 -115
  127. package/lib/servers/mockserver.js +44 -0
  128. package/lib/servers/nowatchserver.js +200 -0
  129. package/lib/servers/scrServer.js +147 -0
  130. package/lib/servers/server.js +134 -132
  131. package/lib/servers/ssServer.js +106 -70
  132. package/lib/sh/reportPublish.sh +16 -10
  133. package/lib/templates/CoverageScriptTemplate.js +45 -18
  134. package/lib/templates/WMSTemplate.js +17 -18
  135. package/lib/templates/linterConstant.js +10 -0
  136. package/lib/utils/babelPresets.js +12 -4
  137. package/lib/utils/buildstats.html +148 -0
  138. package/lib/utils/clean.js +12 -11
  139. package/lib/utils/copy.js +16 -109
  140. package/lib/utils/copyTimezones.js +21 -0
  141. package/lib/utils/createEventStream.js +24 -19
  142. package/lib/utils/cssClassNameGenerate.js +77 -0
  143. package/lib/utils/cssURLReplacer.js +136 -0
  144. package/lib/utils/dependencyPostPublish.js +42 -0
  145. package/lib/utils/fileUtils.js +125 -0
  146. package/lib/utils/folderIterator.js +47 -0
  147. package/lib/utils/getComponents.js +126 -0
  148. package/lib/utils/getCurrentBranch.js +11 -17
  149. package/lib/utils/getDependenciesImpactList.js +151 -0
  150. package/lib/utils/getHash.js +26 -0
  151. package/lib/utils/getIp.js +20 -0
  152. package/lib/utils/getOptions.js +113 -28
  153. package/lib/utils/getServerURL.js +25 -8
  154. package/lib/utils/index.js +283 -68
  155. package/lib/utils/init.js +2 -2
  156. package/lib/utils/initPreCommitHook.js +47 -27
  157. package/lib/utils/jsonHelper.js +106 -0
  158. package/lib/utils/libraryImpactConfig.js +63 -0
  159. package/lib/utils/lint/addScripts.js +27 -0
  160. package/lib/utils/lint/checkExistingConfig.js +67 -0
  161. package/lib/utils/lint/copyConfigs.js +24 -0
  162. package/lib/utils/lint/index.js +54 -0
  163. package/lib/utils/lint/lintScripts.js +11 -0
  164. package/lib/utils/lint/lintSetup.js +31 -0
  165. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  166. package/lib/utils/lint/question.js +30 -0
  167. package/lib/utils/lintReporter.js +142 -0
  168. package/lib/utils/mailSender.js +16 -25
  169. package/lib/utils/pullOrigin.js +28 -0
  170. package/lib/utils/reinstallDependencies.js +133 -0
  171. package/lib/utils/removeAttributes.js +25 -23
  172. package/lib/utils/repoClone.js +59 -63
  173. package/lib/utils/request.js +64 -77
  174. package/lib/utils/resultSchema.json +73 -0
  175. package/lib/utils/rtl.js +59 -0
  176. package/lib/utils/setEnvVariables.js +13 -0
  177. package/lib/utils/ssTestHack.js +48 -0
  178. package/lib/utils/switchBranch.js +28 -0
  179. package/lib/utils/urlConcat.js +22 -0
  180. package/lib/utils/useExitCleanup.js +55 -0
  181. package/npm8.md +9 -0
  182. package/package.json +96 -64
  183. package/postpublish.js +6 -0
  184. package/templates/app/.eslintrc.js +140 -0
  185. package/templates/app/README.md +12 -12
  186. package/templates/app/app/index.html +24 -8
  187. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  188. package/templates/app/app/properties/i18nkeys.json +3 -3
  189. package/templates/app/docs/all.html +69 -69
  190. package/templates/app/mockapi/index.js +18 -13
  191. package/templates/app/package.json +37 -17
  192. package/templates/app/src/actions/SampleActions/index.js +37 -0
  193. package/templates/app/src/actions/index.js +65 -0
  194. package/templates/app/src/appUrls.js +19 -0
  195. package/templates/app/src/components/Alert/Alert.js +134 -0
  196. package/templates/app/src/components/Alert/Alert.module.css +79 -0
  197. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
  198. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
  199. package/templates/app/src/components/Sample/Sample.module.css +11 -0
  200. package/templates/app/src/components/Sample/SampleList.js +61 -0
  201. package/templates/app/src/components/Slider/Slider.css +41 -0
  202. package/templates/app/src/components/Slider/Slider.js +55 -0
  203. package/templates/app/src/containers/AlertContainer/index.js +15 -0
  204. package/templates/app/src/containers/AppContainer/index.js +96 -0
  205. package/templates/app/src/containers/AppContainer/index.module.css +27 -0
  206. package/templates/app/src/containers/CustomMatch/index.js +65 -0
  207. package/templates/app/src/containers/DevTools/index.js +10 -0
  208. package/templates/app/src/containers/Header/index.js +67 -0
  209. package/templates/app/src/containers/Header/index.module.css +43 -0
  210. package/templates/app/src/containers/Redirect/index.js +63 -0
  211. package/templates/app/src/containers/Redirector/index.js +47 -0
  212. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
  213. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
  214. package/templates/app/src/historyChange.js +5 -0
  215. package/templates/app/src/index.html +10 -0
  216. package/templates/app/src/index.js +24 -0
  217. package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
  218. package/templates/app/src/reducers/alertData.js +11 -0
  219. package/templates/app/src/reducers/index.js +6 -0
  220. package/templates/app/src/reducers/samples.js +19 -0
  221. package/templates/app/src/store/configureStore.dev.js +51 -0
  222. package/templates/app/src/store/configureStore.js +5 -0
  223. package/templates/app/src/store/configureStore.prod.js +26 -0
  224. package/templates/app/src/util/Common.js +5 -0
  225. package/templates/app/src/util/RequestAPI.js +132 -0
  226. package/templates/appold/README.md +12 -0
  227. package/templates/appold/app/index.html +8 -0
  228. package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
  229. package/templates/appold/app/properties/i18nkeys.json +3 -0
  230. package/templates/appold/docs/all.html +69 -0
  231. package/templates/appold/mockapi/index.js +13 -0
  232. package/templates/{app → appold}/mockapi/tickets.json +0 -0
  233. package/templates/appold/package.json +17 -0
  234. package/templates/appold/src/components/Text/Text.css +0 -0
  235. package/templates/appold/src/components/Text/Text.js +23 -0
  236. package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
  237. package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
  238. package/templates/appold/src/components/docs.js +1 -0
  239. package/templates/appold/src/components/index.js +5 -0
  240. package/templates/appold/src/index.js +13 -0
  241. package/templates/docs/all.html +1 -1
  242. package/templates/docs/component.html +110 -69
  243. package/templates/docs/components.html +221 -0
  244. package/templates/docs/css/component.css +12 -14
  245. package/templates/docs/css/componentTest.css +7 -0
  246. package/templates/docs/css/style.css +150 -206
  247. package/templates/docs/impactReportTemplate.html +154 -0
  248. package/templates/docs/index.html +1482 -1336
  249. package/templates/library/src/index.js +0 -0
  250. package/.npmignore +0 -3
  251. package/cert/cert.pem +0 -129
  252. package/cert/key.pem +0 -27
  253. package/lib/common/getInsertAt.js +0 -36
  254. package/lib/common/getInsertIntoFunction.js +0 -13
  255. package/lib/configs/webpack.server.config.js +0 -93
  256. package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
  257. package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
  258. package/lib/rmcntrlm.sh +0 -14
  259. package/lib/servers/nodeServer.js +0 -238
  260. package/lib/templates/HMRTemplate.js +0 -256
  261. package/lib/templates/publicPathTemplate.js +0 -16
  262. package/lib/utils/setConfig.js +0 -14
  263. package/node_modules/history/CHANGES.md +0 -395
  264. package/node_modules/history/DOMUtils.js +0 -3
  265. package/node_modules/history/ExecutionEnvironment.js +0 -3
  266. package/node_modules/history/LICENSE +0 -21
  267. package/node_modules/history/LocationUtils.js +0 -3
  268. package/node_modules/history/PathUtils.js +0 -3
  269. package/node_modules/history/README.md +0 -282
  270. package/node_modules/history/cjs/history.js +0 -933
  271. package/node_modules/history/cjs/history.min.js +0 -1
  272. package/node_modules/history/createBrowserHistory.js +0 -3
  273. package/node_modules/history/createHashHistory.js +0 -3
  274. package/node_modules/history/createMemoryHistory.js +0 -3
  275. package/node_modules/history/createTransitionManager.js +0 -3
  276. package/node_modules/history/es/DOMUtils.js +0 -7
  277. package/node_modules/history/es/ExecutionEnvironment.js +0 -7
  278. package/node_modules/history/es/LocationUtils.js +0 -7
  279. package/node_modules/history/es/PathUtils.js +0 -7
  280. package/node_modules/history/es/createBrowserHistory.js +0 -7
  281. package/node_modules/history/es/createHashHistory.js +0 -7
  282. package/node_modules/history/es/createMemoryHistory.js +0 -7
  283. package/node_modules/history/es/createTransitionManager.js +0 -7
  284. package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
  285. package/node_modules/history/esm/history.js +0 -904
  286. package/node_modules/history/index.js +0 -7
  287. package/node_modules/history/package.json +0 -134
  288. package/node_modules/history/umd/history.js +0 -1059
  289. package/node_modules/history/umd/history.min.js +0 -1
  290. package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
  291. package/templates/app/.npmignore +0 -9
  292. package/templates/library/.npmignore +0 -9
@@ -1,114 +1,329 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.makeDir = exports.writeFile = exports.log = exports.request = exports.getCurrentBranch = exports.getServerURL = exports.createEventStream = exports.getOptions = undefined;
7
-
8
- var _getOptions = require('./getOptions');
9
-
10
- Object.defineProperty(exports, 'getOptions', {
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 get() {
13
- return _interopRequireDefault(_getOptions).default;
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 get() {
22
- return _interopRequireDefault(_createEventStream).default;
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 get() {
31
- return _interopRequireDefault(_getServerURL).default;
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 get() {
40
- return _interopRequireDefault(_getCurrentBranch).default;
44
+ get: function () {
45
+ return _getDependenciesImpactList.default;
41
46
  }
42
47
  });
43
-
44
- var _request = require('./request');
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 get() {
49
- return _interopRequireDefault(_request).default;
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 _initPreCommitHook = require('./initPreCommitHook');
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 get() {
150
+ get: function () {
60
151
  return _initPreCommitHook[key];
61
152
  }
62
153
  });
63
154
  });
64
155
 
65
- var _stream = require('stream');
156
+ var _getDependenciesImpactList = _interopRequireDefault(require("./getDependenciesImpactList"));
66
157
 
67
- var _fs = require('fs');
158
+ var _getComponents = _interopRequireDefault(require("./getComponents"));
68
159
 
69
- var _fs2 = _interopRequireDefault(_fs);
160
+ var _ssTestHack = _interopRequireDefault(require("./ssTestHack"));
70
161
 
71
162
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
72
163
 
73
- var log = exports.log = function log() {
74
- var print = console;
75
- print.log.apply(print, arguments);
164
+ let log = (...info) => {
165
+ let print = console;
166
+ print.log(...info);
76
167
  };
77
168
 
78
- var writeFile = exports.writeFile = function writeFile(outputPath, src) {
79
- var isPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
80
- return new Promise(function (resolve, reject) {
81
- var inStr = void 0;
82
- if (isPath) {
83
- inStr = _fs2.default.createReadStream(src);
84
- } else {
85
- inStr = new _stream.Readable();
86
- inStr._read = function () {
87
- return true;
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.pipe(outStr);
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
- var makeDir = exports.makeDir = function makeDir(paths) {
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
- paths.forEach(function (path) {
110
- if (!_fs2.default.existsSync(path)) {
111
- _fs2.default.mkdirSync(path);
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,5 +1,5 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _initPreCommitHook = require('./initPreCommitHook');
3
+ var _initPreCommitHook = require("./initPreCommitHook");
4
4
 
5
5
  (0, _initPreCommitHook.initPreCommitHook)(true);
@@ -1,62 +1,82 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.initPreCommitHook = exports.getGitRootDir = undefined;
6
+ exports.initPreCommitHook = exports.getGitRootDir = void 0;
7
7
 
8
- var _fs = require('fs');
8
+ var _fs = _interopRequireDefault(require("fs"));
9
9
 
10
- var _fs2 = _interopRequireDefault(_fs);
10
+ var _path = _interopRequireDefault(require("path"));
11
11
 
12
- var _path = require('path');
12
+ var _child_process = require("child_process");
13
13
 
14
- var _path2 = _interopRequireDefault(_path);
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
- /*eslint no-console: ["error", { allow: ["log"] }] */
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
- var initPreCommitHook = exports.initPreCommitHook = function initPreCommitHook() {
32
- var forReactCLI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
45
+ let initPreCommitHook = (forReactCLI = false) => {
46
+ let gitRootDir = getGitRootDir(); //copyEslintConfig(gitRootDir || process.cwd());
33
47
 
34
- var gitRootDir = getGitRootDir();
35
48
  if (gitRootDir) {
36
- var precommit = _fs2.default.readFileSync(_path2.default.join(__dirname, '../sh/pre-commit.sh')).toString();
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
- var targetPath = _path2.default.join(gitRootDir, '.git', 'hooks', 'pre-commit').replace(/\s/g, '');
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
- var packagePath = _path2.default.join(process.cwd(), 'package.json');
64
+ let packagePath = _path.default.join(process.cwd(), 'package.json');
65
+
48
66
  try {
49
- var packageJson = require(packagePath);
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
- _fs2.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
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
- // custom console
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;