@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3

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 (222) hide show
  1. package/README.md +18 -0
  2. package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
  3. package/lib/babel/cmjs-plugins-presets.js +13 -2
  4. package/lib/babel/es-plugins-presets.js +14 -3
  5. package/lib/common/buildEs.js +0 -1
  6. package/lib/common/getEntries.js +13 -2
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +6 -1
  9. package/lib/common/runPreProcess.js +15 -6
  10. package/lib/common/splitChunks.js +21 -2
  11. package/lib/common/sslcertUpdater.js +18 -7
  12. package/lib/common/templateParameters.js +2 -0
  13. package/lib/common/testPattern.js +21 -10
  14. package/lib/common/valueReplacer.js +16 -1
  15. package/lib/configs/jest.config.js +11 -2
  16. package/lib/configs/libAlias.js +16 -10
  17. package/lib/configs/resolvers.js +16 -6
  18. package/lib/configs/webpack.component.umd.config.js +6 -1
  19. package/lib/configs/webpack.css.umd.config.js +14 -6
  20. package/lib/configs/webpack.dev.config.js +14 -1
  21. package/lib/configs/webpack.docs.config.js +9 -1
  22. package/lib/configs/webpack.impact.config.js +8 -1
  23. package/lib/configs/webpack.prod.config.js +17 -4
  24. package/lib/constants.js +18 -9
  25. package/lib/deprecationLogger.js +7 -0
  26. package/lib/hooks/docsProptypeHook.js +8 -4
  27. package/lib/jest/commitedFilesResult.js +46 -4
  28. package/lib/jest/coverageCollector.js +12 -1
  29. package/lib/jest/jsonMaker.js +6 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
  31. package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
  33. package/lib/jest/result.js +23 -1
  34. package/lib/jest/run.js +18 -7
  35. package/lib/jest/setup.js +60 -8
  36. package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
  37. package/lib/loaderUtils/getCSSLoaders.js +22 -10
  38. package/lib/loaderUtils/getDevJsLoaders.js +13 -4
  39. package/lib/loaderUtils/index.js +4 -1
  40. package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
  41. package/lib/loaderUtils/windowsModification.js +3 -2
  42. package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
  43. package/lib/loaders/composeLoader.js +37 -13
  44. package/lib/loaders/docsLoader.js +12 -1
  45. package/lib/loaders/docsPropsLoader.js +8 -4
  46. package/lib/loaders/enhancedReactLiveConverter.js +23 -2
  47. package/lib/loaders/fileBountryLoader.js +3 -1
  48. package/lib/loaders/fileLoader.js +23 -12
  49. package/lib/loaders/markdownLoader.js +19 -14
  50. package/lib/loaders/reactLiveConvertor.js +15 -5
  51. package/lib/loaders/scriptInstrumentLoader.js +16 -7
  52. package/lib/loaders/selectorMappingLoader.js +26 -7
  53. package/lib/loaders/workerLoader.js +24 -9
  54. package/lib/logger.js +4 -0
  55. package/lib/middlewares/HMRMiddleware.js +27 -13
  56. package/lib/middlewares/SSTMiddleware.js +5 -1
  57. package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
  58. package/lib/pluginUtils/getDevPlugins.js +42 -9
  59. package/lib/pluginUtils/getDocsPlugins.js +13 -3
  60. package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
  61. package/lib/pluginUtils/getLibraryPlugins.js +8 -2
  62. package/lib/pluginUtils/getProdPlugins.js +47 -8
  63. package/lib/pluginUtils/getServerPlugins.js +8 -2
  64. package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
  65. package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
  66. package/lib/pluginUtils/index.js +9 -1
  67. package/lib/plugins/CdnChangePlugin.js +18 -2
  68. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  69. package/lib/plugins/CssOrderControlPlugin.js +6 -3
  70. package/lib/plugins/CustomAttributePlugin.js +19 -14
  71. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
  72. package/lib/plugins/EFCPlugin.js +34 -20
  73. package/lib/plugins/EFCTemplatePlugin.js +30 -19
  74. package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
  75. package/lib/plugins/EventsHandlingPlugin.js +4 -2
  76. package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
  77. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  79. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
  80. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
  81. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
  82. package/lib/plugins/I18nSplitPlugin/index.js +24 -13
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
  89. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
  90. package/lib/plugins/ManifestPlugin.js +18 -1
  91. package/lib/plugins/MinifyPlugin.js +10 -1
  92. package/lib/plugins/ModuleStatsPlugin.js +24 -1
  93. package/lib/plugins/OptimizeJSPlugin.js +10 -2
  94. package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
  95. package/lib/plugins/PublicPathChangePlugin.js +39 -6
  96. package/lib/plugins/ReportGeneratePlugin.js +32 -5
  97. package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
  98. package/lib/plugins/ResourceHintsPlugin.js +13 -4
  99. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  100. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
  101. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  102. package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
  103. package/lib/plugins/SelectorPlugin.js +32 -6
  104. package/lib/plugins/ServiceWorkerPlugin.js +22 -5
  105. package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
  106. package/lib/plugins/SourceMapHookPlugin.js +12 -2
  107. package/lib/plugins/StatsPlugin.js +14 -0
  108. package/lib/plugins/TPHashMappingPlugin.js +18 -3
  109. package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
  110. package/lib/plugins/VariableConversionCollector.js +42 -15
  111. package/lib/plugins/index.js +20 -1
  112. package/lib/plugins/libraryImpactPlugin.js +33 -1
  113. package/lib/plugins/utils/classHandling.js +6 -0
  114. package/lib/plugins/utils/fileHandling.js +15 -6
  115. package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
  116. package/lib/plugins/variableConvertorUtils.js +29 -14
  117. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  118. package/lib/postcss-plugins/EmptyPlugin.js +4 -3
  119. package/lib/postcss-plugins/ExcludePlugin.js +5 -1
  120. package/lib/postcss-plugins/IncludePlugin.js +5 -1
  121. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  122. package/lib/postcss-plugins/SelectorReplace.js +16 -1
  123. package/lib/postcss-plugins/ValueReplacer.js +6 -7
  124. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  125. package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
  126. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
  127. package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
  128. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
  129. package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
  130. package/lib/schemas/index.js +10 -3
  131. package/lib/servers/clusterHubServer.js +11 -1
  132. package/lib/servers/devBuild.js +26 -14
  133. package/lib/servers/docsServer.js +3 -1
  134. package/lib/servers/docsServerCore.js +22 -1
  135. package/lib/servers/getCliPath.js +9 -0
  136. package/lib/servers/helpServer.js +6 -1
  137. package/lib/servers/httpsOptions.js +8 -2
  138. package/lib/servers/impactServer.js +35 -3
  139. package/lib/servers/mockserver.js +10 -1
  140. package/lib/servers/nowatchserver.js +37 -12
  141. package/lib/servers/requireLocalOrGlobal.js +17 -6
  142. package/lib/servers/scrServer.js +21 -14
  143. package/lib/servers/server.js +36 -6
  144. package/lib/servers/ssServer.js +17 -1
  145. package/lib/templates/CoverageScriptTemplate.js +14 -0
  146. package/lib/templates/WMSTemplate.js +13 -7
  147. package/lib/templates/linterConstant.js +4 -2
  148. package/lib/utils/babelPresets.js +7 -3
  149. package/lib/utils/clean.js +9 -3
  150. package/lib/utils/copy.js +7 -1
  151. package/lib/utils/copyTimezones.js +9 -1
  152. package/lib/utils/createEventStream.js +6 -1
  153. package/lib/utils/cssClassNameGenerate.js +30 -10
  154. package/lib/utils/cssURLReplacer.js +22 -1
  155. package/lib/utils/dependencyPostPublish.js +10 -1
  156. package/lib/utils/deprecationSupport.js +32 -7
  157. package/lib/utils/fileUtils.js +28 -1
  158. package/lib/utils/folderIterator.js +13 -2
  159. package/lib/utils/getComponents.js +21 -0
  160. package/lib/utils/getCurrentBranch.js +5 -0
  161. package/lib/utils/getDependenciesImpactList.js +22 -1
  162. package/lib/utils/getFileType.js +10 -2
  163. package/lib/utils/getHash.js +8 -1
  164. package/lib/utils/getIp.js +2 -0
  165. package/lib/utils/getOptions.js +53 -16
  166. package/lib/utils/getServerURL.js +10 -1
  167. package/lib/utils/index.js +51 -4
  168. package/lib/utils/init.js +1 -0
  169. package/lib/utils/initPreCommitHook.js +30 -7
  170. package/lib/utils/jsonHelper.js +22 -3
  171. package/lib/utils/libraryImpactConfig.js +5 -2
  172. package/lib/utils/lint/addScripts.js +5 -2
  173. package/lib/utils/lint/checkExistingConfig.js +12 -3
  174. package/lib/utils/lint/copyConfigs.js +3 -0
  175. package/lib/utils/lint/index.js +9 -0
  176. package/lib/utils/lint/lintScripts.js +1 -0
  177. package/lib/utils/lint/lintSetup.js +4 -3
  178. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  179. package/lib/utils/lint/question.js +7 -0
  180. package/lib/utils/lintReporter.js +20 -0
  181. package/lib/utils/log.js +1 -0
  182. package/lib/utils/mailSender.js +8 -1
  183. package/lib/utils/object-manipulation.js +17 -1
  184. package/lib/utils/pullOrigin.js +4 -0
  185. package/lib/utils/reinstallDependencies.js +29 -1
  186. package/lib/utils/removeAttributes.js +8 -1
  187. package/lib/utils/repoClone.js +28 -3
  188. package/lib/utils/request.js +12 -0
  189. package/lib/utils/rtl.js +17 -5
  190. package/lib/utils/selectorReplacer.js +16 -10
  191. package/lib/utils/setEnvVariables.js +2 -0
  192. package/lib/utils/ssTestHack.js +11 -1
  193. package/lib/utils/switchBranch.js +5 -0
  194. package/lib/utils/typeCheck.js +1 -0
  195. package/lib/utils/urlConcat.js +4 -0
  196. package/lib/utils/useExitCleanup.js +10 -9
  197. package/lib/utils/variableConverter.js +31 -22
  198. package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
  199. package/package.json +3 -2
  200. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
  201. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
  202. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
  203. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
  204. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
  205. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
  206. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
  207. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
  208. package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
  209. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
  210. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
  211. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
  212. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
  213. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
  214. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
  215. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
  216. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
  217. package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
  218. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
  219. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
  220. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
  221. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
  222. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -4,21 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.copy = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
