@zohodesk/react-cli 1.1.5-exp.5 → 1.1.6-exp.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -44,15 +44,26 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
- # 1.1.5-exp.5
48
- - fixed the issues regarding custom chunks base config schema.
47
+ # 1.1.6
49
48
 
50
- # 1.1.5-exp.4
51
- - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
49
+ **Issue Fix**
50
+
51
+ - local install react-cli spawnSync Error fix in npm 8
52
+ - babel version update issue fix (Cannot read properties of undefined (reading 'file')) and (BABEL_TRANSFORM_ERROR)
53
+
54
+ # 1.1.6-exp.1
55
+
56
+ **New Feature**
57
+
58
+ - Typescript support
59
+
60
+ # 1.1.5-exp.2
61
+
62
+ **Issue Fix**
63
+
64
+ - local install react-cli spawnSync Error fix in npm 8
52
65
 
53
- # 1.1.5-exp.3
54
- - added options to split chunks base config
55
- - added support for passing custom chunks split logic as function.
66
+ # 1.1.5
56
67
 
57
68
  **Issue Fix**
58
69
 
@@ -61,10 +72,17 @@ Now to run app
61
72
  # 1.1.4
62
73
 
63
74
  **Issue Fix**
75
+
64
76
  - global install react-cli spawnSync Error fix
65
77
  - `0px` variable value conversion issue fixed
66
78
  - pattern exclude for postcss plugins case fixed
67
79
 
80
+ # 1.1.3
81
+
82
+ **Issue Fix**
83
+
84
+ - local install react-cli spawnSync Error fix
85
+
68
86
  # 1.1.2
69
87
 
70
88
  **Issue Fix**
@@ -74,54 +92,63 @@ Now to run app
74
92
  # 1.1.1
75
93
 
76
94
  **Issue Fix**
95
+
77
96
  - docs component name incorrect in windows, when using --enableReactLive issue fixed.
78
97
 
79
- **Feature Update**
98
+ **Feature Update**
99
+
80
100
  - Support for desk-library to use Selector Replace plugin using individual script. To use `react-cli selectorReplacer [source] [target]`
81
101
 
82
102
  # 1.1.0
83
103
 
84
104
  **Feature Update**
105
+
85
106
  - Support for desk-library to use variable convertion plugin using individual script. To use `react-cli variableConverter [source] [target]`
86
107
  - pattern filter changes, new filter system instead of exclude to include or exclude files for plugins.
87
- For more info please refer to :
88
- [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/patternFiltering.md)
108
+ For more info please refer to :
109
+ [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/patternFiltering.md)
89
110
  - React Live feature implemented for Docs.
90
- [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/ReactLive.md)
111
+ [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/ReactLive.md)
91
112
 
92
113
  # 1.0.3-beta.1
93
114
 
94
115
  **Issue Fix**
95
- - nock api not working issue fixed. This error throwing in @zohodesk/react-cli@1.0.2 version. but working in older versions ( 0.0.1-beta.178 )
96
116
 
117
+ - nock api not working issue fixed. This error throwing in @zohodesk/react-cli@1.0.2 version. but working in older versions ( 0.0.1-beta.178 )
97
118
 
98
119
  # 1.0.3
99
120
 
100
121
  **Feature Update**
122
+
101
123
  - Support for global httpsCerts usage
102
124
  - Support for global client_packages_group usage
