@zohodesk/react-cli 0.0.1-exp.162.3 → 0.0.1-exp.164.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
4
 
5
+ # 0.0.1-exp.164.1
6
+
7
+ - extra features in custom chunks
8
+ - `minChunks`: `minChunks` is alies of `size` default value is `2`,
9
+ - `rules`: rules,
10
+ - `chunks`: by this option you can specify , default value is `all`,
11
+ - `priority`: priority default value is -10 \* (index + 2),
12
+ - `enforce`: enforce default value is true,
13
+ - `maxSize`: maxSize, default value is 0,
14
+ - `minSize`: minSize, default value is 20000,
15
+ - <!-- includeDepenency: includeDepenency default value is false -->
16
+
17
+ # 0.0.1-exp.165
18
+
19
+ - **Features :-**
20
+ - auto remove vendor excluded dependency's dependency
21
+
5
22
  # 0.0.1-beta.164
6
23
 
7
24
  - typo fix
@@ -20,11 +37,6 @@ A CLI tool for build modern web application and libraries
20
37
  - option parse logic added for react-cli (exprimental)
21
38
  - `--stop_nodemon` usally preprocessor run in `nodemon` so to stop it this option is provided
22
39
 
23
- # 0.0.1-exp.162.3
24
-
25
- - **Optimazation:-**
26
- - Split chunks Optimization check
27
-
28
40
  # 0.0.1-exp.162.2
29
41
 
30
42
  - **Optimazation:-**
