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

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,22 +2,9 @@
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
4
 
5
- # 0.0.1-exp.164.1
5
+ # 0.0.1-exp.164.2
6
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
7
+ - `devbuild` option add to react cli
21
8
 
22
9
  # 0.0.1-beta.164
23
10
 
package/bin/cli.js CHANGED
@@ -61,6 +61,7 @@ if (preprocesserPath && existsSync(preprocesserPath)) {
61
61
  // Because when node server stops this program willbe closed So this nodemon will be killed as well
62
62
  break;
63
63
  case 'nowatchstart':
64
+ case 'devbuild':
64
65
  case 'build:library:es':
65
66
  case 'build:component:es':
66
67
  case 'build:library:cmjs':
@@ -207,6 +208,17 @@ switch (option) {
207
208
  process.exit(result.status);
208
209
  break;
209
210
 
211
+ case 'devbuild':
212
+ result = spawnSync(
213
+ 'node',
214
+ [
215
+ require.resolve('../lib/servers/devBuild')
216
+ ].concat(args),
217
+ // [require.resolve('../lib/servers/staticServer'), '--expose-http2'].concat(args),
218
+ { stdio: 'inherit' }
219
+ );
220
+ process.exit(result.status);
221
+ break;
210
222
  case 'nowatchstart':
211
223
  result = spawnSync(
212
224
  'node',
@@ -264,7 +276,7 @@ switch (option) {
264
276
  // '--progress',
265
277
  // '--profile',
266
278
  '--config',
267
- require.resolve('../lib/configs/webpack.prod.config.js'),
279
+ require.resolve('../lib/configs/webpack.prod.config.js')
268
280
  ].concat(args),
269
281
  { stdio: 'inherit' }
270
282
  );
@@ -7,11 +7,9 @@ exports.default = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
10
- var _os = _interopRequireDefault(require("os"));
11
-
12
10
  var _utils = require("../utils");
13
11
 
14
- var _testPattern = require("./testPattern");
12
+ var _os = _interopRequireDefault(require("os"));
15
13
 
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
@@ -44,69 +42,35 @@ let isReact = module => {
44
42
  };
45
43
 
46
44
  let defaultChunks = {
47
- vendors: {
48
- // picks up everything from node_modules as long as the sum of node modules is larger than minSize
49
- //test: /[\\/]node_modules[\\/]((?!react).*)[\\/]/,
50
- test: isVendor,
51
- chunks: 'initial',
52
- // chunks: 'all',
53
- name: 'vendors',
54
- priority: 19,
55
- enforce: true // causes maxInitialRequests to be ignored, minSize still respected if specified in cacheGroup
56
- // minSize: 30000 // use the default minSize
57
-
58
- },
59
- react: {
45
+ 'react.vendor': {
60
46
  name: 'react.vendor',
47
+ chunks: 'all',
48
+ minChunks: 1,
61
49
  test: isReact,
50
+ priority: -10
51
+ },
52
+ vendor: {
53
+ name: 'vendor',
62
54
  chunks: 'all',
63
55
  minChunks: 1,
64
- priority: 10
56
+ test: isVendor,
57
+ priority: -10
65
58
  }
66
59
  };
67
60
  let customChunksConfig = {};
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(({
61
+ customChunks.map(({
80
62
  name,
81
63
  pattern,
82
- minChunks,
83
- rules,
84
- priority,
85
- chunks = 'all',
86
- enforce,
87
- minSize,
88
- maxSize,
89
- includeDepenency
90
- }) => customChunksConfig[name] = {
64
+ size = 2
65
+ }, index) => customChunksConfig[name] = {
91
66
  name,
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
67
+ test: new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
68
+ chunks: 'all',
69
+ enforce: true,
70
+ minChunks: size,
71
+ priority: -10 * (index + 2)
107
72
  });
108
73
  var _default = {
109
- minSize: 12000,
110
74
  cacheGroups: Object.assign({
111
75
  default: false,
112
76
  vendors: false
@@ -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),
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPaths = getPaths;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _child_process = require("child_process");
13
+
14
+ var _utils = require("../utils");
15
+
16
+ var _getCliPath = require("./getCliPath");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
21
+
22
+ const {
23
+ app: {
24
+ outputFolder
25
+ }
26
+ } = options;
27
+ const {
28
+ cssSelectorZipPath
29
+ } = options.impactService;
30
+ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
31
+
32
+ const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
33
+
34
+ function execSyncDefalut(command) {
35
+ console.log(' command running ==>', command);
36
+ return (0, _child_process.execSync)(command, {
37
+ stdio: 'inherit'
38
+ });
39
+ }
40
+
41
+ const isQuiet = 'q';
42
+ const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
43
+
44
+ if (_fs.default.existsSync(outputFolderLocation)) {
45
+ execSyncDefalut(`rm -rf ${outputFolder}`);
46
+ console.log(`previous ${outputFolder} removed`);
47
+ }
48
+
49
+ if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
50
+ execSyncDefalut('rm build.zip');
51
+ console.log('previous build.zip removed');
52
+ } // execSyncDefalut(`${webpack } --version`);
53
+ // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
54
+
55
+
56
+ console.log('webpack compilation starts...');
57
+ const startTime = Date.now(); // const result = spawnSync(
58
+ // webpack,
59
+ // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
60
+ // args
61
+ // ),
62
+ // { stdio: 'inherit' }
63
+ // );
64
+
65
+ const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
66
+ result && console.log(result);
67
+
68
+ if (result && result.stderr) {
69
+ throw result.stderr;
70
+ }
71
+
72
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
73
+
74
+ if (zipname) {
75
+ execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
76
+ console.log('build.zip file created');
77
+ const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
78
+ execSyncDefalut(`rm -rf ${zipname}`);
79
+
80
+ if (result && result.stderr) {
81
+ console.log('zip file not created', cssSelectorZipPath);
82
+ console.error(result.stderr);
83
+ } else {
84
+ console.log('zip file created', cssSelectorZipPath);
85
+ }
86
+ } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
87
+ // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
88
+
89
+
90
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
91
+
92
+ function getPaths() {
93
+ return {
94
+ zipname,
95
+ cssSelectorZipPath,
96
+ outputFolderLocation
97
+ };
98
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCliPath = getCliPath;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = require("os");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ let appPath = process.cwd();
15
+ const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
16
+ let isWindows = (0, _os.platform)().toLowerCase() === 'win32';
17
+
18
+ const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
19
+
20
+ const suffixExt = isWindows ? '.cmd' : '';
21
+
22
+ function getCliPath(libName) {
23
+ return _getCliPath(libName) + suffixExt;
24
+ }
@@ -1,25 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _fs = _interopRequireDefault(require("fs"));
4
-
5
3
  var _path = _interopRequireDefault(require("path"));
6
4
 
7
5
  var _https = _interopRequireDefault(require("https"));
8
6
 
9
- var _os = require("os");
10
-
11
7
  var _express = _interopRequireDefault(require("express"));
12
8
 
13
9
  var _ws = _interopRequireDefault(require("ws"));
14
10
 
15
- var _child_process = require("child_process");
16
-
17
11
  var _httpProxyMiddleware = require("http-proxy-middleware");
18
12
 
19
13
  var _utils = require("../utils");
20
14
 
21
15
  var _httpsOptions = require("./httpsOptions");
22
16
 
17
+ var _devBulid = require("./devBulid");
18
+
23
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
20
 
25
21
  // import webpack from 'webpack';
@@ -28,95 +24,25 @@ let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
28
24
  let {
29
25
  app: {
30
26
  context,
31
- server,
32
- outputFolder
27
+ server
33
28
  }
34
29
  } = options;
35
30
  let {
36
31
  host,
37
32
  port,
38
33
  domain,
39
- mode,
40
34
  disableContextURL,
41
35
  hasMock,
42
36
  mockPort
43
37
  } = server;
44
- let isCompatableHttp2 = Number(process.version.substr(1).split('.')[0]) >= 8;
38
+ let isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
45
39
  let contextURL = disableContextURL ? '' : `/${context}`;
46
40
  let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
47
41
  const {
48
- cssSelectorZipPath
49
- } = options.impactService;
50
- const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
51
-
52
- let outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
53
-
54
- function execSyncDefalut(command) {
55
- console.log(' command running ==>', command);
56
- return (0, _child_process.execSync)(command, {
57
- stdio: 'inherit'
58
- });
59
- }
60
-
61
- let appPath = process.cwd();
62
- const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
63
- const isQuiet = 'q';
64
- let isWindows = (0, _os.platform)().toLowerCase() === 'win32';
65
-
66
- const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
67
-
68
- const suffixExt = isWindows ? '.cmd' : '';
69
-
70
- function getCliPath(libName) {
71
- return _getCliPath(libName) + suffixExt;
72
- }
73
-
74
- let webpack = getCliPath('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
75
-
76
- if (_fs.default.existsSync(outputFolderLocation)) {
77
- execSyncDefalut(`rm -rf ${outputFolder}`);
78
- console.log(`previous ${outputFolder} removed`);
79
- }
80
-
81
- if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
82
- execSyncDefalut('rm build.zip');
83
- console.log('previous build.zip removed');
84
- } // execSyncDefalut(`${webpack } --version`);
85
- // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
86
-
87
-
88
- console.log('webpack compilation starts...');
89
- let startTime = Date.now(); // let result = spawnSync(
90
- // webpack,
91
- // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
92
- // args
93
- // ),
94
- // { stdio: 'inherit' }
95
- // );
96
-
97
- let result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
98
- result && console.log(result);
99
-
100
- if (result && result.stderr) {
101
- throw result.stderr;
102
- }
103
-
104
- console.log(`compailation done in ${Date.now() - startTime}ms`);
105
-
106
- if (zipname) {
107
- execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
108
- console.log('build.zip file created');
109
- let result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
110
- execSyncDefalut(`rm -rf ${zipname}`);
111
-
112
- if (result && result.stderr) {
113
- console.log('zip file not created', cssSelectorZipPath);
114
- console.error(result.stderr);
115
- } else {
116
- console.log('zip file created', cssSelectorZipPath);
117
- }
118
- }
119
-
42
+ zipname,
43
+ cssSelectorZipPath,
44
+ outputFolderLocation
45
+ } = (0, _devBulid.getPaths)();
120
46
  const app = (0, _express.default)();
121
47
 
122
48
  if (hasMock) {
@@ -271,5 +197,4 @@ app.listen(httpPort, err => {
271
197
  domain,
272
198
  port: httpPort
273
199
  }, 'ht' + 'tp')}${contextURL}/`);
274
- });
275
- console.log(`compailation done in ${Date.now() - startTime}ms`);
200
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-exp.164.1",
3
+ "version": "0.0.1-exp.164.2",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -1,91 +0,0 @@
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
- }
@@ -1,95 +0,0 @@
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;
@@ -1,129 +0,0 @@
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;
@@ -1,71 +0,0 @@
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
- // }
package/npm8.md DELETED
@@ -1,9 +0,0 @@
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 (`_`)