103
- - custom attribute for dynamically loading chunks, In this version we merged changes from [0.0.1-beta.167.1](#0.0.1-beta.167.1).
104
- **Package Update**
105
- - @zohodesk/client_packages_group@**1.0.1** ==> @zohodesk/client_packages_group@**1.0.2**
106
-
107
-
125
+ - custom attribute for dynamically loading chunks, In this version we merged changes from [0.0.1-beta.167.1](#0.0.1-beta.167.1).
126
+ **Package Update**
127
+ - @zohodesk/client_packages_group@**1.0.1** ==> @zohodesk/client_packages_group@**1.0.2**
108
128
 
109
129
  # 1.0.2
110
130
 
111
131
  **Feature Update**
132
+
112
133
  - Selector replace plugin made as a custom postcss-plugin with update to code that was unpublished in package.
113
134
 
114
135
  # 1.0.1
115
136
 
116
137
  **Issue Fix**
138
+
117
139
  - variable conversion for px and var(--) values in same declaration was not supported, now it is supported.
118
140
  - package-lock.json removed from `.npmignore`
119
141
 
120
142
  **Feature Update**
143
+
121
144
  - exclude added to Selector Plugin
145
+
122
146
  # 1.0.0
147
+
123
148
  ## Major Release
149
+
124
150
  **Changes:**
151
+
125
152
  - File support added for `.webp` for `docs`, `dev` and `prod` mode
126
153
  - File support added for `.webm` for `docs`, `dev` and `prod` mode
127
154
 
@@ -129,12 +156,11 @@ For more info please refer to :
129
156
 
130
157
  - We have remove ssl certificate for security reasons.
131
158
  So default https server won't run.
132
- In order to make it work as before you need to specify two things
159
+ In order to make it work as before you need to specify two things
133
160
  1. install `@zohodesk-private/client_dev_cert`
134
- 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
135
- unless configaration are proper this may break `start` , `docs` , `nowatchstart`. and mock wms `/wmsmockapi` won't work.
136
- So Please be carefull when you update this version or above without proper configaration.
137
-
161
+ 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
162
+ unless configaration are proper this may break `start` , `docs` , `nowatchstart`. and mock wms `/wmsmockapi` won't work.
163
+ So Please be carefull when you update this version or above without proper configaration.
138
164
 
139
165
  # 0.0.1-beta.178
140
166
 
@@ -147,11 +173,11 @@ For more info please refer to :
147
173
 
148
174
  - We have remove ssl certificate for security reasons.
149
175
  So default https server won't run.
150
- In order to make it work as before you need to specify two things
176
+ In order to make it work as before you need to specify two things
151
177
  1. install `@zohodesk-private/client_dev_cert`
152
- 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
153
- unless configaration are proper this may break `start` , `docs` , `nowatchstart`.
154
- So Please be carefull when you update this version or above without proper configaration.
178
+ 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
179
+ unless configaration are proper this may break `start` , `docs` , `nowatchstart`.
180
+ So Please be carefull when you update this version or above without proper configaration.
155
181
 
156
182
  # 0.0.1-exp.178.2
157
183
 
@@ -165,11 +191,11 @@ For more info please refer to :
165
191
 
166
192
  - We have remove ssl certificate for security reasons.
167
193
  So default https server won't run.
168
- In order to make it work as before you need to specify two things
194
+ In order to make it work as before you need to specify two things
169
195
  1. install `@zohodesk-private/client_dev_cert`
170
- 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
171
- unless configaration are proper this may break `start` , `docs` , `nowatchstart`.
172
- So Please be carefull when you update this version or above without proper configaration.
196
+ 2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
197
+ unless configaration are proper this may break `start` , `docs` , `nowatchstart`.
198
+ So Please be carefull when you update this version or above without proper configaration.
173
199
 
174
200
  # 0.0.1-beta.177
175
201
 
@@ -327,8 +353,9 @@ Features:-
327
353
  - In docs we have added `Description` for Component Props- check out it in `PropTypes` tab
328
354
 
329
355
  # 0.0.1-beta.167.1
356
+
330
357
  In this version we merged changes from [0.0.1-betaa.138.1](#0.0.1-betaa.138.1).
331
- and with [0.0.1-beta.167](#0.0.1-beta.167) version changes.
358
+ and with [0.0.1-beta.167](#0.0.1-beta.167) version changes.
332
359
 
333
360
  # 0.0.1-beta.167
334
361
 
@@ -592,6 +619,7 @@ impact servise related changes:-
592
619
  - few enhancements
593
620
 
594
621
  # 0.0.1-betaa.138.1
622
+
595
623
  - new feature added for custom extra attribute for dynamically added tags by webpack.
596
624
  - To enable this feature you need to enable "react-cli" => "app" => "customAttributes" => "enable"
597
625
  - For more [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/9eea8df14e55584b2114b5e484ca8b751a4ba191/src/plugins/CustomAttributePlugin.md)
@@ -4,17 +4,17 @@ In react-cli we provide options to create custom chunks.
4
4
  This Custom Chunk Option is array of Object
5
5
  that Object keys are
6
6
 
7
- - `pattern` **{ String | Function }** regex pattern as string and custom logic to split chunks can be defined using function
8
- - `name` **{ String }** chunk name
9
- - `size` **{ Number }** is count which is minimum chunk duplicated or need in chunks
7
+ - `pattern` regex pattern as string
8
+ - `name` chunk name
9
+ - `size` is count which is minmum chunk dublicated or need in chunks
10
10
 
11
11
  > Since 0.0.1-exp.164.1
12
12
 
13
13
  extra features in custom chunks :-
14
14
  for more details [SplitChunkPlugin](https://webpack.js.org/plugins/split-chunks-plugin/) webpack
15
15
 
16
- - `minChunks`: `minChunks` is alias of `size` default value is `2`,
17
- - `rules`: `rules` is same as `pattern` with some easy hooks **(removed after v1.1.5)**
16
+ - `minChunks`: `minChunks` is alies of `size` default value is `2`,
17
+ - `rules`: `rules` is same as `pattern` with some easy hooks
18
18
  - use `/` for both windows and linux we will replace internally
19
19
  - for `.*` we need to use `*`
20
20
  - we can consider rules as regex when the `rules-string` has any of these `*`, `^`, `$`. So if you want regex then kindly use `*` in your `rules-string` for force regex
@@ -23,4 +23,4 @@ for more details [SplitChunkPlugin](https://webpack.js.org/plugins/split-chunks-
23
23
  - `enforce`: enforce default value is true,
24
24
  - `maxSize`: maxSize, default value is 0,
25
25
  - `minSize`: minSize, default value is 20000,
26
- includeDependency: includeDependency default value is false
26
+ includeDepenency: includeDepenency default value is false
@@ -15,53 +15,35 @@ var _testPattern = require("./testPattern");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const isWindows = _os.default.platform().toLowerCase() === 'win32';
19
- const ps = _path.default.sep;
20
- const options = (0, _utils.getOptions)();
21
- const {
18
+ let isWindows = _os.default.platform().toLowerCase() === 'win32';
19
+ let ps = _path.default.sep;
20
+ let options = (0, _utils.getOptions)();
21
+ let {
22
22
  app: {
23
23
  vendorExclude,
24
24
  customChunks,
25
- vendorInclude,
26
- customChunksBaseConfig
25
+ vendorInclude
27
26
  }
28
27
  } = options;
29
- const reactBundle = ['react', 'react-dom', 'react-redux', 'react-transition-group', 'scheduler', 'prop-types'];
30
28
 
31
- const isVendor = function isVendor(module) {
32
- const {
29
+ let isVendor = function isVendor(module) {
30
+ let {
33
31
  userRequest
34
32
  } = module;
35
- let excludeList = ['script-loader', 'raw-loader', ...reactBundle];
33
+ let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
36
34
  excludeList = [...excludeList, ...vendorExclude];
37
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));
38
36
  };
39
37
 
40
- const isReact = module => {
41
- const {
38
+ let isReact = module => {
39
+ let {
42
40
  userRequest
43
41
  } = module;
42
+ let reactBundle = ['react', 'react-dom'];
44
43
  return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
45
44
  };
46
45
 
47
- function rulesMatcher(pattern) {
48
- if (typeof pattern === 'function') {
49
- return pattern;
50
- }
51
-
52
- if (Array.isArray(pattern)) {
53
- return ({
54
- userRequest
55
- }) => (0, _testPattern.testPattern)(userRequest, pattern);
56
- }
57
-
58
- return new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern);
59
- }
60
-
61
- const baseSplitChunkConfig = Object.assign({
62
- minSize: 15000
63
- }, customChunksBaseConfig);
64
- const specificCacheGroupConfig = {
46
+ let defaultChunks = {
65
47
  'react.vendor': {
66
48
  name: 'react.vendor',
67
49
  chunks: 'all',
@@ -81,36 +63,43 @@ const specificCacheGroupConfig = {
81
63
  priority: -10
82
64
  }
83
65
  };
84
- const customChunksConfig = {};
66
+ let customChunksConfig = {};
85
67
  customChunks.map((obj, index) => ({
86
68
  name: obj.name,
87
- chunks: obj.chunks || 'all',
88
- minChunks: obj.minChunks || obj.size || 2,
89
69
  pattern: obj.pattern,
70
+ minChunks: obj.minChunks || obj.size || 2,
71
+ rules: obj.rules,
72
+ // includeDepenency: obj.includeDepenency || false,
90
73
  priority: obj.priority || -10 * (index + 2),
91
74
  enforce: obj.enforce || true,
92
- minSize: obj.minSize,
93
- // || 20000,
94
75
  maxSize: obj.maxSize,
95
76
  // || 0,
96
- reuseExistingChunk: obj.reuseExistingChunk || false,
97
- automaticNamePrefix: obj.automaticNamePrefix || null,
98
- cacheGroupName: obj.cacheGroupName || obj.name
99
- })).forEach(({
77
+ minSize: obj.minSize,
78
+ // || 20000,
79
+ chunks: obj.chunks || 'all'
80
+ })).map(({
100
81
  name,
101
- chunks = 'all',
102
- minChunks,
103
82
  pattern,
83
+ minChunks,
84
+ rules,
104
85
  priority,
86
+ // includeDepenency,
105
87
  enforce,
106
88
  minSize,
107
89
  maxSize,
108
- reuseExistingChunk,
109
- automaticNamePrefix,
110
- cacheGroupName
90
+ chunks = 'all'
111
91
  }) => {
112
- const obj = {
113
- test: rulesMatcher(pattern),
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),
114
103
  chunks,
115
104
  enforce,
116
105
  minChunks,
@@ -125,25 +114,13 @@ customChunks.map((obj, index) => ({
125
114
  obj.maxSize = maxSize;
126
115
  }
127
116
 
128
- if (name !== undefined) {
129
- obj.name = name;
130
- }
131
-
132
- if (reuseExistingChunk !== undefined) {
133
- obj.reuseExistingChunk = reuseExistingChunk;
134
- }
135
-
136
- if (automaticNamePrefix) {
137
- obj.automaticNamePrefix = automaticNamePrefix;
138
- }
139
-
140
- customChunksConfig[cacheGroupName] = obj;
117
+ return customChunksConfig[name] = obj;
141
118
  });
142
- const splitChunkConfig = Object.assign({}, baseSplitChunkConfig, {
119
+ var _default = {
120
+ minSize: 12000,
143
121
  cacheGroups: Object.assign({
144
122
  default: false,
145
123
  vendors: false
146
- }, specificCacheGroupConfig, customChunksConfig)
147
- });
148
- var _default = splitChunkConfig;
124
+ }, defaultChunks, customChunksConfig)
125
+ };
149
126
  exports.default = _default;
@@ -13,25 +13,25 @@ var _path = require("path");
13
13
  const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
14
14
 
15
15
  function _testPattern(req, pattern) {
16
- let modifiedPattern = pattern;
16
+ let modifyedPattern = pattern;
17
17
 
18
- if (/[*.$^]/.test(modifiedPattern)) {
18
+ if (/[*.$^]/.test(modifyedPattern)) {
19
19
  if (isWindows) {
20
- // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
- modifiedPattern = modifiedPattern.replace(/\//g, '\\\\');
20
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
22
22
  }
23
23
 
24
- modifiedPattern = modifiedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
- const re = new RegExp(modifiedPattern);
24
+ modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
+ const re = new RegExp(modifyedPattern);
26
26
  return re.test(req);
27
27
  }
28
28
 
29
29
  if (isWindows) {
30
- // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
- modifiedPattern = modifiedPattern.replace(/\//g, '\\');
30
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\');
32
32
  }
33
33
 
34
- return req.indexOf(modifiedPattern) !== -1;
34
+ return req.indexOf(modifyedPattern) !== -1;
35
35
  }
36
36
 
37
37
  function testPattern(req, pattern) {
@@ -34,7 +34,8 @@ function moduleResolver(options) {
34
34
  const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
35
35
  return {
36
36
  modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
37
- alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
37
+ alias: disableES5Transpile ? _libAlias.libAlias : {},
38
+ extensions: ['.tsx', '.ts', '.js'] // alias: { ...libAlias, ...clientDependenies }
38
39
 
39
40
  };
40
41
  }
@@ -97,6 +97,10 @@ module.exports = {
97
97
 
98
98
  return false;
99
99
  }
100
+ }, {
101
+ test: /\.tsx?$/,
102
+ use: 'ts-loader',
103
+ exclude: /node_modules/
100
104
  }, seperateCssModules ? {
101
105
  test: /\.css$/,
102
106
  exclude: /\.module\.css$/,
@@ -148,6 +148,10 @@ module.exports = {
148
148
 
149
149
  return false;
150
150
  }
151
+ }, {
152
+ test: /\.tsx?$/,
153
+ use: 'ts-loader',
154
+ exclude: /node_modules/
151
155
  }, seperateCssModules ? {
152
156
  test: /\.css$/,
153
157
  exclude: /\.module\.css$/,
@@ -19,7 +19,7 @@ class ResourceHintsPlugin {
19
19
  mainTemplate.hooks.requireExtensions.tap(pluginName, (source, chunk, hash) => {
20
20
  const idNameMap = chunk.getChunkMaps().name;
21
21
  const nameIdMap = {};
22
- let needsMap = true;
22
+ let needsMap = false;
23
23
 
24
24
  for (const key in idNameMap) {
25
25
  if (Object.prototype.hasOwnProperty.call(idNameMap, key)) {
@@ -32,9 +32,7 @@ class ResourceHintsPlugin {
32
32
  }
33
33
  }
34
34
 
35
- return Template.asString([source, '', `${mainTemplate.requireFn}.getChunkIds = function getChunkIds(chunkId) {`, Template.indent((needsMap ? [`const nameToChunkIdMap = ${JSON.stringify(nameIdMap)}`, 'const chunkNames = Object.keys(nameToChunkIdMap)'] : []).concat(['return chunkNames.filter(chunkName => chunkId.test(chunkName)).map(chunkName => nameToChunkIdMap[chunkName]);'])), '}', `// Prefetch a chunk (${pluginName})`, `${mainTemplate.requireFn}.pfc = function prefetchChunk(chunkId) {`, Template.indent([`let chunkIds = ${mainTemplate.requireFn}.getChunkIds(new RegExp(chunkId, 'i'))`, `chunkIds.forEach(idOfAChunk => {
36
- ${mainTemplate.requireFn}.e(idOfAChunk);
37
- })`]), '};',
35
+ return Template.asString([source, '', `${mainTemplate.requireFn}.getChunkId = function getChunkId(chunkId) {`, Template.indent((needsMap ? [`chunkId = ${JSON.stringify(nameIdMap)}[chunkId]||chunkId;`] : []).concat(['return chunkId;'])), '}', `// Prefetch a chunk (${pluginName})`, `${mainTemplate.requireFn}.pfc = function prefetchChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkId(chunkId)`, `${mainTemplate.requireFn}.e(chunkId);`]), '};',
38
36
  /*
39
37
  (needsMap
40
38
  ? [`chunkId = ${JSON.stringify(nameIdMap)}[chunkId]||chunkId;`]
@@ -55,7 +53,7 @@ class ResourceHintsPlugin {
55
53
  ),
56
54
  '}',
57
55
  */
58
- `// Preload a chunk (${pluginName})`, `${mainTemplate.requireFn}.plc = function preloadChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkIds(new RegExp('^' + chunkId + '$'))[0]`, 'if(installedChunks[chunkId] === undefined) {', Template.indent(['installedChunks[chunkId] = null;', mainTemplate.hooks.linkPreload.call('', chunk, hash), 'document.head.appendChild(link);', `${mainTemplate.requireFn}.e(chunkId);` // 'var head = document.getElementsByTagName(\'head\')[0];',
56
+ `// Preload a chunk (${pluginName})`, `${mainTemplate.requireFn}.plc = function preloadChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkId(chunkId)`, 'if(installedChunks[chunkId] === undefined) {', Template.indent(['installedChunks[chunkId] = null;', mainTemplate.hooks.linkPreload.call('', chunk, hash), 'document.head.appendChild(link);', `${mainTemplate.requireFn}.e(chunkId);` // 'var head = document.getElementsByTagName(\'head\')[0];',
59
57
  // mainTemplate.hooks.jsonpScript.call('', chunk, hash),
60
58
  // 'head.appendChild(script);'
61
59
  ]), '}']), '};']);
@@ -333,7 +333,6 @@ var _default = {
333
333
  inject: true
334
334
  },
335
335
  removePropTypes: false,
336
- customChunksBaseConfig: null,
337
336
  customChunks: [{
338
337
  name: 'styles',
339
338
  pattern: '\\.css$'
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _child_process = require("child_process");
9
9
 
10
- var _fs = _interopRequireWildcard(require("fs"));
10
+ var _fs = _interopRequireDefault(require("fs"));
11
11
 
12
12
  var _path = _interopRequireDefault(require("path"));
13
13
 
@@ -15,10 +15,6 @@ var _schemas = _interopRequireDefault(require("../schemas"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
18
  // import { argv } from 'process';
23
19
  const args = process.argv.slice(2); // console.log('argv', argv);
24
20
 
@@ -187,9 +183,8 @@ function deprecationSupport(options) {
187
183
  Object.keys(options.app.patterns).forEach(key => {
188
184
  if (options.app.exclude[key] && options.app.patterns[key].length === 0) {
189
185
  let tempArr = options.app.exclude[key];
190
- tempArr = tempArr.map(_x => {
191
- const x = _x.replace(/\//gi, _path.default.sep);
192
-
186
+ tempArr = tempArr.map(x => {
187
+ x = x.replace(/\//gi, _path.default.sep);
193
188
  return `!**${x[0] === _path.default.sep || x[0] === '@' ? '' : _path.default.sep}${x}${x[x.length - 1] === _path.default.sep ? '' : _path.default.sep}**`;
194
189
  });
195
190
  options.app.patterns[key] = tempArr;
@@ -198,9 +193,8 @@ function deprecationSupport(options) {
198
193
  Object.keys(options.docs.patterns).forEach(key => {
199
194
  if (options.docs.exclude[key] && options.docs.patterns[key].length === 0) {
200
195
  let tempArr = options.docs.exclude[key];
201
- tempArr = tempArr.map(_x => {
202
- const x = _x.replace(/\//gi, _path.default.sep);
203
-
196
+ tempArr = tempArr.map(x => {
197
+ x = x.replace(/\//gi, _path.default.sep);
204
198
  return `!**${x[0] === _path.default.sep || x[0] === '@' ? '' : _path.default.sep}${x}${x[x.length - 1] === _path.default.sep ? '' : _path.default.sep}**`;
205
199
  });
206
200
  options.docs.patterns[key] = tempArr;
@@ -208,30 +202,18 @@ function deprecationSupport(options) {
208
202
  });
209
203
  }
210
204
 
211
- const getOptionsFromConfigFile = (appPath, configFileName) => {
212
- const fileName = configFileName || 'build.config.js';
213
-
214
- const packagePath = _path.default.join(appPath, fileName);
215
-
216
- if ((0, _fs.existsSync)(packagePath)) {
217
- return require(packagePath).config;
218
- }
219
-
220
- return null;
221
- };
222
-
223
205
  const getOptions = () => {
224
206
  if (global.reactCLIOptions) {
225
207
  return global.reactCLIOptions;
226
208
  }
227
209
 
228
210
  const appPath = process.cwd();
229
- let userSchemas = getOptionsFromConfigFile(appPath, processEnv.config_file);
211
+ let userSchemas;
230
212
 
231
213
  const packagePath = _path.default.join(appPath, 'package.json');
232
214
 
233
215
  if (_fs.default.existsSync(packagePath)) {
234
- userSchemas = userSchemas || require(packagePath)['react-cli'] || {};
216
+ userSchemas = require(packagePath)['react-cli'] || {};
235
217
  }
236
218
 
237
219
  const options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases