@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/README.md +35 -40
  2. package/docs/SelectorWeight.md +6 -0
  3. package/docs/VariableConversion.md +33 -1
  4. package/lib/babel/cmjs-plugins-presets.js +4 -0
  5. package/lib/babel/es-plugins-presets.js +4 -0
  6. package/lib/common/getEntries.js +10 -0
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +5 -0
  9. package/lib/common/splitChunks.js +13 -2
  10. package/lib/common/sslcertUpdater.js +17 -6
  11. package/lib/common/templateParameters.js +2 -0
  12. package/lib/common/testPattern.js +21 -10
  13. package/lib/common/valueReplacer.js +15 -0
  14. package/lib/configs/jest.config.js +9 -0
  15. package/lib/configs/libAlias.js +2 -4
  16. package/lib/configs/webpack.component.umd.config.js +5 -0
  17. package/lib/configs/webpack.css.umd.config.js +13 -5
  18. package/lib/configs/webpack.dev.config.js +36 -2
  19. package/lib/configs/webpack.docs.config.js +21 -1
  20. package/lib/configs/webpack.impact.config.js +19 -1
  21. package/lib/configs/webpack.prod.config.js +37 -3
  22. package/lib/hooks/docsProptypeHook.js +7 -3
  23. package/lib/jest/commitedFilesResult.js +45 -3
  24. package/lib/jest/coverageCollector.js +11 -0
  25. package/lib/jest/jsonMaker.js +6 -0
  26. package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
  27. package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
  28. package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
  29. package/lib/jest/result.js +22 -0
  30. package/lib/jest/run.js +17 -6
  31. package/lib/jest/setup.js +57 -5
  32. package/lib/loaderUtils/configsAssetsLoaders.js +11 -1
  33. package/lib/loaderUtils/getCSSLoaders.js +35 -20
  34. package/lib/loaderUtils/getDevJsLoaders.js +8 -0
  35. package/lib/loaderUtils/index.js +3 -0
  36. package/lib/loaderUtils/windowsModification.js +11 -0
  37. package/lib/loaders/docsLoader.js +7 -0
  38. package/lib/loaders/docsPropsLoader.js +7 -3
  39. package/lib/loaders/fileBountryLoader.js +2 -0
  40. package/lib/loaders/fileLoader.js +22 -11
  41. package/lib/loaders/scriptInstrumentLoader.js +13 -5
  42. package/lib/loaders/selectorMappingLoader.js +25 -7
  43. package/lib/loaders/workerLoader.js +20 -4
  44. package/lib/middlewares/HMRMiddleware.js +26 -13
  45. package/lib/middlewares/SSTMiddleware.js +3 -0
  46. package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
  47. package/lib/pluginUtils/getDevPlugins.js +63 -17
  48. package/lib/pluginUtils/getDocsPlugins.js +10 -1
  49. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
  50. package/lib/pluginUtils/getLibraryPlugins.js +5 -0
  51. package/lib/pluginUtils/getProdPlugins.js +72 -23
  52. package/lib/pluginUtils/getServerPlugins.js +5 -0
  53. package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
  54. package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
  55. package/lib/pluginUtils/index.js +8 -0
  56. package/lib/plugins/CdnChangePlugin.js +14 -0
  57. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  58. package/lib/plugins/EFCPlugin.js +34 -23
  59. package/lib/plugins/EFCTemplatePlugin.js +32 -23
  60. package/lib/plugins/I18NInjectIntoIndexPlugin.js +34 -8
  61. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
  62. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  63. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +39 -8
  64. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +29 -14
  65. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +22 -13
  66. package/lib/plugins/I18nSplitPlugin/index.js +23 -13
  67. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  68. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  69. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  70. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
  71. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  72. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
  73. package/lib/plugins/ManifestPlugin.js +17 -0
  74. package/lib/plugins/ModuleStatsPlugin.js +23 -0
  75. package/lib/plugins/OptimizeJSPlugin.js +7 -0
  76. package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
  77. package/lib/plugins/PublicPathChangePlugin.js +36 -4
  78. package/lib/plugins/ReportGeneratePlugin.js +30 -4
  79. package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
  80. package/lib/plugins/ResourceHintsPlugin.js +10 -3
  81. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  82. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -9
  83. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  84. package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
  85. package/lib/plugins/SelectorPlugin.js +97 -0
  86. package/lib/plugins/ServiceWorkerPlugin.js +20 -4
  87. package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
  88. package/lib/plugins/SourceMapHookPlugin.js +9 -0
  89. package/lib/plugins/TPHashMappingPlugin.js +15 -1
  90. package/lib/plugins/UglifyCSSPlugin.js +9 -0
  91. package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
  92. package/lib/plugins/VariableConversionCollector.js +252 -0
  93. package/lib/plugins/composeCommonPlugin.js +30 -0
  94. package/lib/plugins/index.js +19 -0
  95. package/lib/plugins/libraryImpactPlugin.js +32 -0
  96. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  97. package/lib/postcss-plugins/ExcludePlugin.js +4 -0
  98. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  99. package/lib/postcss-plugins/ValueReplacer.js +6 -9
  100. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  101. package/lib/postcss-plugins/hoverActivePlugin.js +66 -30
  102. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +40 -13
  103. package/lib/postcss-plugins/variableModificationPlugin/index.js +215 -141
  104. package/lib/postcss-plugins/variableModifier.js +20 -13
  105. package/lib/schemas/index.js +23 -4
  106. package/lib/servers/clusterHubServer.js +10 -0
  107. package/lib/servers/devBuild.js +24 -13
  108. package/lib/servers/docsServer.js +2 -0
  109. package/lib/servers/docsServerCore.js +21 -0
  110. package/lib/servers/getCliPath.js +9 -0
  111. package/lib/servers/helpServer.js +5 -0
  112. package/lib/servers/httpsOptions.js +4 -0
  113. package/lib/servers/impactServer.js +34 -2
  114. package/lib/servers/mockserver.js +9 -0
  115. package/lib/servers/nowatchserver.js +34 -12
  116. package/lib/servers/scrServer.js +20 -13
  117. package/lib/servers/server.js +35 -7
  118. package/lib/servers/ssServer.js +16 -0
  119. package/lib/templates/CoverageScriptTemplate.js +14 -0
  120. package/lib/templates/WMSTemplate.js +12 -6
  121. package/lib/utils/babelPresets.js +2 -0
  122. package/lib/utils/clean.js +8 -2
  123. package/lib/utils/copy.js +6 -0
  124. package/lib/utils/copyTimezones.js +8 -0
  125. package/lib/utils/createEventStream.js +4 -0
  126. package/lib/utils/cssClassNameGenerate.js +19 -3
  127. package/lib/utils/cssURLReplacer.js +50 -38
  128. package/lib/utils/dependencyPostPublish.js +9 -0
  129. package/lib/utils/fileUtils.js +26 -0
  130. package/lib/utils/folderIterator.js +10 -0
  131. package/lib/utils/getComponents.js +21 -0
  132. package/lib/utils/getCurrentBranch.js +5 -0
  133. package/lib/utils/getDependenciesImpactList.js +21 -0
  134. package/lib/utils/getFileType.js +49 -0
  135. package/lib/utils/getHash.js +7 -0
  136. package/lib/utils/getIp.js +2 -0
  137. package/lib/utils/getOptions.js +39 -14
  138. package/lib/utils/getServerURL.js +7 -0
  139. package/lib/utils/index.js +47 -2
  140. package/lib/utils/init.js +1 -0
  141. package/lib/utils/initPreCommitHook.js +29 -6
  142. package/lib/utils/jsonHelper.js +19 -2
  143. package/lib/utils/libraryImpactConfig.js +2 -0
  144. package/lib/utils/lint/addScripts.js +5 -2
  145. package/lib/utils/lint/checkExistingConfig.js +12 -3
  146. package/lib/utils/lint/copyConfigs.js +3 -0
  147. package/lib/utils/lint/index.js +9 -0
  148. package/lib/utils/lint/lintScripts.js +1 -0
  149. package/lib/utils/lint/lintSetup.js +4 -3
  150. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  151. package/lib/utils/lint/question.js +7 -0
  152. package/lib/utils/lintReporter.js +20 -0
  153. package/lib/utils/mailSender.js +7 -0
  154. package/lib/utils/pullOrigin.js +4 -0
  155. package/lib/utils/reinstallDependencies.js +28 -0
  156. package/lib/utils/removeAttributes.js +7 -0
  157. package/lib/utils/repoClone.js +27 -2
  158. package/lib/utils/request.js +12 -0
  159. package/lib/utils/rtl.js +16 -4
  160. package/lib/utils/setEnvVariables.js +2 -0
  161. package/lib/utils/ssTestHack.js +10 -0
  162. package/lib/utils/switchBranch.js +4 -0
  163. package/lib/utils/urlConcat.js +4 -0
  164. package/lib/utils/useExitCleanup.js +10 -9
  165. package/package.json +10 -9
