@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
@@ -5,27 +5,32 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.aliasPathCreation = aliasPathCreation;
7
7
  exports.libAlias = exports.jestModuleNameMapper = void 0;
8
+
8
9
  var _utils = require("../utils");
10
+
9
11
  var _path = _interopRequireDefault(require("path"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
11
15
  // the reason for alias at the time was code tree shaking
12
16
  // tree shaking was most compactable with ES module system
13
17
  // FIXME: But there is a posiblity when these package does not have lib,
14
18
  // app will work because of alias, But may be jest won't work because of not alais
15
19
  // So need to think about use alais in jest
16
-
17
20
  const appPath = process.cwd();
18
21
  const {
19
22
  alias,
20
23
  app
21
24
  } = (0, _utils.getOptions)();
22
25
  const {
23
- disableES5Transpile
26
+ disableES5Import
24
27
  } = app;
28
+
25
29
  function aliasPathCreation(customAlias) {
26
30
  if (customAlias == null) {
27
31
  return {};
28
32
  }
33
+
29
34
  const newAlias = {};
30
35
  Object.keys(customAlias).forEach(key => {
31
36
  if (customAlias[key].startsWith('.')) {
@@ -36,7 +41,8 @@ function aliasPathCreation(customAlias) {
36
41
  });
37
42
  return newAlias;
38
43
  }
39
- const libAlias = exports.libAlias = {
44
+
45
+ const libAlias = {
40
46
  '@zohodesk/components/lib': '@zohodesk/components/es',
41
47
  // '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
42
48
  '@zohodesk/dot/lib': '@zohodesk/dot/es',
@@ -54,13 +60,13 @@ const libAlias = exports.libAlias = {
54
60
  '@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
55
61
  '@zohodesk/variables/lib': '@zohodesk/variables/es',
56
62
  '@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
57
- };
58
-
59
- // '^@root(.*)$': '<rootDir>/src$1',
63
+ }; // '^@root(.*)$': '<rootDir>/src$1',
60
64
  // '^@components(.*)$': '<rootDir>/src/components$1',
61
65
 
62
- const totalAlias = disableES5Transpile ? Object.assign({}, libAlias, aliasPathCreation(alias)) : aliasPathCreation(alias);
63
- const jestModuleNameMapper = exports.jestModuleNameMapper = Object.keys(totalAlias).reduce((previousValue, key) => {
66
+ exports.libAlias = libAlias;
67
+ const totalAlias = disableES5Import ? Object.assign({}, libAlias, aliasPathCreation(alias)) : aliasPathCreation(alias);
68
+ const jestModuleNameMapper = Object.keys(totalAlias).reduce((previousValue, key) => {
64
69
  previousValue[`^${key}(.*)$`] = `${totalAlias[key]}$1`;
65
70
  return previousValue;
66
- }, {});
71
+ }, {});
72
+ exports.jestModuleNameMapper = jestModuleNameMapper;
@@ -5,40 +5,50 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.loaderResolver = loaderResolver;
7
7
  exports.moduleResolver = moduleResolver;
8
+
8
9
  var _constants = require("../constants");
10
+
9
11
  var _logger = require("../logger");
12
+
10
13
  var _requireLocalOrGlobal = require("../servers/requireLocalOrGlobal");
14
+
11
15
  var _libAlias = require("./libAlias");
16
+
12
17
  var _client_packages_group = require("@zohodesk/client_packages_group");
18
+
13
19
  function moduleResolver(options) {
14
20
  const {
15
21
  moduleResolvePath,
16
- disableES5Transpile
22
+ disableES5Import
17
23
  } = options.app;
18
24
  const customAlias = options.alias;
19
25
  let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
26
+
20
27
  if (!required) {
21
28
  required = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk/client_packages_group');
29
+
22
30
  if (required) {
23
31
  (0, _logger.messageLogger)('global `@zohodesk/client_packages_group` package taken as client_packages_group');
24
32
  }
25
33
  }
34
+
26
35
  const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
27
- const totalAlias = disableES5Transpile ? Object.assign({}, _libAlias.libAlias, (0, _libAlias.aliasPathCreation)(customAlias)) : (0, _libAlias.aliasPathCreation)(customAlias);
36
+ const totalAlias = disableES5Import ? Object.assign({}, _libAlias.libAlias, (0, _libAlias.aliasPathCreation)(customAlias)) : (0, _libAlias.aliasPathCreation)(customAlias);
28
37
  return {
29
38
  extensions: ['.js', '.jsx', '.ts', '.tsx'],
30
39
  modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
31
- alias: totalAlias
32
- // alias: { ...libAlias, ...clientDependenies }
40
+ alias: totalAlias // alias: { ...libAlias, ...clientDependenies }
41
+
33
42
  };
34
43
  }
44
+
35
45
  function loaderResolver(options) {
36
46
  // const unstableDepsInverse = false;
37
47
  const {
38
48
  unstableDepsInverse
39
49
  } = options;
40
50
  return {
41
- modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules']
42
- // alias: libAlias
51
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules'] // alias: libAlias
52
+
43
53
  };
44
54
  }
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
+
5
7
  var _utils = require("../utils");
8
+
6
9
  var _pluginUtils = require("../pluginUtils");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
8
13
  let options = (0, _utils.getOptions)();
9
14
  let {
10
15
  umd: {
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
+
5
7
  var _utils = require("../utils");
8
+
6
9
  var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
10
+
7
11
  var _pluginUtils = require("../pluginUtils");
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  let options = (0, _utils.getOptions)();
10
16
  let {
11
17
  umd: {
@@ -61,11 +67,13 @@ module.exports = {
61
67
  }
62
68
  }],
63
69
  include: _path.default.join(appPath, 'src')
64
- } /*,
65
- {
66
- test: /\.css$/,
67
- use: [MiniCssExtractPlugin.loader, 'css-loader']
68
- }*/, {
70
+ }
71
+ /*,
72
+ {
73
+ test: /\.css$/,
74
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
75
+ }*/
76
+ , {
69
77
  test: /(\.module)?\.css$/,
70
78
  use: [{
71
79
  loader: _miniCssExtractPlugin.default.loader,
@@ -1,13 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _common = require("../common");
8
+
6
9
  var _pluginUtils = require("../pluginUtils");
10
+
7
11
  var _loaderUtils = require("../loaderUtils");
12
+
8
13
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
+
9
15
  var _resolvers = require("./resolvers");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
11
19
  const options = (0, _utils.getOptions)();
12
20
  const {
13
21
  app: {
@@ -54,9 +62,11 @@ const output = {
54
62
  jsonpFunction: `${context}Jsonp`
55
63
  };
56
64
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
65
+
57
66
  if (crossorigin) {
58
67
  output.crossOriginLoading = 'anonymous';
59
68
  }
69
+
60
70
  module.exports = {
61
71
  entry: (0, _common.getEntries)(options, 'dev'),
62
72
  devtool: sourcemap,
@@ -84,10 +94,13 @@ module.exports = {
84
94
  use: (0, _loaderUtils.getDevJsLoaders)(options),
85
95
  include: module => {
86
96
  const srcPath = _path.default.join(appPath, folder);
97
+
87
98
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
99
+
88
100
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
89
101
  return true;
90
102
  }
103
+
91
104
  return false;
92
105
  }
93
106
  }, enableMjsLoader ? {
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _pluginUtils = require("../pluginUtils");
8
+
6
9
  var _loaderUtils = require("../loaderUtils");
10
+
7
11
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
+
8
13
  var _resolvers = require("./resolvers");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
10
17
  const options = (0, _utils.getOptions)();
11
18
  const {
12
19
  docs: {
@@ -32,6 +39,7 @@ const {
32
39
  } = options;
33
40
  const appPath = process.cwd();
34
41
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
42
+
35
43
  module.exports = isSSTest => ({
36
44
  entry: {
37
45
  main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _loaderUtils = require("../loaderUtils");
8
+
6
9
  var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/getLibraryImactPlugins"));
10
+
7
11
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
+
8
13
  var _resolvers = require("./resolvers");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
10
17
  const options = (0, _utils.getOptions)();
11
18
  const {
12
19
  docs: {
@@ -1,16 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _common = require("../common");
8
+
6
9
  var _pluginUtils = require("../pluginUtils");
10
+
7
11
  var _loaderUtils = require("../loaderUtils");
12
+
8
13
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
+
9
15
  var _resolvers = require("./resolvers");
16
+
10
17
  var _babelPresetReactOption = _interopRequireDefault(require("../babel/babel-option-utils/babel-preset-react-option"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- // import TerserPlugin from 'terser-webpack-plugin';
13
18
 
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ // import TerserPlugin from 'terser-webpack-plugin';
14
22
  const options = (0, _utils.getOptions)();
15
23
  const {
16
24
  app: {
@@ -59,9 +67,11 @@ const output = {
59
67
  jsonpFunction: `${context}Jsonp`,
60
68
  sourceMapFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js.map' : 'js/[name]_.js.map'
61
69
  };
70
+
62
71
  if (crossorigin) {
63
72
  output.crossOriginLoading = 'anonymous';
64
73
  }
74
+
65
75
  if (isDevelopment) {
66
76
  const {
67
77
  disableContextURL
@@ -70,6 +80,7 @@ if (isDevelopment) {
70
80
  const serverUrl = (0, _utils.getServerURL)(server, 'https');
71
81
  output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
72
82
  }
83
+
73
84
  const shouldRemovePropTypes = !isDevelopment && removePropTypes;
74
85
  module.exports = {
75
86
  entry: (0, _common.getEntries)(options, 'production'),
@@ -123,8 +134,7 @@ module.exports = {
123
134
  }], (0, _babelPresetReactOption.default)({
124
135
  disableES5Transpile
125
136
  }), enableTypeScript ? require.resolve('@babel/preset-typescript') : null].filter(Boolean),
126
- plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'),
127
- // require.resolve(
137
+ plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve(
128
138
  // '@babel/plugin-proposal-object-rest-spread'
129
139
  // ), REMOVING IT, BECAUSE WE ALREADY SUPPORT SPREAD SYNTAX FROM LIBRARIES.
130
140
  shouldRemovePropTypes ? [require.resolve('babel-plugin-transform-react-remove-prop-types'), removePropTypes] : false, devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
@@ -141,10 +151,13 @@ module.exports = {
141
151
  // include: path.join(appPath, folder)
142
152
  include: module => {
143
153
  const srcPath = _path.default.join(appPath, folder);
154
+
144
155
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
156
+
145
157
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
146
158
  return true;
147
159
  }
160
+
148
161
  return false;
149
162
  }
150
163
  }, seperateCssModules ? {
package/lib/constants.js CHANGED
@@ -4,19 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cliRootPath = exports.cliNodeModulesPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const BASE_CONFIG_KEY = exports.BASE_CONFIG_KEY = 'react-cli';
10
- const cliRootPath = exports.cliRootPath = _path.default.resolve(__dirname, '..');
11
- const CONFIG_ROOT = exports.CONFIG_ROOT = 'react-cli';
12
- const cliNodeModulesPath = exports.cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules');
13
9
 
14
- // export const babelrcPath = join(cliRootPath, '.babelrc');
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const BASE_CONFIG_KEY = 'react-cli';
13
+ exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY;
14
+
15
+ const cliRootPath = _path.default.resolve(__dirname, '..');
15
16
 
16
- const appPath = exports.appPath = process.cwd();
17
+ exports.cliRootPath = cliRootPath;
18
+ const CONFIG_ROOT = 'react-cli';
19
+ exports.CONFIG_ROOT = CONFIG_ROOT;
17
20
 
18
- // export const appInitialHTMLTemplatePath = path.join(
21
+ const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
22
+
23
+
24
+ exports.cliNodeModulesPath = cliNodeModulesPath;
25
+ const appPath = process.cwd(); // export const appInitialHTMLTemplatePath = path.join(
19
26
  // process.cwd(),
20
27
  // 'src',
21
28
  // 'index.html'
22
- // );
29
+ // );
30
+
31
+ exports.appPath = appPath;
@@ -6,25 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.deprecateMessage = deprecateMessage;
7
7
  exports.deprecateOption = deprecateOption;
8
8
  exports.deprecationLoggerEnd = deprecationLoggerEnd;
9
+
9
10
  var _logger = require("./logger");
11
+
10
12
  function deprecateMessage(message) {
11
13
  // eslint-disable-next-line no-use-before-define
12
14
  deprecationLoggerStart();
13
15
  (0, _logger.messageLogger)('\x1b[36m%s\x1b[0m', message);
14
16
  }
17
+
15
18
  function printLine() {
16
19
  deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
17
20
  }
21
+
18
22
  let isFirstDeprecation = false;
23
+
19
24
  function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
20
25
  deprecateMessage(`Please move "${previousObjPath.split('.').join(' > ')}" to "${newObjPath.split('.').join(' > ')}" following option ${message}`);
21
26
  }
27
+
22
28
  function deprecationLoggerStart() {
23
29
  if (!isFirstDeprecation) {
24
30
  isFirstDeprecation = true;
25
31
  printLine();
26
32
  }
27
33
  }
34
+
28
35
  function deprecationLoggerEnd() {
29
36
  if (isFirstDeprecation) {
30
37
  isFirstDeprecation = false;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _propTypes = _interopRequireDefault(require("prop-types"));
4
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  _propTypes.default.array.hookType = 'array';
6
8
  _propTypes.default.bool.hookType = 'bool';
7
9
  _propTypes.default.func.hookType = 'func';
@@ -20,6 +22,7 @@ _propTypes.default.string.isRequired.hookType = 'string';
20
22
  _propTypes.default.symbol.isRequired.hookType = 'symbol';
21
23
  _propTypes.default.element.isRequired.hookType = 'element';
22
24
  _propTypes.default.node.isRequired.hookType = 'element';
25
+
23
26
  function proxy(fn, type) {
24
27
  let oneOf = fn;
25
28
  return (...args) => {
@@ -27,15 +30,16 @@ function proxy(fn, type) {
27
30
  let type1 = Array.isArray(args) && Array.isArray(args[0]) ? `${type}[${args[0].map(data => typeof data === 'function' ? data.hookType //arrayOf shape complex type not mention
28
31
  : JSON.stringify(data))}]` : type;
29
32
  a.hookType = type1;
33
+
30
34
  if (a.isRequired) {
31
35
  a.isRequired.hookType = type1;
32
36
  }
37
+
33
38
  return a;
34
39
  };
35
40
  }
41
+
36
42
  _propTypes.default.oneOf = proxy(_propTypes.default.oneOf, 'enum');
37
43
  _propTypes.default.oneOfType = proxy(_propTypes.default.oneOfType, 'union');
38
44
  _propTypes.default.arrayOf = proxy(_propTypes.default.arrayOf, 'arrayOf');
39
- _propTypes.default.shape = proxy(_propTypes.default.shape, 'shape');
40
-
41
- // export default PropTypes;
45
+ _propTypes.default.shape = proxy(_propTypes.default.shape, 'shape'); // export default PropTypes;
@@ -1,18 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _jsonMaker = _interopRequireDefault(require("./jsonMaker"));
8
+
6
9
  var _jsonHelper = require("../utils/jsonHelper");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
8
13
  let result = inp => {
9
14
  inp.endTime = Date.now();
10
15
  let testPathPattern = process.argv[process.argv.length - 1];
16
+
11
17
  if (testPathPattern.indexOf('--') !== -1) {
12
18
  testPathPattern = '';
13
19
  } else {
14
20
  testPathPattern = _fs.default.realpathSync(process.cwd());
15
21
  }
22
+
16
23
  let testPathRegex = new RegExp(testPathPattern);
17
24
  let {
18
25
  testResults
@@ -20,14 +27,18 @@ let result = inp => {
20
27
  let testFilesArr = [];
21
28
  let testCaseFiles = [];
22
29
  let jsonData;
30
+
23
31
  if (_fs.default.existsSync('./coverageTest/result.json')) {
24
32
  jsonData = JSON.parse(_fs.default.readFileSync('./coverageTest/result.json', 'utf8'));
25
33
  }
34
+
26
35
  testResults.forEach(testResult => {
27
36
  let filePath = testResult.testFilePath;
37
+
28
38
  if (!testPathRegex.test(filePath)) {
29
39
  return;
30
40
  }
41
+
31
42
  filePath = filePath.replace('.spec', '');
32
43
  filePath = filePath.replace('/__tests__', '');
33
44
  filePath = filePath.replace('/__test__', '');
@@ -37,24 +48,31 @@ let result = inp => {
37
48
  fileJson.sourcePath = filePath;
38
49
  fileJson.data = testResult;
39
50
  testFilesArr.push(fileJson);
51
+
40
52
  if (jsonData.FILES.includes(relatPath) || jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), ''))) {
41
53
  jsonData.FILES.includes(relatPath) ? testCaseFiles.push(relatPath) : jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), '')) ? testCaseFiles.push(testResult.testFilePath.replace(process.cwd(), '')) : '';
42
54
  }
43
55
  });
44
56
  let coverageSummary = {};
57
+
45
58
  if (_fs.default.existsSync('./commitCoverage/coverage-summary.json')) {
46
59
  coverageSummary = _fs.default.readFileSync('./commitCoverage/coverage-summary.json').toString();
60
+
47
61
  if (coverageSummary.indexOf('\\') !== -1) {
48
62
  coverageSummary = coverageSummary.replace(/\\/g, '\\\\');
49
63
  }
50
64
  }
65
+
51
66
  let excludeTestArray = '{}';
67
+
52
68
  if (_fs.default.existsSync('./__testUtils__/conf/excludeTest.json')) {
53
69
  excludeTestArray = _fs.default.readFileSync('./__testUtils__/conf/excludeTest.json').toString();
70
+
54
71
  if (excludeTestArray.indexOf('\\') !== -1) {
55
72
  excludeTestArray = excludeTestArray.replace(/\\/g, '\\\\');
56
73
  }
57
74
  }
75
+
58
76
  let coverageJson = JSON.parse(coverageSummary);
59
77
  let linesPercent = 0;
60
78
  let functionPercent = 0;
@@ -63,6 +81,7 @@ let result = inp => {
63
81
  let fileList = '<h4>Changed files in last code check-in</h4><ul>';
64
82
  let i = 0;
65
83
  let excludeTestJSON = JSON.parse(excludeTestArray);
84
+
66
85
  if (Object.keys(excludeTestArray).length > 0) {
67
86
  jsonData.FILES = jsonData.FILES.filter(function (value) {
68
87
  if (!excludeTestJSON.test.exclude.includes(value)) {
@@ -71,14 +90,18 @@ let result = inp => {
71
90
  return value;
72
91
  }
73
92
  });
93
+
74
94
  if (excludeDir.length > 0) {
75
95
  return null;
76
96
  }
97
+
77
98
  return value;
78
99
  }
100
+
79
101
  return null;
80
102
  });
81
103
  }
104
+
82
105
  for (i; i < jsonData.FILES.length; i++) {
83
106
  let coverageData;
84
107
  let curSourceFile = jsonData.FILES[i];
@@ -89,32 +112,41 @@ let result = inp => {
89
112
  coverageData = coverageJson[coverageFile];
90
113
  }
91
114
  });
115
+
92
116
  if (!coverageData) {
93
117
  (0, _utils.log)(`Can't able to find source for ${testFilesArr[i].testPath}\n Please check the file name and the path is correct for test file`);
94
118
  continue;
95
119
  }
120
+
96
121
  linesPercent += coverageData.lines.pct;
97
122
  functionPercent += coverageData.functions.pct;
98
123
  statementPerment += coverageData.statements.pct;
99
124
  branchesPercent += coverageData.branches.pct;
100
125
  }
126
+
101
127
  fileList = `${fileList}</ul>`;
128
+
102
129
  if (!jsonData.FILES.length) {
103
130
  fileList = '<div></div>';
104
131
  }
132
+
105
133
  let uncoveredList = '<h4>Uncovered files :- </h4><ul>';
106
134
  let fileCoverage = 0;
135
+
107
136
  if (jsonData.FILES.length > 0) {
108
137
  fileCoverage = testCaseFiles.length / jsonData.FILES.length * 100;
109
138
  }
139
+
110
140
  fileCoverage = fileCoverage.toFixed(2);
111
141
  fileCoverage = Number(fileCoverage);
142
+
112
143
  if (Number.isNaN(fileCoverage)) {
113
144
  (0, _utils.log)('This build does\'t have any JS changes!');
114
145
  fileCoverage = 0;
115
146
  } else {
116
147
  (0, _utils.log)(`FileCoverage ${fileCoverage}%`);
117
148
  }
149
+
118
150
  let totalLinesPercent = linesPercent / (i * 100) * 100;
119
151
  let totalFunctionPercent = functionPercent / (i * 100) * 100;
120
152
  let totalStatementPercent = statementPerment / (i * 100) * 100;
@@ -122,6 +154,7 @@ let result = inp => {
122
154
  let totalPercentage = totalLinesPercent + totalFunctionPercent + totalStatementPercent + totalBranchesPercent;
123
155
  let coverage = (totalPercentage / 4).toFixed(2);
124
156
  coverage = Number(coverage);
157
+
125
158
  if (Number.isNaN(coverage)) {
126
159
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'can\'t get coverage for this test');
127
160
  coverage = 0;
@@ -129,13 +162,16 @@ let result = inp => {
129
162
  } else {
130
163
  (0, _jsonMaker.default)(inp, coverage, true, 'modifiedFileUnitCase', fileCoverage);
131
164
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.isBuildVerified', coverage > 60);
132
- (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated');
133
- // jsonHelper(
165
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated'); // jsonHelper(
134
166
  // `${process.cwd()}/result.json`,
135
167
  // 'testInfo.isBuildVerified',
136
168
  // coverage > 60
137
169
  // );
138
- (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true /*coverage > 60*/);
170
+
171
+ (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true
172
+ /*coverage > 60*/
173
+ );
174
+
139
175
  if (coverage < 60) {
140
176
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', [{
141
177
  type: 'modifiedUnitcases',
@@ -145,15 +181,21 @@ let result = inp => {
145
181
  } else {
146
182
  uncoveredList = uncoveredList + 'You can proceed this build </ul>';
147
183
  }
184
+
148
185
  (0, _utils.log)(`COVERAGE ${coverage}%`);
149
186
  }
187
+
150
188
  let html = `<html><head><style>.red{font-weight:bold;color:red;}.green{font-weight:bold;color:green;}</style></head><body><br/>CODE COVERAGE <span class="${coverage < 60 ? 'red' : 'green'}">${coverage}%</span> <br/> less than 60% consider failure<br/><br/> FILE COVERAGE:<span class="${fileCoverage < 60 ? 'red' : 'green'}">${fileCoverage}%</span> <br/> less than 60% consider failure${fileList}${uncoveredList}</body></html>`;
189
+
151
190
  if (!_fs.default.existsSync('./coverageTest')) {
152
191
  _fs.default.mkdirSync('./coverageTest');
192
+
153
193
  _fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
154
194
  } else {
155
195
  _fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
156
196
  }
197
+
157
198
  return inp;
158
199
  };
200
+
159
201
  module.exports = result;