@zohodesk/react-cli 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
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**
@@ -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.cliNodemodulesPath, 'node_modules'].filter(Boolean),
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.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
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.cliNodemodulesPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
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 cliNodemodulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
21
+ const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
22
22
 
23
23
 
24
- exports.cliNodemodulesPath = cliNodemodulesPath;
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
- postcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
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 postcssPlugins.length > 0 ? postcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
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 = []; // console.log(rootDir);
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(newFilename)) {
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 = _interopRequireDefault(require("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
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
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;
@@ -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 => `!${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 => `!${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
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",