@@ -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");
10
+
7
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");
12
+
8
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: {
@@ -60,11 +66,13 @@ module.exports = {
60
66
  }
61
67
  }],
62
68
  include: _path.default.join(appPath, 'src')
63
- } /*,
64
- {
65
- test: /\.css$/,
66
- use: [MiniCssExtractPlugin.loader, 'css-loader']
67
- }*/, {
69
+ }
70
+ /*,
71
+ {
72
+ test: /\.css$/,
73
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
74
+ }*/
75
+ , {
68
76
  test: /(\.module)?\.css$/,
69
77
  use: [{
70
78
  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 _libAlias = require("./libAlias");
14
+
9
15
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
16
+
10
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
11
19
  const options = (0, _utils.getOptions)();
12
20
  const {
13
21
  unstableDepsInverse,
@@ -20,6 +28,7 @@ const {
20
28
  exclude,
21
29
  mediaQueryHoverActiveString,
22
30
  cssVariableReplacementConfig,
31
+ selectorWeightConfig,
23
32
  cssUniqueness,
24
33
  seperateCssModules,
25
34
  changeRuntimeChunkChar,
@@ -48,9 +57,11 @@ const output = {
48
57
  jsonpFunction: `${context}Jsonp`
49
58
  };
50
59
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
60
+
51
61
  if (crossorigin) {
52
62
  output.crossOriginLoading = 'anonymous';
53
63
  }
64
+
54
65
  module.exports = {
55
66
  entry: (0, _common.getEntries)(options, 'dev'),
56
67
  devtool: sourcemap,
@@ -78,19 +89,42 @@ module.exports = {
78
89
  use: (0, _loaderUtils.getDevJsLoaders)(options),
79
90
  include: module => {
80
91
  const srcPath = _path.default.join(appPath, folder);
92
+
81
93
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
94
+
82
95
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
83
96
  return true;
84
97
  }
98
+
85
99
  return false;
86
100
  }
87
101
  }, seperateCssModules ? {
88
102
  test: /\.css$/,
89
103
  exclude: /\.module\.css$/,
90
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, '[local]', false, null)
104
+ use: (0, _loaderUtils.getCSSLoaders)({
105
+ plugins,
106
+ exclude,
107
+ mediaQueryHoverActiveString,
108
+ cssVariableReplacementConfig,
109
+ selectorWeightConfig,
110
+ classNameBlob: '[local]',
111
+ cssUniqueness: false,
112
+ selectorReplace: null
113
+ })
91
114
  } : null, {
92
115
  test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
93
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
116
+ use: (0, _loaderUtils.getCSSLoaders)({
117
+ plugins,
118
+ exclude,
119
+ mediaQueryHoverActiveString,
120
+ cssVariableReplacementConfig,
121
+ selectorWeightConfig,
122
+ classNameBlob: null,
123
+ cssUniqueness,
124
+ selectorReplace,
125
+ cssHashSelectors,
126
+ classNamePrefix
127
+ })
94
128
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
95
129
  test: /\.tmpl$/,
96
130
  use: [{
@@ -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 _libAlias = require("./libAlias");
12
+
8
13
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
+
9
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
10
17
  const options = (0, _utils.getOptions)();
11
18
  const {
12
19
  unstableDepsInverse,
@@ -19,6 +26,7 @@ const {
19
26
  exclude,
20
27
  mediaQueryHoverActiveString,
21
28
  cssVariableReplacementConfig,
29
+ selectorWeightConfig,
22
30
  cssHashSelectors,
23
31
  classNamePrefix
24
32
  },
@@ -28,6 +36,7 @@ const {
28
36
  } = options;
29
37
  const appPath = process.cwd();
30
38
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
39
+
31
40
  module.exports = isSSTest => ({
32
41
  entry: {
33
42
  main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
@@ -67,7 +76,18 @@ module.exports = isSSTest => ({
67
76
  exclude: /node_modules/
68
77
  }, {
69
78
  test: /(\.module)?\.css$/,
70
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
79
+ use: (0, _loaderUtils.getCSSLoaders)({
80
+ plugins,
81
+ exclude,
82
+ mediaQueryHoverActiveString,
83
+ cssVariableReplacementConfig,
84
+ selectorWeightConfig,
85
+ classNameBlob: false,
86
+ cssUniqueness,
87
+ selectorReplace: null,
88
+ cssHashSelectors,
89
+ classNamePrefix
90
+ })
71
91
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
72
92
  test: /\.html$/,
73
93
  use: {
@@ -1,11 +1,17 @@
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
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  const options = (0, _utils.getOptions)();
10
16
  const {
11
17
  docs: {
@@ -15,6 +21,7 @@ const {
15
21
  exclude,
16
22
  mediaQueryHoverActiveString,
17
23
  cssVariableReplacementConfig,
24
+ selectorWeightConfig,
18
25
  cssHashSelectors,
19
26
  enableChunkHash,
20
27
  classNamePrefix
@@ -64,7 +71,18 @@ module.exports = {
64
71
  exclude: /node_modules/
65
72
  }, {
66
73
  test: /(\.module)?\.css$/,
67
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
74
+ use: (0, _loaderUtils.getCSSLoaders)({
75
+ plugins,
76
+ exclude,
77
+ mediaQueryHoverActiveString,
78
+ cssVariableReplacementConfig,
79
+ selectorWeightConfig,
80
+ classNameBlob: false,
81
+ cssUniqueness,
82
+ selectorReplace: null,
83
+ cssHashSelectors,
84
+ classNamePrefix
85
+ })
68
86
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
69
87
  test: /\.html$/,
70
88
  use: {
@@ -1,15 +1,22 @@
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 _libAlias = require("./libAlias");
14
+
9
15
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
16
+
10
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- // import TerserPlugin from 'terser-webpack-plugin';
12
18
 
19
+ // import TerserPlugin from 'terser-webpack-plugin';
13
20
  const options = (0, _utils.getOptions)();
14
21
  let {
15
22
  unstableDepsInverse,
@@ -26,6 +33,7 @@ let {
26
33
  exclude,
27
34
  mediaQueryHoverActiveString,
28
35
  cssVariableReplacementConfig,
36
+ selectorWeightConfig,
29
37
  cssUniqueness,
30
38
  server: {
31
39
  mode
@@ -50,9 +58,11 @@ const output = {
50
58
  jsonpFunction: `${context}Jsonp`,
51
59
  sourceMapFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js.map' : 'js/[name]_.js.map'
52
60
  };
61
+
53
62
  if (crossorigin) {
54
63
  output.crossOriginLoading = 'anonymous';
55
64
  }
65
+
56
66
  if (isDevelopment) {
57
67
  const {
58
68
  disableContextURL
@@ -61,6 +71,7 @@ if (isDevelopment) {
61
71
  const serverUrl = (0, _utils.getServerURL)(server, 'https');
62
72
  output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
63
73
  }
74
+
64
75
  const shouldRemovePropTypes = !isDevelopment && removePropTypes;
65
76
  module.exports = {
66
77
  entry: (0, _common.getEntries)(options, 'production'),
@@ -126,19 +137,42 @@ module.exports = {
126
137
  // include: path.join(appPath, folder)
127
138
  include: module => {
128
139
  const srcPath = _path.default.join(appPath, folder);
140
+
129
141
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
142
+
130
143
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
131
144
  return true;
132
145
  }
146
+
133
147
  return false;
134
148
  }
135
149
  }, seperateCssModules ? {
136
150
  test: /\.css$/,
137
151
  exclude: /\.module\.css$/,
138
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, cssVariableReplacementConfig, mediaQueryHoverActiveString, '[local]', false, null)
152
+ use: (0, _loaderUtils.getCSSLoaders)({
153
+ plugins,
154
+ exclude,
155
+ cssVariableReplacementConfig,
156
+ selectorWeightConfig,
157
+ mediaQueryHoverActiveString,
158
+ classNameBlob: '[local]',
159
+ cssUniqueness: false,
160
+ selectorReplace: null
161
+ })
139
162
  } : null, {
140
163
  test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
141
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
164
+ use: (0, _loaderUtils.getCSSLoaders)({
165
+ plugins,
166
+ exclude,
167
+ mediaQueryHoverActiveString,
168
+ cssVariableReplacementConfig,
169
+ selectorWeightConfig,
170
+ classNameBlob: false,
171
+ cssUniqueness,
172
+ selectorReplace,
173
+ cssHashSelectors,
174
+ classNamePrefix
175
+ })
142
176
  }, {
143
177
  test: /\.jpe?g$|\.gif$|\.png$/,
144
178
  use: [{
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _propTypes = _interopRequireDefault(require("prop-types"));
4
+
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");
10
+
7
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;
@@ -1,16 +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
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+
6
9
  function jsFileFilter(listOfObject) {
7
10
  let fileNameList = [];
8
11
  let curListName = process.cwd().split(_path.default.sep);
9
12
  let currentDirName = curListName[curListName.length - 1];
10
13
  listOfObject.forEach(fileObj => {
11
14
  let fileName = fileObj.FILEPATH;
15
+
12
16
  if (fileName.includes(currentDirName)) {
13
17
  fileName = fileName.split(currentDirName + '/')[1]; //eslint-disable-line
18
+
14
19
  if (fileName.includes('.js') && !fileName.includes('.json') && !fileName.includes('.docs.js') && !fileName.includes('.spec.js')) {
15
20
  fileNameList.push(fileName);
16
21
  }
@@ -18,6 +23,7 @@ function jsFileFilter(listOfObject) {
18
23
  });
19
24
  return fileNameList;
20
25
  }
26
+
21
27
  function coverage(devBranch, compareWith, serviceName, domain) {
22
28
  return new Promise(resolve => {
23
29
  (0, _utils.request)({
@@ -26,21 +32,25 @@ function coverage(devBranch, compareWith, serviceName, domain) {
26
32
  body
27
33
  }) => {
28
34
  let res = JSON.parse(body);
35
+
29
36
  if (Object.keys(res).length > 0) {
30
37
  if (Object.prototype.hasOwnProperty.call(res, 'STATUS')) {
31
38
  if (res.STATUS) {
32
39
  let listOfFiles = [];
40
+
33
41
  if (Object.keys(res.DIFF_FILES).length > 0) {
34
42
  if (Object.prototype.hasOwnProperty.call(res.DIFF_FILES, 'ADDED')) {
35
43
  if (res.DIFF_FILES.ADDED.length > 0) {
36
44
  listOfFiles = listOfFiles.concat(jsFileFilter(res.DIFF_FILES.ADDED));
37
45
  }
38
46
  }
47
+
39
48
  if (Object.prototype.hasOwnProperty.call(res.DIFF_FILES, 'UPDATED')) {
40
49
  if (res.DIFF_FILES.UPDATED.length > 0) {
41
50
  listOfFiles = listOfFiles.concat(jsFileFilter(res.DIFF_FILES.UPDATED));
42
51
  }
43
52
  }
53
+
44
54
  if (listOfFiles.length > 0) {
45
55
  resolve({
46
56
  STATUS: true,
@@ -92,4 +102,5 @@ function coverage(devBranch, compareWith, serviceName, domain) {
92
102
  });
93
103
  });
94
104
  }
105
+
95
106
  module.exports = coverage;
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _jsonHelper = require("../utils/jsonHelper");
9
+
8
10
  var _default = (resultObj, coverage, status = true, type = 'unitcase', filecoverage = 0) => {
9
11
  let pathArray = [];
10
12
  let resultJson = {};
@@ -32,17 +34,21 @@ var _default = (resultObj, coverage, status = true, type = 'unitcase', filecover
32
34
  } else if (testCase.status === 'passed') {
33
35
  fileObj.CaseList.passedCaseList.push(testCase.title);
34
36
  }
37
+
35
38
  return testCase;
36
39
  });
37
40
  fileDetailList.push(fileObj);
38
41
  return testFile;
39
42
  });
43
+
40
44
  if (type !== 'unitcase') {
41
45
  Array.prototype.push.apply(pathArray, ['tests', 'modifiedFileUnitCase']);
42
46
  } else {
43
47
  Array.prototype.push.apply(pathArray, ['tests', 'unitCase']);
44
48
  }
49
+
45
50
  resultJson.fileDetails = fileDetailList;
46
51
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, pathArray, resultJson);
47
52
  };
53
+
48
54
  exports.default = _default;
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
+
4
5
  var _postcssHashClassname = _interopRequireDefault(require("postcss-hash-classname"));
6
+
5
7
  var _fs = _interopRequireDefault(require("fs"));
8
+
6
9
  var _utils = require("../../utils");
10
+
7
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
8
13
  let count = 0;
9
14
  const options = (0, _utils.getOptions)();
10
15
  const {
@@ -23,8 +28,11 @@ module.exports = {
23
28
  };
24
29
  const processor = (0, _postcss.default)([(0, _postcssHashClassname.default)(opts)]);
25
30
  processor.process(src).css;
31
+
26
32
  const jsonMap = _fs.default.readFileSync(`jsonFile_test_${count}.json`, 'UTF-8');
33
+
27
34
  _fs.default.unlinkSync(`jsonFile_test_${count}.json`);
35
+
28
36
  return `module.exports =${jsonMap}`;
29
37
  }
30
38
  };