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

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