11
+
9
12
  var _index = require("./index");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
11
16
  let removeDirectory = dirPath => {
12
17
  _fs.default.readdirSync(dirPath).forEach(fileOrDir => {
13
18
  let fileOrDirPath = _path.default.join(dirPath, fileOrDir);
19
+
14
20
  if (_fs.default.statSync(fileOrDirPath).isDirectory()) {
15
21
  removeDirectory(fileOrDirPath);
16
22
  } else {
17
23
  _fs.default.unlinkSync(fileOrDirPath);
18
24
  }
19
25
  });
26
+
20
27
  _fs.default.rmdirSync(dirPath);
21
28
  };
29
+
22
30
  let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
23
31
  let {
24
32
  ext,
@@ -26,6 +34,7 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
26
34
  name,
27
35
  root
28
36
  } = _path.default.parse(targetPath);
37
+
29
38
  if (changeExt[ext]) {
30
39
  ext = changeExt[ext];
31
40
  targetPath = _path.default.format({
@@ -35,8 +44,11 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
35
44
  root
36
45
  }); //eslint-disable-line
37
46
  }
47
+
38
48
  let readStream = _fs.default.createReadStream(srcPath);
49
+
39
50
  let writeStream = _fs.default.createWriteStream(targetPath);
51
+
40
52
  readStream.pipe(writeStream);
