@zohodesk/react-cli 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- 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 +2 -14
- package/lib/postcss-plugins/variableModificationPlugin/index.js +5 -1
- 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,13 @@ Now to run app
|
|
44
44
|
|
45
45
|
# Change Logs
|
46
46
|
|
47
|
+
# 1.1.4
|
48
|
+
|
49
|
+
**Issue Fix**
|
50
|
+
- global install react-cli spawnSync Error fix
|
51
|
+
- `0px` variable value conversion issue fixed
|
52
|
+
- pattern exclude for postcss plugins case fixed
|
53
|
+
|
47
54
|
# 1.1.2
|
48
55
|
|
49
56
|
**Issue Fix**
|
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',
|
@@ -136,13 +136,15 @@ const getCSSLoaders = optionsObj => {
|
|
136
136
|
|
137
137
|
[ postcssPlugins that are implemented ]
|
138
138
|
*/
|
139
|
-
|
139
|
+
// console.log(params.resourcePath);
|
140
|
+
// console.log(postcssPlugins);
|
141
|
+
const finalpostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
|
140
142
|
filename: params.resourcePath,
|
141
143
|
filterObject: patterns,
|
142
144
|
plugins: postcssPlugins
|
143
145
|
}); // postcssPlugins that are allowed
|
144
146
|
|
145
|
-
return
|
147
|
+
return finalpostcssPlugins.length > 0 ? finalpostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
|
146
148
|
}
|
147
149
|
}
|
148
150
|
} : null, plugins.composeMinification ? {
|
@@ -50,32 +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
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
67
|
|
80
68
|
return finalPlugins; // console.log(filename, filterObject);
|
81
69
|
}
|
@@ -89,7 +89,6 @@ function pxToCalc(value) {
|
|
89
89
|
}
|
90
90
|
});
|
91
91
|
});
|
92
|
-
console.log(arr.join(' '));
|
93
92
|
return arr.join(' ');
|
94
93
|
}
|
95
94
|
|
@@ -108,6 +107,10 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
108
107
|
}
|
109
108
|
|
110
109
|
if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
|
110
|
+
if (value.trim() === '0px') {
|
111
|
+
return '0';
|
112
|
+
}
|
113
|
+
|
111
114
|
let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
|
112
115
|
|
113
116
|
if (/^-var/.test(retVal)) {
|
@@ -162,6 +165,7 @@ module.exports = {
|
|
162
165
|
});
|
163
166
|
const valRegex = new RegExp(regValStr, 'gi');
|
164
167
|
return rootOriginal => {
|
168
|
+
// console.log(rootOriginal.source.input.from, 'passed through variable Plugin');
|
165
169
|
rootOriginal.walkRules(rule => {
|
166
170
|
// rule.nodes[-1] = {}
|
167
171
|
// need map, forEach fine less memory
|
@@ -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