@zohodesk/react-cli 0.0.1-test.148.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -183
  3. package/.prettierrc +6 -0
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1152 -678
  7. package/bin/cli.js +483 -392
  8. package/docs/CustomChunks.md +26 -0
  9. package/docs/DevServerPort.md +39 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -0
  15. package/docs/ValueReplacer.md +60 -0
  16. package/docs/VariableConversion.md +724 -0
  17. package/docs/warnings_while_install.txt +35 -0
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/common/index.js +6 -6
  21. package/lib/common/splitChunks.js +60 -12
  22. package/lib/common/sslcertUpdater.js +59 -0
  23. package/lib/common/testPattern.js +69 -0
  24. package/lib/common/valueReplacer.js +55 -0
  25. package/lib/configs/jest.config.js +18 -8
  26. package/lib/configs/libAlias.js +38 -0
  27. package/lib/configs/resolvers.js +40 -0
  28. package/lib/configs/webpack.css.umd.config.js +4 -4
  29. package/lib/configs/webpack.dev.config.js +59 -54
  30. package/lib/configs/webpack.docs.config.js +56 -53
  31. package/lib/configs/webpack.impact.config.js +54 -50
  32. package/lib/configs/webpack.prod.config.js +72 -47
  33. package/lib/constants.js +31 -0
  34. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  35. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  36. package/lib/loaderUtils/getCSSLoaders.js +89 -21
  37. package/lib/loaderUtils/index.js +4 -4
  38. package/lib/loaderUtils/windowsModification.js +11 -0
  39. package/lib/loaders/fileBountryLoader.js +17 -0
  40. package/lib/loaders/scriptInstrumentLoader.js +2 -2
  41. package/lib/loaders/selectorMappingLoader.js +75 -0
  42. package/lib/loaders/workerLoader.js +9 -9
  43. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  44. package/lib/pluginUtils/getDevPlugins.js +68 -45
  45. package/lib/pluginUtils/getDocsPlugins.js +6 -8
  46. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  47. package/lib/pluginUtils/getProdPlugins.js +72 -58
  48. package/lib/pluginUtils/index.js +12 -12
  49. package/lib/plugins/CdnChangePlugin.js +16 -2
  50. package/lib/plugins/EFCPlugin.js +52 -20
  51. package/lib/plugins/EFCPlugin.md +6 -0
  52. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  53. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  54. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  55. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  56. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  57. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  58. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  59. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  60. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  61. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  62. package/lib/plugins/ManifestPlugin.js +8 -0
  63. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  64. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  65. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  66. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  67. package/lib/plugins/SelectorPlugin.js +97 -0
  68. package/lib/plugins/ServiceWorkerPlugin.js +13 -9
  69. package/lib/plugins/SourceMapHookPlugin.js +9 -3
  70. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  71. package/lib/plugins/VariableConversionCollector.js +352 -0
  72. package/lib/plugins/composeCommonPlugin.js +30 -0
  73. package/lib/plugins/index.js +36 -36
  74. package/lib/plugins/libraryImpactPlugin.js +14 -2
  75. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  76. package/lib/postcss-plugins/RTLSplitPlugin.js +13 -13
  77. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  78. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  79. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  80. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  81. package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
  82. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
  83. package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
  84. package/lib/postcss-plugins/variableModifier.js +244 -0
  85. package/lib/schemas/index.js +165 -11
  86. package/lib/servers/devBuild.js +102 -0
  87. package/lib/servers/docsServerCore.js +16 -18
  88. package/lib/servers/getCliPath.js +28 -0
  89. package/lib/servers/httpsOptions.js +49 -0
  90. package/lib/servers/nowatchserver.js +206 -0
  91. package/lib/servers/server.js +114 -82
  92. package/lib/sh/pre-commit.sh +34 -34
  93. package/lib/sh/reportPublish.sh +45 -45
  94. package/lib/templates/linterConstant.js +1 -1
  95. package/lib/utils/buildstats.html +148 -148
  96. package/lib/utils/cssClassNameGenerate.js +9 -2
  97. package/lib/utils/cssURLReplacer.js +30 -43
  98. package/lib/utils/getCurrentBranch.js +1 -1
  99. package/lib/utils/getDependenciesImpactList.js +14 -12
  100. package/lib/utils/getFileType.js +49 -0
  101. package/lib/utils/getOptions.js +118 -10
  102. package/lib/utils/index.js +44 -20
  103. package/lib/utils/jsonHelper.js +12 -3
  104. package/lib/utils/reinstallDependencies.js +1 -1
  105. package/lib/utils/repoClone.js +16 -4
  106. package/lib/utils/resultSchema.json +73 -73
  107. package/lib/utils/rtl.js +19 -2
  108. package/lib/utils/useExitCleanup.js +55 -0
  109. package/npm8.md +9 -0
  110. package/package.json +121 -142
  111. package/postpublish.js +8 -0
  112. package/result.json +1 -0
  113. package/templates/app/.eslintrc.js +140 -140
  114. package/templates/app/README.md +12 -12
  115. package/templates/app/app/index.html +24 -24
  116. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  117. package/templates/app/app/properties/i18nkeys.json +3 -3
  118. package/templates/app/docs/all.html +69 -69
  119. package/templates/app/mockapi/index.js +18 -18
  120. package/templates/app/package.json +37 -37
  121. package/templates/app/src/actions/SampleActions/index.js +37 -37
  122. package/templates/app/src/actions/index.js +65 -65
  123. package/templates/app/src/appUrls.js +19 -19
  124. package/templates/app/src/components/Alert/Alert.js +134 -134
  125. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  126. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  127. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  128. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  129. package/templates/app/src/components/Sample/SampleList.js +61 -61
  130. package/templates/app/src/components/Slider/Slider.css +41 -41
  131. package/templates/app/src/components/Slider/Slider.js +55 -55
  132. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  133. package/templates/app/src/containers/AppContainer/index.js +96 -96
  134. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  135. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  136. package/templates/app/src/containers/DevTools/index.js +10 -10
  137. package/templates/app/src/containers/Header/index.js +67 -67
  138. package/templates/app/src/containers/Header/index.module.css +43 -43
  139. package/templates/app/src/containers/Redirect/index.js +63 -63
  140. package/templates/app/src/containers/Redirector/index.js +47 -47
  141. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  142. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  143. package/templates/app/src/historyChange.js +5 -5
  144. package/templates/app/src/index.html +10 -10
  145. package/templates/app/src/index.js +24 -24
  146. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  147. package/templates/app/src/reducers/alertData.js +11 -11
  148. package/templates/app/src/reducers/index.js +6 -6
  149. package/templates/app/src/reducers/samples.js +19 -19
  150. package/templates/app/src/store/configureStore.dev.js +51 -51
  151. package/templates/app/src/store/configureStore.js +5 -5
  152. package/templates/app/src/store/configureStore.prod.js +26 -26
  153. package/templates/app/src/util/Common.js +5 -5
  154. package/templates/app/src/util/RequestAPI.js +132 -132
  155. package/templates/docs/all.html +249 -249
  156. package/templates/docs/component.html +178 -178
  157. package/templates/docs/components.html +221 -221
  158. package/templates/docs/css/b.min.css +6 -6
  159. package/templates/docs/css/component.css +42 -42
  160. package/templates/docs/css/componentTest.css +6 -6
  161. package/templates/docs/css/hopscotch.css +585 -585
  162. package/templates/docs/css/style.css +1022 -1022
  163. package/templates/docs/impactReportTemplate.html +154 -154
  164. package/templates/docs/index.html +1501 -1493
  165. package/templates/docs/js/active-line.js +72 -72
  166. package/templates/docs/js/b.min.js +7 -7
  167. package/templates/docs/js/codemirror.js +9680 -9680
  168. package/templates/docs/js/designTokens.js +334 -334
  169. package/templates/docs/js/j.min.js +4 -4
  170. package/templates/docs/js/javascript.js +874 -874
  171. package/templates/docs/js/matchbrackets.js +145 -145
  172. package/unittest/index.html +37 -0
  173. package/cert/cert.pem +0 -105
  174. package/cert/key.pem +0 -30