@@ -0,0 +1,3 @@
1
+ Suggestions :
2
+
3
+ 1. 'lint-setup', 'add-lint-scripts' not need to exposed
package/eslint/a23.c ADDED
@@ -0,0 +1,16 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 23
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int i = 20, j = 22, k = 20, l = 10;
9
+
10
+ for (int m = 0; m <= 10; m++)
11
+ {
12
+ l = ++i + ++j - k--;
13
+ }
14
+ printf("%d\n", l);
15
+ return 0;
16
+ }
package/eslint/a28.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 28
4
+ int mark(int x)
5
+ {
6
+ if (x <= 0)
7
+ {
8
+ return 1;
9
+ }
10
+ return 0;
11
+ }
12
+
13
+ int main()
14
+ {
15
+ // Write C code here
16
+ int x = 2345, t, a = 0;
17
+ while (x > 0)
18
+ {
19
+ t = x % 10;
20
+ a += mark(t);
21
+ x /= 10;
22
+ }
23
+ printf("%d\n", a);
24
+ return 0;
25
+ }
package/eslint/a29.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 29
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int x = 777, y, s = 0, m, n, t, u;
9
+ y = x;
10
+ for (m = 0; y != 0; y /= 10)
11
+ {
12
+ u = y % 9;
13
+ for (n = m, t = 1; n >= 0; n--)
14
+ {
15
+ t *= 9;
16
+ }
17
+ if (u < 5)
18
+ {
19
+ u += 3;
20
+ }
21
+ s = s * u + t;
22
+ }
23
+ printf("%d\n", s);
24
+ return 0;
25
+ }
package/eslint/a30.c ADDED
@@ -0,0 +1,29 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 30
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int a[8] = {24, 27, 33, 27, 9, 43, 0, 3};
9
+ int i, sum = 0;
10
+ for (i = 0; i < 5; i = i + 1)
11
+ {
12
+ switch (a[i] % 3)
13
+ {
14
+ case 2:
15
+ sum = sum * sum;
16
+ break;
17
+ case 1:
18
+ sum += a[i];
19
+ break;
20
+ case 0:
21
+ sum -= a[i];
22
+ break;
23
+ default:
24
+ sum = sum * a[i];
25
+ }
26
+ }
27
+ printf("%d\n", sum);
28
+ return 0;
29
+ }
package/eslint/a31.c ADDED
@@ -0,0 +1,23 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 31
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int x = 16, y = 32, i = 0;
9
+ do
10
+ {
11
+ if (x % 2 == 0)
12
+ {
13
+ y /= 2;
14
+ }
15
+ if (y % 2 < 1)
16
+ {
17
+ x /= 2;
18
+ }
19
+ i++;
20
+ } while (x > 1);
21
+ printf("%d\n", i);
22
+ return 0;
23
+ }
package/eslint/a35.c ADDED
@@ -0,0 +1,23 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 34
4
+ int compute(int a, int b)
5
+ {
6
+ if (b == 1)
7
+ {
8
+ return a;
9
+ }
10
+ else
11
+ {
12
+ return a + compute(a, --b);
13
+ }
14
+ }
15
+
16
+ int main()
17
+ {
18
+ // Write C code here
19
+ int a = 37, b = 26, result = 0;
20
+ result = compute(a, b);
21
+ printf("%d\n", result);
22
+ return 0;
23
+ }
package/eslint/a36.c ADDED
@@ -0,0 +1,18 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 36
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char a[] = {'o', 'm', 'p', 'n', 'j', 'o'};
8
+ for (int i = 1; i <= 6; i++)
9
+ {
10
+ a[i - 1] = a[i - 1] + i;
11
+ }
12
+ for (int i = 0; i < 6; i++)
13
+ {
14
+ printf("%c\n", a[i]);
15
+ }
16
+ // printf("%d\n", result);
17
+ return 0;
18
+ }
package/eslint/a37.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 37
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char name[] = {'o', 'h', 'o', 'z', 'p', 'r', 'o', 'c'};
8
+ for (int i = 0, j = 7; i <= 7; i++, j--)
9
+ {
10
+ if (name[i] < name[j])
11
+ {
12
+ name[i] = name[j];
13
+ }
14
+ else
15
+ {
16
+ name[i] = name[i];
17
+ }
18
+ }
19
+ for (int i = 0; i <= 7; i++)
20
+ {
21
+ printf("%c", name[i]);
22
+ }
23
+ // printf("%d\n", result);
24
+ return 0;
25
+ }
package/eslint/a38.c ADDED
@@ -0,0 +1,28 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 38
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ int a = 7798, d = 1, temp, result = 1;
8
+ temp = a;
9
+ while (d)
10
+ {
11
+ d = temp % 10;
12
+ temp = temp / 10;
13
+ d %= 4;
14
+ switch (d)
15
+ {
16
+ case 0:
17
+ result += (a / 100) + (a % 100);
18
+ case 1:
19
+ result += (a / 100) + (a % 100);
20
+ case 2:
21
+ result += (a / 100) + (a % 100);
22
+ case 3:
23
+ result += (a / 100) + (a % 100);
24
+ };
25
+ }
26
+ printf("%d\n", result);
27
+ return 0;
28
+ }
package/eslint/a39.c ADDED
@@ -0,0 +1,17 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 39
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ int a = 20, b = 15, c = 0;
8
+
9
+ while (b > 0)
10
+ {
11
+ a = c + a - b;
12
+ b = a + 1;
13
+ c = b - 1;
14
+ }
15
+ printf("%d\n", a);
16
+ return 0;
17
+ }
package/eslint/a40.c ADDED
@@ -0,0 +1,32 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 40
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char a[5] = {'i', 'j', 'k', 'l', 'm'};
8
+ int i;
9
+ for (i = 0; i < 5; i++)
10
+ {
11
+ // printf("%d\n", a[i]);
12
+ switch (i % 2)
13
+ {
14
+ case 0:
15
+ a[i] = a[i] + 2;
16
+ break;
17
+ case 1:
18
+ a[i] = a[i] + 3;
19
+ break;
20
+ default:
21
+ a[i] = a[i] + 3;
22
+ }
23
+ }
24
+
25
+ for (i = 0; i < 5; i++)
26
+ {
27
+ printf("%c", a[i]);
28
+ }
29
+ // printf("\nHello world");
30
+
31
+ return 0;
32
+ }
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <title>mock api</title>
7
+ </head>
8
+ <body>
9
+ <h1>We are going to see how to use mock api</h1>
10
+ <ul>
11
+ <li>
12
+ Step 1:-
13
+ you need to start the app with "react-cli"."app"."server"."hasMock" as "true" in package.json
14
+ <code>npm run start --app-port=9090</code>
15
+ </li>
16
+ </ul>
17
+ </body>
18
+ </html>
@@ -0,0 +1,5 @@
1
+ # We are going to see how to use `Mock api`
2
+
3
+ - Step 1:-
4
+ you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` and **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>
5
+ - Step 2:- you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.criteriaHandler = criteriaHandler;
7
+
8
+ /*
9
+ root = {
10
+ a: 1
11
+ b: 0
12
+ op = "&"
13
+ }
14
+
15
+ rule = (1 & 2) | 0
16
+ root = {
17
+ a: {
18
+ a: 1
19
+ b: 2
20
+ op = "&"
21
+ }
22
+ b: 0
23
+ op = "|"
24
+ }
25
+
26
+ rule = (3 | !(1 & 2)) | 0
27
+ */
28
+ function parseNumber(rule, _i) {
29
+ let i = _i;
30
+ let ans = 0;
31
+
32
+ while (/[0-9]/.test(rule[i])) {
33
+ ans = ans * 10 + Number(rule[i]);
34
+ i++;
35
+ }
36
+
37
+ return [i, ans];
38
+ }
39
+
40
+ function criteriaParser(rule, _i = 0) {
41
+ let openBarceCount = 0; // let root = {};
42
+
43
+ let cur = {};
44
+ let c;
45
+
46
+ for (let i = _i; i < rule.length; i++) {
47
+ c = rule[i];
48
+
49
+ if (/[0-9]/.test(c)) {
50
+ let [_i, num] = parseNumber(rule, i);
51
+ i = _i - 1;
52
+
53
+ if (cur.a === undefined) {
54
+ cur.a = num; // } else if (cur.b === undefined) {
55
+ } else {
56
+ cur.b = num; // if (cur.op && cur.a);
57
+ // } else {
58
+ }
59
+ } else if (/[|&]/.test(c)) {
60
+ if (cur.op) {
61
+ // if (cur.b === undefined && cur.op !== '!') {
62
+ // throw `Error unexpected charector ${c} in index ${i}`;
63
+ // }
64
+ cur = {
65
+ a: cur,
66
+ op: c
67
+ };
68
+ } else {
69
+ cur.op = c;
70
+ }
71
+ } // if (c === '(' || c === ')') {
72
+ // if (openBarceCount) {
73
+ // openBarceCount++;
74
+ // } else if (c === ')') {
75
+ // openBarceCount--;
76
+ // cur = { a, b, op };
77
+ // }
78
+ // } else if (/[0-9]/.test(c)) {
79
+ // } else {
80
+ // }
81
+
82
+ }
83
+ }
84
+
85
+ function criteriaHandler(criterias, rule) {
86
+ if (/[(!)0-9&|]/.test(rule) === false) {
87
+ console.log('rule has unexpexted charectors');
88
+ }
89
+
90
+ let root = criteriaParser(rule);
91
+ }
@@ -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
 
@@ -39,91 +41,72 @@ let isReact = module => {
39
41
  } = module;
40
42
  let reactBundle = ['react', 'react-dom'];
41
43
  return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
42
- }; // let defaultChunks = {
43
- // 'react.vendor': {
44
- // name: 'react.vendor',
45
- // chunks: 'all',
46
- // minChunks: 1,
47
- // test: isReact,
48
- // priority: -10
49
- // },
50
- // vendor: {
51
- // name: 'vendor',
52
- // chunks: 'all',
53
- // minChunks: 1,
54
- // test: isVendor,
55
- // priority: -10
56
- // },
57
- // zohocharts: {
58
- // chunks: 'all',
59
- // minChunks: 1,
60
- // test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
61
- // priority: 30,
62
- // enforce: true
63
- // }
64
- // };
65
-
44
+ };
66
45
 
67
46
  let defaultChunks = {
68
47
  vendors: {
69
48
  // picks up everything from node_modules as long as the sum of node modules is larger than minSize
70
49
  //test: /[\\/]node_modules[\\/]((?!react).*)[\\/]/,
71
50
  test: isVendor,
51
+ chunks: 'initial',
52
+ // chunks: 'all',
72
53
  name: 'vendors',
73
54
  priority: 19,
74
- enforce: true,
75
- // causes maxInitialRequests to be ignored, minSize still respected if specified in cacheGroup
76
- minSize: 30000 // use the default minSize
77
-
78
- },
79
- vendorsAsync: {
80
- // vendors async chunk, remaining asynchronously used node modules as single chunk file
81
- test: /[\\/]node_modules[\\/]((?!react).*)[\\/]/,
82
- name: 'vendors.async',
83
- chunks: 'async',
84
- priority: 9,
85
- reuseExistingChunk: true,
86
- minSize: 10000 // use smaller minSize to avoid too much potential bundle bloat due to module duplication.
55
+ enforce: true // causes maxInitialRequests to be ignored, minSize still respected if specified in cacheGroup
56
+ // minSize: 30000 // use the default minSize
87
57
 
88
58
  },
89
59
  react: {
90
- automaticNamePrefix: 'react',
91
- test: /[\\/]node_modules[\\/]((react).*)[\\/]/,
92
- priority: -10
93
- },
94
- commonsAsync: {
95
- // commons async chunk, remaining asynchronously used modules as single chunk file
96
- name: 'commons.async',
97
- minChunks: 2,
98
- // Minimum number of chunks that must share a module before splitting
99
- chunks: 'async',
100
- priority: -10,
101
- reuseExistingChunk: true,
102
- //minSize: 10000 // use smaller minSize to avoid too much potential bundle bloat due to module duplication.
103
- minSize: 5000
104
- },
105
- zohocharts: {
60
+ name: 'react.vendor',
61
+ test: isReact,
106
62
  chunks: 'all',
107
63
  minChunks: 1,
108
- test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
109
- priority: 30,
110
- enforce: true
64
+ priority: 10
111
65
  }
112
66
  };
113
67
  let customChunksConfig = {};
114
- customChunks.map(({
68
+ customChunks.map((obj, index) => ({
69
+ name: obj.name,
70
+ pattern: obj.pattern,
71
+ minChunks: obj.minChunks || obj.size || 2,
72
+ rules: obj.rules,
73
+ chunks: obj.chunks || 'all',
74
+ priority: obj.priority || -10 * (index + 2),
75
+ enforce: obj.enforce || true,
76
+ maxSize: obj.maxSize || 0,
77
+ minSize: obj.minSize || 20000,
78
+ includeDepenency: obj.includeDepenency || false
79
+ })).map(({
115
80
  name,
116
81
  pattern,
117
- size = 2
118
- }, index) => customChunksConfig[name] = {
82
+ minChunks,
83
+ rules,
84
+ priority,
85
+ chunks = 'all',
86
+ enforce,
87
+ minSize,
88
+ maxSize,
89
+ includeDepenency
90
+ }) => customChunksConfig[name] = {
119
91
  name,
120
- test: new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
121
- chunks: 'all',
122
- enforce: true,
123
- minChunks: size,
124
- priority: -10 * (index + 2)
92
+ test: rules ? m => {
93
+ const {
94
+ userRequest
95
+ } = m;
96
+ return (0, _testPattern.testPattern)(userRequest, rules); // return (
97
+ // pkgs.some(p => isRelated(userRequest, p)) ||
98
+ // (includeDepenency && isDependency(m, pkgs))
99
+ // );
100
+ } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
101
+ chunks,
102
+ enforce,
103
+ minSize,
104
+ maxSize,
105
+ minChunks,
106
+ priority
125
107
  });
126
108
  var _default = {
109
+ minSize: 12000,
127
110
  cacheGroups: Object.assign({
128
111
  default: false,
129
112
  vendors: false
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = _interopRequireDefault(require("os"));
11
+
12
+ var _utils = require("../utils");
13
+
14
+ var _testPattern = require("./testPattern");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ let isWindows = _os.default.platform().toLowerCase() === 'win32';
19
+ let ps = _path.default.sep;
20
+ let options = (0, _utils.getOptions)();
21
+ let {
22
+ app: {
23
+ vendorExclude,
24
+ customChunks,
25
+ vendorInclude
26
+ }
27
+ } = options;
28
+
29
+ let isVendor = function isVendor(module) {
30
+ let {
31
+ userRequest
32
+ } = module;
33
+ let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
34
+ excludeList = [...excludeList, ...vendorExclude];
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));
36
+ };
37
+
38
+ let isReact = module => {
39
+ let {
40
+ userRequest
41
+ } = module;
42
+ let reactBundle = ['react', 'react-dom'];
43
+ return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
44
+ };
45
+
46
+ let defaultChunks = {
47
+ 'react.vendor': {
48
+ name: 'react.vendor',
49
+ chunks: 'all',
50
+ minChunks: 1,
51
+ test: isReact,
52
+ priority: -10
53
+ },
54
+ vendor: {
55
+ name: 'vendor',
56
+ chunks: 'initial',
57
+ minChunks: 1,
58
+ test: isVendor,
59
+ priority: -10
60
+ }
61
+ };
62
+ let customChunksConfig = {};
63
+ customChunks.map(({
64
+ name,
65
+ pattern,
66
+ size = 2,
67
+ rules,
68
+ chunks = 'all',
69
+ includeDepenency
70
+ }, index) => customChunksConfig[name] = {
71
+ name,
72
+ test: rules ? m => {
73
+ let {
74
+ userRequest
75
+ } = m;
76
+ let pkgs = rules;
77
+
78
+ if (!Array.isArray(rules)) {
79
+ pkgs = [rules];
80
+ }
81
+
82
+ return pkgs.some(p => (0, _testPattern.isRelated)(userRequest, p)) || includeDepenency && (0, _testPattern.isDependency)(m, pkgs);
83
+ } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
84
+ chunks,
85
+ enforce: true,
86
+ minChunks: size,
87
+ priority: -10 * (index + 2)
88
+ });
89
+ var _default = {
90
+ cacheGroups: Object.assign({
91
+ default: false,
92
+ vendors: false
93
+ }, defaultChunks, customChunksConfig)
94
+ };
95
+ exports.default = _default;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = _interopRequireDefault(require("os"));
11
+
12
+ var _utils = require("../utils");
13
+
14
+ var _testPattern = require("./testPattern");
15
+
16
+ var _criteriaHandler = require("./criteriaHandler");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const isWindows = _os.default.platform().toLowerCase() === 'win32';
21
+ const ps = _path.default.sep;
22
+ const options = (0, _utils.getOptions)();
23
+ const {
24
+ app: {
25
+ vendorExclude,
26
+ customChunks,
27
+ vendorInclude
28
+ }
29
+ } = options;
30
+
31
+ const canExclude = (m, excludeList) => {
32
+ let {
33
+ userRequest
34
+ } = m;
35
+ (0, _criteriaHandler.criteriaHandler)();
36
+ return (// if node_modules not in path then it is obviously not vendor
37
+ userRequest.indexOf('node_modules') === -1 || // for css currnetly we use style so it is not vendor
38
+ userRequest.endsWith('.css') || //I don't know what it is but not vendor (due to previous code)
39
+ userRequest.endsWith('publicPathConfig.js') || // this list given by user, So we need to exclude them
40
+ excludeList.some(item => (0, _testPattern.isRelatedPackage)(userRequest, item)) || // this is for exclude dependency module by excluded user
41
+ (0, _testPattern.isDependency)(m, excludeList)
42
+ );
43
+ };
44
+
45
+ let isVendor = function isVendor(module) {
46
+ let {
47
+ userRequest
48
+ } = module;
49
+ let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
50
+ excludeList = [...excludeList, ...vendorExclude];
51
+ return userRequest && (vendorInclude.some(item => userRequest.indexOf(item) !== -1) || // (userRequest.indexOf('node_modules') >= 0 &&
52
+ // userRequest.endsWith('.css') === false &&
53
+ // userRequest.endsWith('publicPathConfig.js') === false &&
54
+ // excludeList.every(
55
+ // item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1
56
+ // )))
57
+ !canExclude(module, excludeList));
58
+ };
59
+
60
+ let isReact = module => {
61
+ let {
62
+ userRequest
63
+ } = module;
64
+ let reactBundle = ['react', 'react-dom'];
65
+ return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
66
+ };
67
+
68
+ let defaultChunks = {
69
+ 'react.vendor': {
70
+ name: 'react.vendor',
71
+ chunks: 'all',
72
+ minChunks: 1,
73
+ test: isReact,
74
+ priority: -10
75
+ },
76
+ vendor: {
77
+ name: 'vendor',
78
+ chunks: 'all',
79
+ minChunks: 1,
80
+ test: isVendor,
81
+ priority: -10
82
+ }
83
+ };
84
+ let customChunksConfig = {};
85
+ console.log(customChunks, 'hi');
86
+ customChunks.map(({
87
+ name,
88
+ pattern,
89
+ size = 2,
90
+ rules,
91
+ chunks = 'all',
92
+ includeDepenency
93
+ }, index) => customChunksConfig[name] = {
94
+ name,
95
+ test: rules ? m => {
96
+ let {
97
+ userRequest
98
+ } = m;
99
+ let pkgs = rules;
100
+
101
+ if (!Array.isArray(rules)) {
102
+ pkgs = [rules];
103
+ }
104
+
105
+ return pkgs.some(p => (0, _testPattern.isRelated)(userRequest, p)) || includeDepenency && (0, _testPattern.isDependency)(m, pkgs);
106
+ } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
107
+ chunks,
108
+ enforce: true,
109
+ minChunks: size,
110
+ priority: -10 * (index + 2)
111
+ });
112
+ var _default = {
113
+ cacheGroups: Object.assign({
114
+ default: false,
115
+ vendors: false
116
+ }, defaultChunks, customChunksConfig)
117
+ }; // supportapp / src / analytics / utils / dashboards / chartUI.js;
118
+ // supportapp / src / modules / analytics / utils / chartTheme.js;
119
+ // a = [
120
+ // 'supportapp/src/analytics/utils/dashboards/chartUI.js',
121
+ // 'supportapp/src/components/analytics/dashboarddetail/Chart/Chart.js',
122
+ // 'supportapp/src/modules/analytics/utils/chartTheme.js',
123
+ // 'supportapp/src/modules/analytics/utils/ChartUI.js',
124
+ // 'supportapp/src/components/zia/zianotifications/ZiaNotificationDashBoard/ZiaNotificationChart.js',
125
+ // 'supportapp/src/components/analytics/dashboarddetail/SegmentAudience/DayoftheWeek/DayoftheWeek.js',
126
+ // 'supportapp/src/components/analytics/dashboarddetail/SegmentAudience/HouroftheDay/HouroftheDay.js'
127
+ // ];
128
+
129
+ exports.default = _default;
@@ -0,0 +1,71 @@
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 _express = require("express");
11
+
12
+ var _path = require("path");
13
+
14
+ // in our development we only use windows, mac and linux
15
+ const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
16
+
17
+ function _testPattern(req, pattern) {
18
+ let modifyedPattern = pattern;
19
+
20
+ if (/[*.$^]/.test(modifyedPattern)) {
21
+ if (isWindows) {
22
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
23
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
24
+ }
25
+
26
+ modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
27
+ const re = new RegExp(modifyedPattern);
28
+ return re.test(req);
29
+ }
30
+
31
+ if (isWindows) {
32
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
33
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\');
34
+ }
35
+
36
+ return req.indexOf(modifyedPattern) !== -1;
37
+ }
38
+
39
+ function testPattern(req, pattern) {
40
+ if (!req || !pattern) {
41
+ return false;
42
+ }
43
+
44
+ if (Array.isArray(pattern)) {
45
+ // eslint-disable-next-line no-unused-vars
46
+ return pattern.every(p => testPattern(req, p));
47
+ }
48
+
49
+ if (pattern[0] === '!') {
50
+ return !_testPattern(req, pattern.slice(1));
51
+ }
52
+
53
+ return _testPattern(req, pattern);
54
+ }
55
+
56
+ const isRelated = (req, item) => req && req.indexOf(item) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
57
+
58
+
59
+ exports.isRelated = isRelated;
60
+
61
+ const isRelatedPackage = (req, item) => isRelated(req, `node_modules${_path.sep}${item}${_path.sep}`) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
62
+
63
+
64
+ exports.isRelatedPackage = isRelatedPackage;
65
+
66
+ function isDependency(m, excludeList) {
67
+ // let reasons = m.reasons.map(r => r.module.userRequest);
68
+ // m.reasons.some(r => !r.module || !r.module.userRequest) && console.log(m.reasons);
69
+ return m.reasons.some(r => excludeList.some(item => r.module && isRelated(r.module.userRequest, item)));
70
+ } // export function queryHandler(conditions, pattern) {
71
+ // }
@@ -95,7 +95,7 @@ module.exports = {
95
95
  children: false,
96
96
  colors: true,
97
97
  // excludeAssets: /i18n/,
98
- // excludeAssets: /./,
98
+ excludeAssets: /./,
99
99
  warningsFilter: /\[mini-css-extract-plugin\]/
100
100
  },
101
101
  plugins: (0, _pluginUtils.getProdPlugins)(options, output.publicPath),
package/npm8.md ADDED
@@ -0,0 +1,9 @@
1
+ # npm 8 change related things
2
+
3
+ 1. in npm run script config options `:` not working (properly|correctly), So we need to use `_` in the place of `:`
4
+ For Example:
5
+ - `--app:port` wouldn't work we have to do like this `--app_port`
6
+ - `--clone:proj:name` wouldn't work we have to do like this `----clone_proj_name`
7
+
8
+ @zohodes/react-cli or fz-react-cli regardless of what cli you use.
9
+ So, we need to change all package.json script which is using this (`:`) we need to change as (`_`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-exp.162.3",
3
+ "version": "0.0.1-exp.164.1",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -100,7 +100,7 @@
100
100
  "react-redux": "7.2.1",
101
101
  "react-router": "5.2.0",
102
102
  "react-router-redux": "4.0.8",
103
- "react-test-renderer": "18.0.0-rc.0",
103
+ "react-test-renderer": "16.13.1",
104
104
  "react-transition-group": "2.7.1",
105
105
  "redis": "3.0.2",
106
106
  "redux": "4.0.5",