41
53
  writeStream.on('finish', () => {
42
54
  if (!isCopy) {
@@ -44,23 +56,29 @@ let copyFile = (srcPath, targetPath, isCopy = true, changeExt) => {
44
56
  }
45
57
  });
46
58
  };
59
+
47
60
  let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, changeExt) => {
48
61
  _fs.default.readdirSync(srcPath).forEach(fileOrDir => {
49
62
  let fromPath = _path.default.join(srcPath, fileOrDir);
63
+
50
64
  let toPath = targetPath;
65
+
51
66
  if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
52
67
  toPath = _path.default.join(targetPath, fileOrDir);
53
68
  }
69
+
54
70
  if (_fs.default.statSync(fromPath).isDirectory()) {
55
71
  if (!_fs.default.existsSync(toPath)) {
56
72
  _fs.default.mkdirSync(toPath);
57
73
  }
74
+
58
75
  iterateDirectory(fromPath, toPath, isCopy, extensions, flatten, changeExt);
59
76
  } else {
60
77
  if (extensions) {
61
78
  let {
62
79
  ext
63
80
  } = _path.default.parse(fromPath);
81
+
64
82
  if (extensions.indexOf(ext) !== -1) {
65
83
  copyFile(fromPath, toPath, true, changeExt);
66
84
  }
@@ -70,29 +88,38 @@ let iterateDirectory = (srcPath, targetPath, isCopy, extensions, flatten, change
70
88
  }
71
89
  });
72
90
  };
91
+
73
92
  let copy = (srcPath, targetPath, isCopy, exts, flatten, changeExt = {}) => {
74
93
  if (_fs.default.statSync(srcPath).isDirectory()) {
75
94
  if (!_fs.default.existsSync(targetPath)) {
76
95
  _fs.default.mkdirSync(targetPath);
77
96
  }
97
+
78
98
  let {
79
99
  name
80
100
  } = _path.default.parse(srcPath);
101
+
81
102
  let originPath = targetPath;
103
+
82
104
  if (flatten !== 'flatten') {
83
105
  originPath = _path.default.join(targetPath, name);
106
+
84
107
  if (!_fs.default.existsSync(originPath)) {
85
108
  _fs.default.mkdirSync(originPath);
86
109
  }
87
110
  }
111
+
88
112
  iterateDirectory(srcPath, originPath, isCopy, exts, flatten, changeExt);
89
113
  } else {
90
114
  /* direct file copy issue there but that feature not needed i think*/
91
115
  copyFile(srcPath, targetPath, isCopy, changeExt);
92
116
  }
117
+
93
118
  if (!isCopy) {
94
119
  removeDirectory(srcPath);
95
120
  }
121
+
96
122
  (0, _index.log)(isCopy ? 'Folder/file are copied!' : 'Folder/file are moved!');
97
123
  };
124
+
98
125
  exports.copy = copy;
@@ -4,26 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _fs = _interopRequireDefault(require("fs"));
9
+
8
10
  var _path = _interopRequireDefault(require("path"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
11
15
  _fs.default.readdirSync(srcPath).forEach(fileOrDir => {
12
16
  let fromPath = _path.default.join(srcPath, fileOrDir);
17
+
13
18
  let toPath = targetPath;
19
+
14
20
  if (flatten !== 'flatten' || !_fs.default.statSync(fromPath).isDirectory()) {
15
21
  toPath = _path.default.join(targetPath, fileOrDir);
16
22
  }
23
+
17
24
  if (_fs.default.statSync(fromPath).isDirectory()) {
18
25
  if (!_fs.default.existsSync(toPath)) {
19
26
  _fs.default.mkdirSync(toPath);
20
27
  }
28
+
21
29
  iterateDirectory(fromPath, toPath, extensions, flatten, cb);
22
30
  } else {
23
31
  if (extensions) {
24
32
  let {
25
33
  ext
26
34
  } = _path.default.parse(fromPath);
35
+
27
36
  if (extensions.indexOf(ext) !== -1) {
28
37
  cb(fromPath, toPath);
29
38
  }
@@ -33,4 +42,6 @@ let iterateDirectory = (srcPath, targetPath, extensions, flatten, cb) => {
33
42
  }
34
43
  });
35
44
  };
36
- var _default = exports.default = iterateDirectory;
45
+
46
+ var _default = iterateDirectory;
47
+ exports.default = _default;
@@ -4,20 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  let eliminateDuplicates = inputList => {
8
9
  let outputList = [];
9
10
  let tempObj = {};
11
+
10
12
  for (let i = 0; i < inputList.length; i++) {
11
13
  tempObj[inputList[i]] = 1;
12
14
  }
15
+
13
16
  for (let j in tempObj) {
14
17
  if (tempObj[j]) {
15
18
  outputList.push(j);
16
19
  }
17
20
  }
21
+
18
22
  outputList = outputList.filter(item => item);
19
23
  return outputList;
20
24
  };
25
+
21
26
  let removeExtn = componentObjectList => {
22
27
  let fileNameArray = [];
23
28
  componentObjectList.forEach(fileObject => {
@@ -26,31 +31,41 @@ let removeExtn = componentObjectList => {
26
31
  });
27
32
  return fileNameArray;
28
33
  };
34
+
29
35
  let getChangedFileName = impactedObject => {
30
36
  let changedComponentsList = [];
37
+
31
38
  if (impactedObject.ADDED && impactedObject.ADDED.length) {
32
39
  changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.ADDED));
33
40
  }
41
+
34
42
  if (impactedObject.UPDATED && impactedObject.UPDATED.length) {
35
43
  changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.UPDATED));
36
44
  }
45
+
37
46
  if (impactedObject.REMOVED && impactedObject.REMOVED.length) {
38
47
  changedComponentsList = changedComponentsList.concat(removeExtn(impactedObject.REMOVED));
39
48
  }
49
+
40
50
  return changedComponentsList;
41
51
  };
52
+
42
53
  let referencedbyList = [];
54
+
43
55
  let getReferencedBy = (moduleDataObject, fileName) => {
44
56
  if (moduleDataObject[fileName]) {
45
57
  let referenceObject = moduleDataObject[fileName];
46
58
  let referencedbyObject = referenceObject.referencedby;
59
+
47
60
  if (referencedbyObject.length) {
48
61
  if (!referencedbyList.includes(referenceObject.docsName)) {
49
62
  referencedbyList.push(referenceObject.docsName);
50
63
  }
64
+
51
65
  referencedbyObject.forEach(referencedByFile => {
52
66
  if (!referencedbyList.includes(moduleDataObject[referencedByFile].docsName)) {
53
67
  let result = getReferencedBy(moduleDataObject, referencedByFile);
68
+
54
69
  if (typeof result === 'string') {
55
70
  referencedbyList.push(result);
56
71
  }
@@ -60,8 +75,10 @@ let getReferencedBy = (moduleDataObject, fileName) => {
60
75
  return fileName;
61
76
  }
62
77
  }
78
+
63
79
  return referencedbyList;
64
80
  };
81
+
65
82
  let checkDocs = AppComponentObject => {
66
83
  let unDocsComponentNameList = [];
67
84
  Object.keys(AppComponentObject).forEach(actionKey => {
@@ -79,6 +96,7 @@ let checkDocs = AppComponentObject => {
79
96
  });
80
97
  return unDocsComponentNameList;
81
98
  };
99
+
82
100
  var _default = (mDataStr, ComponentObj) => {
83
101
  let mDataObject = JSON.parse(mDataStr);
84
102
  let impactedComponentList = [];
@@ -87,9 +105,11 @@ var _default = (mDataStr, ComponentObj) => {
87
105
  if (libraryName === 'AppSource') {
88
106
  unDocsComList = checkDocs(ComponentObj[libraryName]);
89
107
  }
108
+
90
109
  let totalChangedFilesList = getChangedFileName(ComponentObj[libraryName]);
91
110
  totalChangedFilesList.forEach(changedFileName => {
92
111
  let referencedByComponents = getReferencedBy(mDataObject, changedFileName);
112
+
93
113
  if (Array.isArray(referencedByComponents)) {
94
114
  impactedComponentList = impactedComponentList.concat(referencedByComponents);
95
115
  } else if (typeof referencedByComponents === 'string') {
@@ -102,4 +122,5 @@ var _default = (mDataStr, ComponentObj) => {
102
122
  unDocsComList: unDocsComList
103
123
  };
104
124
  };
125
+
105
126
  exports.default = _default;
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _child_process = require("child_process");
9
+
8
10
  var _default = (type = 'git', cwd = process.cwd()) => {
9
11
  let results;
12
+
10
13
  if (type === 'git') {
11
14
  results = (0, _child_process.spawnSync)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
12
15
  encoding: 'utf8',
@@ -18,7 +21,9 @@ var _default = (type = 'git', cwd = process.cwd()) => {
18
21
  cwd
19
22
  });
20
23
  }
24
+
21
25
  let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
22
26
  return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
23
27
  };
28
+
24
29
  exports.default = _default;
@@ -4,19 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _request = _interopRequireDefault(require("./request"));
11
+
9
12
  var _libraryImpactConfig = _interopRequireDefault(require("./libraryImpactConfig"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
11
16
  let dependencies = ['@zohodesk/components', '@zohodesk/dot', '@zohodesk/icons', '@zohodesk/svg', '@zohodesk/variables'];
17
+
12
18
  let getCurrentDependenciesInfo = () => {
13
19
  let packageJson = require(_path.default.join(process.cwd(), 'package.json'));
20
+
14
21
  let info = {};
22
+
15
23
  for (let dependency of dependencies) {
16
24
  info[dependency] = packageJson.dependencies[dependency];
17
25
  }
26
+
18
27
  return info;
19
28
  };
29
+
20
30
  let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject) => {
21
31
  let url = `${'ht'}${'tps'}://zgit.csez.zohocorpin.com/api/v4/projects/1143/repository/files/jsapps%2Fsupportapp%2Fpackage.json?ref=${branch}`;
22
32
  (0, _request.default)({
@@ -32,12 +42,15 @@ let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject
32
42
  dependencies: depend
33
43
  } = JSON.parse(Buffer.from(content, 'base64').toString());
34
44
  let info = {};
45
+
35
46
  for (let dependency of dependencies) {
36
47
  info[dependency] = depend[dependency];
37
48
  }
49
+
38
50
  resolve(info);
39
51
  }).catch(reject);
40
52
  });
53
+
41
54
  let getDependencyChangeset = (dependency, version) => {
42
55
  return new Promise(resolve => {
43
56
  let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
@@ -49,10 +62,12 @@ let getDependencyChangeset = (dependency, version) => {
49
62
  if (body == "") {
50
63
  console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
51
64
  }
65
+
52
66
  resolve(body);
53
67
  });
54
68
  });
55
69
  };
70
+
56
71
  let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
57
72
  let diff = {
58
73
  [appName]: {}
@@ -77,9 +92,11 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
77
92
  name,
78
93
  ext
79
94
  } = _path.default.parse(FILEPATH);
95
+
80
96
  if (!diff[appName][key]) {
81
97
  diff[appName][key] = [];
82
98
  }
99
+
83
100
  diff[appName][key].push({
84
101
  name: name + ext,
85
102
  FILEPATH
@@ -90,11 +107,13 @@ let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve =>
90
107
  resolve(diff);
91
108
  });
92
109
  });
110
+
93
111
  var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary') => new Promise(resolve => {
94
112
  let currentDependencies = getCurrentDependenciesInfo();
95
113
  getLiveDependenciesInfo(liveBranch, tokenGit).then(liveDependencies => {
96
114
  let diff = {};
97
115
  let promises = [];
116
+
98
117
  for (let dependency of dependencies) {
99
118
  promises.push(new Promise(resolve => {
100
119
  if (currentDependencies[dependency] !== liveDependencies[dependency]) {
@@ -114,6 +133,7 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
114
133
  }
115
134
  }));
116
135
  }
136
+
117
137
  promises.push(new Promise(resolve => {
118
138
  getImpactDiff(srcBranch, liveBranch, 'AppSource').then(impacts => {
119
139
  Object.assign(diff, impacts);
@@ -127,4 +147,5 @@ var _default = (srcBranch, liveBranch, tokenGit, serviceName = 'ZohoDeskLibrary'
127
147
  throw e;
128
148
  });
129
149
  });
150
+
130
151
  exports.default = _default;
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getFileType = getFileType;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /* eslint-disable no-use-before-define */
10
9
 
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /* eslint-disable no-use-before-define */
11
13
  function getFileType(file) {
12
14
  const {
13
15
  ext
14
16
  } = _path.default.parse(file);
17
+
15
18
  if (isImageFileExt(ext)) {
16
19
  return 'image';
17
20
  } else if (isFontFileExt(ext)) {
@@ -25,17 +28,22 @@ function getFileType(file) {
25
28
  } else if (ext === '.css') {
26
29
  return 'css';
27
30
  }
31
+
28
32
  return null;
29
33
  }
34
+
30
35
  function isImageFileExt(ext) {
31
36
  return ext === '.gif' || ext === '.png' || ext === '.jpg' || ext === '.jpeg' || ext === '.webp' || ext === '.ico';
32
37
  }
38
+
33
39
  function isFontFileExt(ext) {
34
40
  return ext === '.svg' || ext === '.woff' || ext === '.eot' || ext === '.ttf' || ext === '.woff2';
35
41
  }
42
+
36
43
  function isVideoFileExt(ext) {
37
44
  return ext === '.mp4' || ext === '.webm';
38
45
  }
46
+
39
47
  function isAudioFileExt(ext) {
40
48
  return ext === '.ogg' || ext === '.mp3';
41
49
  }
@@ -4,15 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getHash;
7
+
7
8
  var _crypto = _interopRequireDefault(require("crypto"));
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  function getHash(file, size = 20, isPath = false) {
11
15
  let hash = _crypto.default.createHash('md5');
16
+
12
17
  let fileNew = file;
18
+
13
19
  if (isPath) {
14
20
  fileNew = _fs.default.readFileSync(file);
15
21
  }
22
+
16
23
  hash.update(fileNew);
17
24
  hash = hash.digest('hex');
18
25
  return hash ? hash.substring(0, size) : null;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  let os = require('os');
4
+
4
5
  module.exports = function getIP() {
5
6
  let ifaces = os.networkInterfaces();
6
7
  let ips = [];
@@ -9,6 +10,7 @@ module.exports = function getIP() {
9
10
  if ('IPv4' !== iface.family || iface.internal !== false) {
10
11
  return null;
11
12
  }
13
+
12
14
  return iface.address;
13
15
  }).filter(a => a);
14
16
  ips = ips.concat(a);
@@ -4,26 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.defaulter = exports.default = void 0;
7
+
7
8
  var _child_process = require("child_process");
9
+
8
10
  var _fs = _interopRequireWildcard(require("fs"));
11
+
9
12
  var _path = _interopRequireDefault(require("path"));
13
+
10
14
  var _schemas = _interopRequireDefault(require("../schemas"));
15
+
11
16
  var _deprecationSupport = require("./deprecationSupport");
17
+
12
18
  var _deprecationLogger = require("../deprecationLogger");
19
+
13
20
  var _logger = require("../logger");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- // import { argv } from 'process';
18
21
 
19
- const args = process.argv.slice(2);
20
- // console.log('argv', argv);
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ // import { argv } from 'process';
29
+ const args = process.argv.slice(2); // console.log('argv', argv);
21
30
 
22
- const NPM_CONFIG_PREFIX = 'npm_config_';
23
- // TODO: we have to do option parse logic little better
31
+ const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
24
32
  // if user use react-cli stritly without using npm scripts options won't work,
25
33
  // So we have to write our own option parse logic or some other library
26
-
27
34
  // console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
28
35
  // 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')));
29
36
  // // clone:type
@@ -37,24 +44,31 @@ Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEac
37
44
  });
38
45
  keysWithColon.forEach(key => {
39
46
  const nkey = key.replace(/:/g, '_');
47
+
40
48
  if (processEnv[nkey]) {
41
49
  throw Error('there is some options conflict', key, nkey);
42
50
  }
51
+
43
52
  processEnv[nkey] = processEnv[key];
44
53
  });
54
+
45
55
  function getNpmVersion() {
46
56
  // require("child_process").
47
57
  let vers = '6';
58
+
48
59
  try {
49
60
  [vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
50
61
  } catch (error) {
51
62
  console.log(error);
52
63
  }
64
+
53
65
  return vers;
54
66
  }
67
+
55
68
  function getCWD() {
56
69
  // require("child_process").
57
70
  let cwd = process.cwd();
71
+
58
72
  try {
59
73
  const ress = (0, _child_process.execSync)('npm bin').toString();
60
74
  const i = ress.lastIndexOf('node_modules');
@@ -62,33 +76,39 @@ function getCWD() {
62
76
  } catch (error) {
63
77
  console.log(error);
64
78
  }
79
+
65
80
  return cwd;
66
- }
81
+ } // experimental argumnet parsing logic
82
+
67
83
 
68
- // experimental argumnet parsing logic
69
84
  args.forEach(option => {
70
85
  if (/^--./.test(option)) {
71
- const equIndex = option.indexOf('=');
72
- // equIndex = equIndex === -1 ? option.length : equIndex;
86
+ const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
87
+
73
88
  let key = option.slice(2, equIndex);
74
89
  let value = option.slice(equIndex + 1);
90
+
75
91
  if (equIndex === -1) {
76
92
  key = option.slice(2);
77
93
  value = true;
78
94
  }
95
+
79
96
  key = key.replace(/-|:/g, '_');
80
97
  processEnv[key] = value;
81
98
  }
82
99
  });
100
+
83
101
  const defaulter = (target, source) => {
84
102
  const defaultObject = {};
85
103
  Object.keys(target).forEach(key => {
86
104
  const data = target[key];
105
+
87
106
  if (data && typeof data === 'object') {
88
107
  if (Array.isArray(data)) {
89
108
  defaultObject[key] = source[key] || data;
90
109
  } else if (typeof data.cli === 'string') {
91
110
  let cliData;
111
+
92
112
  if (typeof processEnv[data.cli] === 'string') {
93
113
  cliData = processEnv[data.cli];
94
114
  } else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
@@ -96,9 +116,11 @@ const defaulter = (target, source) => {
96
116
  } else {
97
117
  cliData = source && source[key] || data.value;
98
118
  }
119
+
99
120
  if (typeof data.value === 'boolean') {
100
121
  cliData = cliData === 'true' || cliData === true ? true : cliData === 'false' || cliData === false || cliData === '' ? false : data.value;
101
122
  }
123
+
102
124
  defaultObject[key] = cliData;
103
125
  } else {
104
126
  defaultObject[key] = defaulter(data, source && source[key] ? source[key] : Array.isArray(target[key]) ? [] : {});
@@ -109,36 +131,49 @@ const defaulter = (target, source) => {
109
131
  });
110
132
  return defaultObject;
111
133
  };
134
+
112
135
  exports.defaulter = defaulter;
113
136
  global.reactCLIOptions = null;
137
+
114
138
  const getOptionsFromConfigFile = (appPath, configFileName) => {
115
139
  const fileName = configFileName || 'react-cli.config.js';
140
+
116
141
  if (!configFileName) {
117
142
  (0, _logger.verboseLogger)('we have used default react-cli.config.js');
118
143
  }
144
+
119
145
  const packagePath = _path.default.join(appPath, fileName);
146
+
120
147
  if ((0, _fs.existsSync)(packagePath)) {
121
148
  return require(packagePath).config;
122
149
  }
150
+
123
151
  const oldDeprecatedConfigFilePath = _path.default.join(appPath, 'build.config.js');
152
+
124
153
  if ((0, _fs.existsSync)(oldDeprecatedConfigFilePath)) {
125
154
  (0, _deprecationLogger.deprecateMessage)('"build.config.js" file was deprecated. So Kindly rename it as "react-cli.config.js"');
126
155
  return require(oldDeprecatedConfigFilePath).config;
127
156
  }
157
+
128
158
  return null;
129
159
  };
160
+
130
161
  const getOptions = fromRoot => {
131
162
  if (global.reactCLIOptions) {
132
163
  return global.reactCLIOptions;
133
164
  }
165
+
134
166
  const appPath = process.cwd();
135
167
  let userSchemas = getOptionsFromConfigFile(appPath, processEnv.config_file);
168
+
136
169
  const packagePath = _path.default.join(appPath, 'package.json');
170
+
137
171
  if (_fs.default.existsSync(packagePath)) {
138
172
  userSchemas = userSchemas || require(packagePath)['react-cli'] || {};
139
173
  }
140
- const options = defaulter(_schemas.default, userSchemas || {});
141
- // for future may be for npm 8 edge cases
174
+
175
+ const options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
176
+
142
177
  options.npmVersion = getNpmVersion();
143
178
  options.cwd = getCWD();
144
179
  (0, _deprecationSupport.deprecationSupport)(options, options.disableDeprecationWarning || !fromRoot);
@@ -146,4 +181,6 @@ const getOptions = fromRoot => {
146
181
  global.reactCLIOptions = options;
147
182
  return options;
148
183
  };
149
- var _default = exports.default = getOptions;
184
+
185
+ var _default = getOptions;
186
+ exports.default = _default;