@@ -0,0 +1,35 @@
1
+ npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
2
+ npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin
3
+ npm WARN deprecated gitlab@14.2.2: The gitlab package has found a new home in the @gitbeaker organization. For the latest gitlab node library, check out @gitbeaker/node. A full list of the features can be found here: https://github.com/jdalrymple/gitbeaker#readme
4
+ npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
5
+ npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
6
+ npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
7
+ npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
8
+ npm WARN deprecated cross-spawn-async@1.0.1: cross-spawn no longer requires a build toolchain, use it instead
9
+ npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
10
+ npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
11
+ npm WARN deprecated har-validator@5.1.5: this library is no longer supported
12
+ npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
13
+ npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
14
+ npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
15
+ npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
16
+ npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
17
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
18
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
20
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
21
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
22
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
23
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
24
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25
+ npm WARN check2@1.0.0 No description
26
+ npm WARN check2@1.0.0 No repository field.
27
+
28
+ + @zohodesk/react-cli@0.0.1-beta.165
29
+ updated 1 package and audited 1899 packages in 51.509s
30
+
31
+ 21 packages are looking for funding
32
+ run `npm fund` for details
33
+
34
+ found 42 vulnerabilities (2 low, 20 moderate, 8 high, 12 critical)
35
+ run `npm audit fix` to fix them, or `npm audit` for details
package/files/eslintrc.js CHANGED
@@ -1,62 +1,62 @@
1
- const [off, , error] = ['off', 'warn', 'error'];
2
-
3
- module.exports = {
4
- env: {
5
- browser: true,
6
- es2021: true,
7
- },
8
- extends: [
9
- 'plugin:react/recommended',
10
- 'plugin:react-hooks/recommended',
11
- 'airbnb',
12
- 'prettier',
13
- ],
14
- parserOptions: {
15
- ecmaFeatures: {
16
- jsx: true,
17
- },
18
- ecmaVersion: 12,
19
- sourceType: 'module',
20
- },
21
- plugins: [
22
- 'react',
23
- 'css-modules',
24
- '@zohodesk/zsecurity',
25
- '@zohodesk/react-performance',
26
- ],
27
- rules: {
28
- // Internal Rules
29
- '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
30
- '@zohodesk/zsecurity/no-unsecure-html': error,
31
- '@zohodesk/zsecurity/no-protocol-check': error,
32
-
33
- // CSS Module Rules
34
- 'css-modules/no-unused-class': [error, { camelCase: true }],
35
- 'css-modules/no-undef-class': [error, { camelCase: 'only' }],
36
-
37
- 'import/no-unresolved': off,
38
- 'import/no-extraneous-dependencies': off,
39
-
40
- // As redux used
41
- 'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
42
- 'react/jsx-filename-extension': off,
43
-
44
- // As we don't follow
45
- 'react/require-default-props': off,
46
- 'react/jsx-props-no-spreading': off,
47
-
48
- // As we didn't update
49
- 'react/jsx-fragments': off,
50
-
51
- // Not needed
52
- 'no-plusplus': off,
53
- 'no-unused-expressions': [
54
- error,
55
- {
56
- allowShortCircuit: true,
57
- allowTernary: true,
58
- },
59
- ],
60
- 'react/jsx-no-target-blank': error,
61
- },
62
- };
1
+ const [off, , error] = ['off', 'warn', 'error'];
2
+
3
+ module.exports = {
4
+ env: {
5
+ browser: true,
6
+ es2021: true,
7
+ },
8
+ extends: [
9
+ 'plugin:react/recommended',
10
+ 'plugin:react-hooks/recommended',
11
+ 'airbnb',
12
+ 'prettier',
13
+ ],
14
+ parserOptions: {
15
+ ecmaFeatures: {
16
+ jsx: true,
17
+ },
18
+ ecmaVersion: 12,
19
+ sourceType: 'module',
20
+ },
21
+ plugins: [
22
+ 'react',
23
+ 'css-modules',
24
+ '@zohodesk/zsecurity',
25
+ '@zohodesk/react-performance',
26
+ ],
27
+ rules: {
28
+ // Internal Rules
29
+ '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
30
+ '@zohodesk/zsecurity/no-unsecure-html': error,
31
+ '@zohodesk/zsecurity/no-protocol-check': error,
32
+
33
+ // CSS Module Rules
34
+ 'css-modules/no-unused-class': [error, { camelCase: true }],
35
+ 'css-modules/no-undef-class': [error, { camelCase: 'only' }],
36
+
37
+ 'import/no-unresolved': off,
38
+ 'import/no-extraneous-dependencies': off,
39
+
40
+ // As redux used
41
+ 'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
42
+ 'react/jsx-filename-extension': off,
43
+
44
+ // As we don't follow
45
+ 'react/require-default-props': off,
46
+ 'react/jsx-props-no-spreading': off,
47
+
48
+ // As we didn't update
49
+ 'react/jsx-fragments': off,
50
+
51
+ // Not needed
52
+ 'no-plusplus': off,
53
+ 'no-unused-expressions': [
54
+ error,
55
+ {
56
+ allowShortCircuit: true,
57
+ allowTernary: true,
58
+ },
59
+ ],
60
+ 'react/jsx-no-target-blank': error,
61
+ },
62
+ };
@@ -1,3 +1,3 @@
1
- module.exports = {
2
- trailingComma: 'none',
3
- };
1
+ module.exports = {
2
+ trailingComma: 'none',
3
+ };
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "splitChunks", {
7
- enumerable: true,
8
- get: function () {
9
- return _splitChunks.default;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "getEntries", {
13
7
  enumerable: true,
14
8
  get: function () {
@@ -21,6 +15,12 @@ Object.defineProperty(exports, "getPublicPathConfig", {
21
15
  return _getPublicPathConfig.default;
22
16
  }
23
17
  });
18
+ Object.defineProperty(exports, "splitChunks", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _splitChunks.default;
22
+ }
23
+ });
24
24
  Object.defineProperty(exports, "templateParameters", {
25
25
  enumerable: true,
26
26
  get: function () {
@@ -7,9 +7,11 @@ exports.default = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
10
+ var _os = _interopRequireDefault(require("os"));
11
+
10
12
  var _utils = require("../utils");
11
13
 
12
- var _os = _interopRequireDefault(require("os"));
14
+ var _testPattern = require("./testPattern");
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
@@ -19,7 +21,8 @@ let options = (0, _utils.getOptions)();
19
21
  let {
20
22
  app: {
21
23
  vendorExclude,
22
- customChunks
24
+ customChunks,
25
+ vendorInclude
23
26
  }
24
27
  } = options;
25
28
 
@@ -29,7 +32,7 @@ let isVendor = function isVendor(module) {
29
32
  } = module;
30
33
  let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
31
34
  excludeList = [...excludeList, ...vendorExclude];
32
- return userRequest && userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && excludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1);
35
+ return userRequest && (vendorInclude.some(item => userRequest.indexOf(item) !== -1) || userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && excludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1));
33
36
  };
34
37
 
35
38
  let isReact = module => {
@@ -46,30 +49,75 @@ let defaultChunks = {
46
49
  chunks: 'all',
47
50
  minChunks: 1,
48
51
  test: isReact,
52
+ enforce: true,
53
+ // priority: 10
49
54
  priority: -10
50
55
  },
51
56
  vendor: {
52
57
  name: 'vendor',
53
58
  chunks: 'all',
59
+ // chunks: 'initial',
54
60
  minChunks: 1,
55
61
  test: isVendor,
62
+ // priority: 19,
56
63
  priority: -10
57
64
  }
58
65
  };
59
66
  let customChunksConfig = {};
60
- customChunks.map(({
67
+ customChunks.map((obj, index) => ({
68
+ name: obj.name,
69
+ pattern: obj.pattern,
70
+ minChunks: obj.minChunks || obj.size || 2,
71
+ rules: obj.rules,
72
+ // includeDepenency: obj.includeDepenency || false,
73
+ priority: obj.priority || -10 * (index + 2),
74
+ enforce: obj.enforce || true,
75
+ maxSize: obj.maxSize,
76
+ // || 0,
77
+ minSize: obj.minSize,
78
+ // || 20000,
79
+ chunks: obj.chunks || 'all'
80
+ })).map(({
61
81
  name,
62
82
  pattern,
63
- size = 2
64
- }, index) => customChunksConfig[name] = {
65
- name,
66
- test: new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
67
- chunks: 'all',
68
- enforce: true,
69
- minChunks: size,
70
- priority: -10 * (index + 2)
83
+ minChunks,
84
+ rules,
85
+ priority,
86
+ // includeDepenency,
87
+ enforce,
88
+ minSize,
89
+ maxSize,
90
+ chunks = 'all'
91
+ }) => {
92
+ let obj = {
93
+ name,
94
+ test: rules ? m => {
95
+ const {
96
+ userRequest
97
+ } = m;
98
+ return (0, _testPattern.testPattern)(userRequest, rules); // return (
99
+ // pkgs.some(p => isRelated(userRequest, p)) ||
100
+ // (includeDepenency && isDependency(m, pkgs))
101
+ // );
102
+ } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
103
+ chunks,
104
+ enforce,
105
+ minChunks,
106
+ priority
107
+ };
108
+
109
+ if (minSize !== undefined) {
110
+ obj.minSize = minSize;
111
+ }
112
+
113
+ if (maxSize !== undefined) {
114
+ obj.maxSize = maxSize;
115
+ }
116
+
117
+ return customChunksConfig[name] = obj;
71
118
  });
72
119
  var _default = {
120
+ minSize: 12000,
73
121
  cacheGroups: Object.assign({
74
122
  default: false,
75
123
  vendors: false
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var _https = _interopRequireDefault(require("https"));
4
+
5
+ var _http = _interopRequireDefault(require("http"));
6
+
7
+ var _path = _interopRequireDefault(require("path"));
8
+
9
+ var _fs = _interopRequireDefault(require("fs"));
10
+
11
+ var _getOptions = _interopRequireDefault(require("../utils/getOptions"));
12
+
13
+ var _urlConcat = require("../utils/urlConcat");
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ const {
18
+ sslCertURL
19
+ } = (0, _getOptions.default)();
20
+
21
+ const CRET_FOLDER_PATH = _path.default.join(__dirname, '..', '..', 'cert');
22
+
23
+ console.log({
24
+ CRET_FOLDER_PATH,
25
+ sslCertURL
26
+ });
27
+ const CERT_PATH = 'cert.pem';
28
+ const KEY_PATH = 'key.pem';
29
+ const PASSPHRASE_PATH = 'passphrase.pem';
30
+
31
+ function updateSSlFile(sslCertURL, filename) {
32
+ let url = (0, _urlConcat.urlConcat)(sslCertURL, filename);
33
+ console.log({
34
+ url
35
+ });
36
+ (url.startsWith('https://') ? _https.default : _http.default).get(url, resp => {
37
+ let fpath = _path.default.join(CRET_FOLDER_PATH, filename);
38
+
39
+ let data = ''; // A chunk of data has been received.
40
+
41
+ resp.on('data', chunk => {
42
+ data += chunk;
43
+ }); // The whole response has been received. Print out the result.
44
+
45
+ resp.on('end', () => {
46
+ _fs.default.writeFileSync(fpath, data);
47
+ }); // return;
48
+ }).on('error', err => {
49
+ console.log(`Error: ${err.message}`);
50
+ });
51
+ }
52
+
53
+ if (!sslCertURL) {
54
+ throw 'sslCertURL not given';
55
+ }
56
+
57
+ updateSSlFile(sslCertURL, PASSPHRASE_PATH);
58
+ updateSSlFile(sslCertURL, CERT_PATH);
59
+ updateSSlFile(sslCertURL, KEY_PATH);
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isDependency = isDependency;
7
+ exports.isRelatedPackage = exports.isRelated = void 0;
8
+ exports.testPattern = testPattern;
9
+
10
+ var _path = require("path");
11
+
12
+ // in our development we only use windows, mac and linux
13
+ const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
14
+
15
+ function _testPattern(req, pattern) {
16
+ let modifyedPattern = pattern;
17
+
18
+ if (/[*.$^]/.test(modifyedPattern)) {
19
+ if (isWindows) {
20
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
22
+ }
23
+
24
+ modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
+ const re = new RegExp(modifyedPattern);
26
+ return re.test(req);
27
+ }
28
+
29
+ if (isWindows) {
30
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\');
32
+ }
33
+
34
+ return req.indexOf(modifyedPattern) !== -1;
35
+ }
36
+
37
+ function testPattern(req, pattern) {
38
+ if (!req || !pattern) {
39
+ return false;
40
+ }
41
+
42
+ if (Array.isArray(pattern)) {
43
+ // eslint-disable-next-line no-unused-vars
44
+ return pattern.every(p => testPattern(req, p));
45
+ }
46
+
47
+ if (pattern[0] === '!') {
48
+ return !_testPattern(req, pattern.slice(1));
49
+ }
50
+
51
+ return _testPattern(req, pattern);
52
+ }
53
+
54
+ const isRelated = (req, item) => req && req.indexOf(item) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
55
+
56
+
57
+ exports.isRelated = isRelated;
58
+
59
+ const isRelatedPackage = (req, item) => isRelated(req, `node_modules${_path.sep}${item}${_path.sep}`) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
60
+
61
+
62
+ exports.isRelatedPackage = isRelatedPackage;
63
+
64
+ function isDependency(m, excludeList) {
65
+ // let reasons = m.reasons.map(r => r.module.userRequest);
66
+ // m.reasons.some(r => !r.module || !r.module.userRequest) && console.log(m.reasons);
67
+ return m.reasons.some(r => excludeList.some(item => r.module && isRelated(r.module.userRequest, item)));
68
+ } // export function queryHandler(conditions, pattern) {
69
+ // }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _postcss = _interopRequireDefault(require("postcss"));
4
+
5
+ var _path = _interopRequireDefault(require("path"));
6
+
7
+ var _fs = _interopRequireDefault(require("fs"));
8
+
9
+ var _folderIterator = _interopRequireDefault(require("../utils/folderIterator"));
10
+
11
+ var _utils = require("../utils");
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ const cwd = process.cwd();
16
+
17
+ const src = _path.default.join(cwd, process.argv[2]);
18
+
19
+ const dist = _path.default.join(cwd, process.argv[3]);
20
+
21
+ const docopy = process.argv[4] === 'true';
22
+ const {
23
+ css: {
24
+ valueReplacer
25
+ }
26
+ } = (0, _utils.getOptions)();
27
+
28
+ if (!_fs.default.existsSync(dist)) {
29
+ _fs.default.mkdirSync(dist, {
30
+ recursive: true
31
+ });
32
+ }
33
+
34
+ (0, _folderIterator.default)(src, dist, docopy ? false : ['.css'], false, (fromPath, toPath) => {
35
+ //console.log({ fromPath: fromPath, toPath: toPath });
36
+ let css = _fs.default.readFileSync(fromPath);
37
+
38
+ if (docopy && !fromPath.endsWith('.css')) {
39
+ //console.log(toPath,'....');
40
+ _fs.default.writeFileSync(toPath, css);
41
+
42
+ return;
43
+ }
44
+
45
+ (0, _postcss.default)([valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer)]).process(css, {
46
+ from: fromPath,
47
+ to: toPath
48
+ }).then(result => {
49
+ _fs.default.writeFile(toPath, result.css, () => true);
50
+
51
+ if (result.map) {
52
+ _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
53
+ }
54
+ });
55
+ });
@@ -1,11 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ var _fs = require("fs");
4
+
3
5
  var _path = _interopRequireDefault(require("path"));
4
6
 
7
+ var _libAlias = require("./libAlias");
8
+
5
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
10
 
7
- let appPath = process.cwd();
8
- let commonConfig = {
11
+ const appPath = process.cwd();
12
+
13
+ const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
14
+
15
+ const commonConfig = {
9
16
  coverageReporters: ['json', 'html', 'json-summary', 'text'],
10
17
  collectCoverage: true,
11
18
  moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
@@ -14,12 +21,15 @@ let commonConfig = {
14
21
  '^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
15
22
  '^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
16
23
  },
17
- moduleNameMapper: {
18
- '\\.(css|less)$': 'identity-obj-proxy'
19
- },
20
- transformIgnorePatterns: ['/node_modules.*?.js$'],
24
+ moduleNameMapper: _libAlias.jestModuleNameMapper,
25
+ // moduleNameMapper: {
26
+ // ...moduleNameMapper,
27
+ // '\\.(css|less)$': 'identity-obj-proxy'
28
+ // },
29
+ transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
30
+ // transformIgnorePatterns: ['/node_modules.*?.js$'],
21
31
  moduleFileExtensions: ['js'],
22
- setupFiles: [_path.default.resolve(appPath, '__testUtils__', 'globals.js'), _path.default.resolve(__dirname, '..', 'jest', 'setup.js')],
32
+ setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
23
33
  globals: {
24
34
  __DEVELOPMENT__: true,
25
35
  __DOCS__: false,
@@ -28,7 +38,7 @@ let commonConfig = {
28
38
  };
29
39
 
30
40
  module.exports = (...args) => {
31
- let [appFolder, forCommittedFiles = false] = args;
41
+ const [appFolder, forCommittedFiles = false] = args;
32
42
 
33
43
  if (forCommittedFiles) {
34
44
  return Object.assign({}, commonConfig, {
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.libAlias = exports.jestModuleNameMapper = void 0;
7
+ // the reason for alias at the time was code tree shaking
8
+ // tree shaking was most compactable with ES module system
9
+ // FIXME: But there is a posiblity when these package does not have lib,
10
+ // app will work because of alias, But may be jest won't work because of not alais
11
+ // So need to think about use alais in jest
12
+ const libAlias = {
13
+ '@zohodesk/components/lib': '@zohodesk/components/es',
14
+ // '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
15
+ '@zohodesk/dot/lib': '@zohodesk/dot/es',
16
+ '@zohodesk/i18n/lib': '@zohodesk/i18n/es',
17
+ '@zohodesk/icons/lib': '@zohodesk/icons/es',
18
+ '@zohodesk/normalizer/lib': '@zohodesk/normalizer/es',
19
+ '@zohodesk/perf-components/lib': '@zohodesk/perf-components/es',
20
+ '@zohodesk/perf-middleware/lib': '@zohodesk/perf-middleware/es',
21
+ '@zohodesk/permissions/lib': '@zohodesk/permissions/es',
22
+ '@zohodesk/platform-middleware/lib': '@zohodesk/platform-middleware/es',
23
+ '@zohodesk/react-dnd/lib': '@zohodesk/react-dnd/es',
24
+ '@zohodesk/router-middleware/lib': '@zohodesk/router-middleware/es',
25
+ '@zohodesk/storage/lib': '@zohodesk/storage/es',
26
+ '@zohodesk/svg/lib': '@zohodesk/svg/es',
27
+ '@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
28
+ '@zohodesk/variables/lib': '@zohodesk/variables/es',
29
+ '@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
30
+ }; // '^@root(.*)$': '<rootDir>/src$1',
31
+ // '^@components(.*)$': '<rootDir>/src/components$1',
32
+
33
+ exports.libAlias = libAlias;
34
+ const jestModuleNameMapper = Object.keys(libAlias).reduce((previousValue, key) => {
35
+ previousValue[`^${key}(.*)$`] = `${libAlias[key]}$1`;
36
+ return previousValue;
37
+ }, {});
38
+ exports.jestModuleNameMapper = jestModuleNameMapper;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loaderResolver = loaderResolver;
7
+ exports.moduleResolver = moduleResolver;
8
+
9
+ var _constants = require("../constants");
10
+
11
+ var _libAlias = require("./libAlias");
12
+
13
+ var _client_packages_group = require("@zohodesk/client_packages_group");
14
+
15
+ function moduleResolver(options) {
16
+ const {
17
+ moduleResolvePath,
18
+ disableES5Transpile
19
+ } = options.app;
20
+ const nodeModulesPath = moduleResolvePath ? require(require.resolve(moduleResolvePath, {
21
+ paths: [options.cwd]
22
+ })).nodeModulesPath : _client_packages_group.nodeModulesPath; // const {unstableDepsInverse} = options;
23
+
24
+ return {
25
+ modules: [nodeModulesPath, _constants.cliNodemodulesPath, 'node_modules'].filter(Boolean),
26
+ alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
27
+
28
+ };
29
+ }
30
+
31
+ function loaderResolver(options) {
32
+ // const unstableDepsInverse = false;
33
+ const {
34
+ unstableDepsInverse
35
+ } = options;
36
+ return {
37
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
38
+
39
+ };
40
+ }
@@ -67,10 +67,10 @@ module.exports = {
67
67
  }],
68
68
  include: _path.default.join(appPath, 'src')
69
69
  }
70
- /*,
71
- {
72
- test: /\.css$/,
73
- use: [MiniCssExtractPlugin.loader, 'css-loader']
70
+ /*,
71
+ {
72
+ test: /\.css$/,
73
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
74
74
  }*/
75
75
  , {
76
76
  test: /(\.module)?\.css$/,