@zohodesk/react-cli 1.1.4-exp.2 → 1.1.5-exp.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -0
- package/lib/common/splitChunks.js +24 -7
- package/lib/configs/resolvers.js +2 -2
- package/lib/constants.js +3 -3
- package/lib/loaderUtils/getCSSLoaders.js +4 -2
- package/lib/plugins/utils/fileHandling.js +3 -17
- package/lib/postcss-plugins/variableModificationPlugin/index.js +5 -0
- package/lib/schemas/index.js +4 -0
- package/lib/servers/getCliPath.js +3 -5
- package/lib/servers/requireLocalOrGlobal.js +1 -1
- package/lib/utils/getOptions.js +8 -2
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -44,6 +44,19 @@ Now to run app
|
|
44
44
|
|
45
45
|
# Change Logs
|
46
46
|
|
47
|
+
# 1.1.5
|
48
|
+
|
49
|
+
**Issue Fix**
|
50
|
+
|
51
|
+
- include pattern fix for variable converter plugin fixed
|
52
|
+
|
53
|
+
# 1.1.4
|
54
|
+
|
55
|
+
**Issue Fix**
|
56
|
+
- global install react-cli spawnSync Error fix
|
57
|
+
- `0px` variable value conversion issue fixed
|
58
|
+
- pattern exclude for postcss plugins case fixed
|
59
|
+
|
47
60
|
# 1.1.2
|
48
61
|
|
49
62
|
**Issue Fix**
|
@@ -22,15 +22,20 @@ let {
|
|
22
22
|
app: {
|
23
23
|
vendorExclude,
|
24
24
|
customChunks,
|
25
|
-
vendorInclude
|
25
|
+
vendorInclude,
|
26
|
+
effectiveChunkSplitting
|
26
27
|
}
|
27
28
|
} = options;
|
29
|
+
let reactBundle = ['react', 'react-dom', 'react-redux', 'react-transition-group', 'scheduler', // what is scheduler
|
30
|
+
'prop-types', // why protypes needed
|
31
|
+
'use-subscription' // 'what is it'
|
32
|
+
];
|
28
33
|
|
29
34
|
let isVendor = function isVendor(module) {
|
30
35
|
let {
|
31
36
|
userRequest
|
32
37
|
} = module;
|
33
|
-
let excludeList = ['script-loader', 'raw-loader',
|
38
|
+
let excludeList = ['script-loader', 'raw-loader', ...reactBundle];
|
34
39
|
excludeList = [...excludeList, ...vendorExclude];
|
35
40
|
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
41
|
};
|
@@ -39,11 +44,13 @@ let isReact = module => {
|
|
39
44
|
let {
|
40
45
|
userRequest
|
41
46
|
} = module;
|
42
|
-
let reactBundle = ['react', 'react-dom'];
|
43
47
|
return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
|
44
48
|
};
|
45
49
|
|
46
|
-
let
|
50
|
+
let baseSplitChunkConfig = {
|
51
|
+
minSize: 12000
|
52
|
+
};
|
53
|
+
let specificCacheGroupConfig = {
|
47
54
|
'react.vendor': {
|
48
55
|
name: 'react.vendor',
|
49
56
|
chunks: 'all',
|
@@ -116,11 +123,21 @@ customChunks.map((obj, index) => ({
|
|
116
123
|
|
117
124
|
return customChunksConfig[name] = obj;
|
118
125
|
});
|
119
|
-
|
120
|
-
|
126
|
+
const isEnableChunkSplitting = effectiveChunkSplitting.enable;
|
127
|
+
|
128
|
+
if (isEnableChunkSplitting) {
|
129
|
+
const config = require(_path.default.join(process.cwd(), effectiveChunkSplitting.configFilePath));
|
130
|
+
|
131
|
+
console.log('config', config);
|
132
|
+
specificCacheGroupConfig = Object.assign(specificCacheGroupConfig, config.getAdditionalCacheGroupConfig());
|
133
|
+
baseSplitChunkConfig = Object.assign(baseSplitChunkConfig, config.getAdditionalBaseChunkSplitConfig());
|
134
|
+
}
|
135
|
+
|
136
|
+
const splitChunkConfig = { ...baseSplitChunkConfig,
|
121
137
|
cacheGroups: Object.assign({
|
122
138
|
default: false,
|
123
139
|
vendors: false
|
124
|
-
},
|
140
|
+
}, specificCacheGroupConfig, customChunksConfig)
|
125
141
|
};
|
142
|
+
var _default = splitChunkConfig;
|
126
143
|
exports.default = _default;
|
package/lib/configs/resolvers.js
CHANGED
@@ -33,7 +33,7 @@ function moduleResolver(options) {
|
|
33
33
|
|
34
34
|
const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
|
35
35
|
return {
|
36
|
-
modules: [nodeModulesPath, _constants.
|
36
|
+
modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
|
37
37
|
alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
|
38
38
|
|
39
39
|
};
|
@@ -45,7 +45,7 @@ function loaderResolver(options) {
|
|
45
45
|
unstableDepsInverse
|
46
46
|
} = options;
|
47
47
|
return {
|
48
|
-
modules: unstableDepsInverse ? ['node_modules', _constants.
|
48
|
+
modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules'] // alias: libAlias
|
49
49
|
|
50
50
|
};
|
51
51
|
}
|
package/lib/constants.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.cliRootPath = exports.
|
6
|
+
exports.cliRootPath = exports.cliNodeModulesPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
|
7
7
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
@@ -18,10 +18,10 @@ exports.cliRootPath = cliRootPath;
|
|
18
18
|
const CONFIG_ROOT = 'react-cli';
|
19
19
|
exports.CONFIG_ROOT = CONFIG_ROOT;
|
20
20
|
|
21
|
-
const
|
21
|
+
const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
|
22
22
|
|
23
23
|
|
24
|
-
exports.
|
24
|
+
exports.cliNodeModulesPath = cliNodeModulesPath;
|
25
25
|
const appPath = process.cwd(); // export const appInitialHTMLTemplatePath = path.join(
|
26
26
|
// process.cwd(),
|
27
27
|
// 'src',
|
@@ -139,13 +139,15 @@ const getCSSLoaders = optionsObj => {
|
|
139
139
|
|
140
140
|
[ postcssPlugins that are implemented ]
|
141
141
|
*/
|
142
|
-
|
142
|
+
// console.log(params.resourcePath);
|
143
|
+
// console.log(postcssPlugins);
|
144
|
+
const finalpostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
|
143
145
|
filename: params.resourcePath,
|
144
146
|
filterObject: patterns,
|
145
147
|
plugins: postcssPlugins
|
146
148
|
}); // postcssPlugins that are allowed
|
147
149
|
|
148
|
-
return
|
150
|
+
return finalpostcssPlugins.length > 0 ? finalpostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
|
149
151
|
}
|
150
152
|
}
|
151
153
|
} : null, plugins.composeMinification ? {
|
@@ -50,34 +50,20 @@ function isFileNameMatchingPattern({
|
|
50
50
|
filterObject,
|
51
51
|
plugins
|
52
52
|
}) {
|
53
|
-
const finalPlugins = [];
|
54
|
-
// const regex = `^(.+?)${rootDir}?\\\\`;
|
55
|
-
|
56
|
-
const newFilename = path.relative(path.parse(process.cwd()).base, filename); //windowsModificationFile(filename).replace(
|
57
|
-
// new RegExp(regex, 'gi'),
|
58
|
-
// ''
|
59
|
-
// );
|
60
|
-
// path.relative('supportapp', 'd:\')
|
61
|
-
|
53
|
+
const finalPlugins = [];
|
62
54
|
Object.keys(filterObject).forEach(key => {
|
63
55
|
plugins.forEach(x => {
|
64
|
-
// console.log(key, x.postcssPlugin);
|
65
56
|
if (aliasNames[key] === x.postcssPlugin) {
|
66
57
|
const ig = (0, _ignore.default)({
|
67
58
|
allowRelativePaths: true
|
68
|
-
}).add(filterObject[key]);
|
59
|
+
}).add(filterObject[key]);
|
69
60
|
|
70
|
-
if (ig.ignores(
|
71
|
-
// console.log(newFilename);
|
61
|
+
if (ig.ignores(filename)) {
|
72
62
|
finalPlugins.push(x);
|
73
63
|
}
|
74
64
|
}
|
75
65
|
});
|
76
66
|
}); // console.log(filename);
|
77
|
-
// console.log(finalPlugins);
|
78
|
-
// console.log(
|
79
|
-
// '----------------------------------------------------------------------'
|
80
|
-
// );
|
81
67
|
|
82
68
|
return finalPlugins; // console.log(filename, filterObject);
|
83
69
|
}
|
@@ -107,6 +107,10 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
107
107
|
}
|
108
108
|
|
109
109
|
if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
|
110
|
+
if (value.trim() === '0px') {
|
111
|
+
return '0';
|
112
|
+
}
|
113
|
+
|
110
114
|
let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
|
111
115
|
|
112
116
|
if (/^-var/.test(retVal)) {
|
@@ -161,6 +165,7 @@ module.exports = {
|
|
161
165
|
});
|
162
166
|
const valRegex = new RegExp(regValStr, 'gi');
|
163
167
|
return rootOriginal => {
|
168
|
+
// console.log(rootOriginal.source.input.from, 'passed through variable Plugin');
|
164
169
|
rootOriginal.walkRules(rule => {
|
165
170
|
// rule.nodes[-1] = {}
|
166
171
|
// need map, forEach fine less memory
|
package/lib/schemas/index.js
CHANGED
@@ -5,19 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getCliPath = getCliPath;
|
7
7
|
|
8
|
-
var _path =
|
8
|
+
var _path = require("path");
|
9
9
|
|
10
10
|
var _os = require("os");
|
11
11
|
|
12
12
|
var _fs = require("fs");
|
13
13
|
|
14
|
-
|
14
|
+
var _constants = require("../constants");
|
15
15
|
|
16
|
-
const appPath = process.cwd();
|
17
|
-
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
18
16
|
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
19
17
|
|
20
|
-
const _getCliPath =
|
18
|
+
const _getCliPath = libName => (0, _path.join)(_constants.cliNodeModulesPath, '.bin', libName);
|
21
19
|
|
22
20
|
const suffixExt = isWindows ? '.cmd' : '';
|
23
21
|
|
@@ -25,7 +25,7 @@ function requireLocalOrGlobal(moduleName, opts = {}) {
|
|
25
25
|
const {
|
26
26
|
local = true
|
27
27
|
} = opts;
|
28
|
-
const isRelativePath = moduleName === '.'; // NOTE: if starts with . then it only mean local
|
28
|
+
const isRelativePath = moduleName[0] === '.'; // NOTE: if starts with . then it only mean local
|
29
29
|
|
30
30
|
if (isRelativePath) {
|
31
31
|
global = false;
|
package/lib/utils/getOptions.js
CHANGED
@@ -183,14 +183,20 @@ function deprecationSupport(options) {
|
|
183
183
|
Object.keys(options.app.patterns).forEach(key => {
|
184
184
|
if (options.app.exclude[key] && options.app.patterns[key].length === 0) {
|
185
185
|
let tempArr = options.app.exclude[key];
|
186
|
-
tempArr = tempArr.map(x =>
|
186
|
+
tempArr = tempArr.map(x => {
|
187
|
+
x = x.replace(/\//gi, _path.default.sep);
|
188
|
+
return `!**${x[0] === _path.default.sep || x[0] === '@' ? '' : _path.default.sep}${x}${x[x.length - 1] === _path.default.sep ? '' : _path.default.sep}**`;
|
189
|
+
});
|
187
190
|
options.app.patterns[key] = tempArr;
|
188
191
|
}
|
189
192
|
});
|
190
193
|
Object.keys(options.docs.patterns).forEach(key => {
|
191
194
|
if (options.docs.exclude[key] && options.docs.patterns[key].length === 0) {
|
192
195
|
let tempArr = options.docs.exclude[key];
|
193
|
-
tempArr = tempArr.map(x =>
|
196
|
+
tempArr = tempArr.map(x => {
|
197
|
+
x = x.replace(/\//gi, _path.default.sep);
|
198
|
+
return `!**${x[0] === _path.default.sep || x[0] === '@' ? '' : _path.default.sep}${x}${x[x.length - 1] === _path.default.sep ? '' : _path.default.sep}**`;
|
199
|
+
});
|
194
200
|
options.docs.patterns[key] = tempArr;
|
195
201
|
}
|
196
202
|
});
|
package/npm-shrinkwrap.json
CHANGED