@zohodesk/react-cli 1.0.2-exp.2 → 1.0.2-exp.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -209,12 +209,11 @@ const getDevPlugins = (options, publicPath) => {
209
209
  patterns,
210
210
  patternsRootDir
211
211
  }));
212
- }
212
+ } // if (pluginObject.minifier) {
213
+ // // console.log('minifier active');
214
+ // pluginsArr.push(new MinifierPlugin());
215
+ // }
213
216
 
214
- if (pluginObject.minifier) {
215
- // console.log('minifier active');
216
- pluginsArr.push(new _plugins.MinifierPlugin());
217
- }
218
217
 
219
218
  return pluginsArr.filter(Boolean);
220
219
  };
@@ -45,12 +45,15 @@ const getProdPlugins = (options, publicPath = '') => {
45
45
  bundleAnalyze,
46
46
  optimize,
47
47
  publicPaths,
48
+ patterns,
49
+ patternsRootDir,
48
50
  hasEFC: prevOptionForEnableEFC,
49
51
  enableSMapHook,
50
52
  tpFolder,
51
53
  folder,
52
54
  outputFolder,
53
55
  context,
56
+ exclude,
54
57
  enableSMap,
55
58
  server: {
56
59
  mode
@@ -268,13 +271,18 @@ const getProdPlugins = (options, publicPath = '') => {
268
271
 
269
272
  if (pluginObject.cssVariableReplacement) {
270
273
  pluginsArr.push(new _VariableConversionCollector.default({
271
- cssVariableReplacementConfig
274
+ cssVariableReplacementConfig,
275
+ patterns,
276
+ patternsRootDir
272
277
  }));
273
278
  }
274
279
 
275
280
  if (pluginObject.selectorWeight) {
276
281
  pluginsArr.push(new _SelectorPlugin.default({
277
- selectorWeightConfig
282
+ selectorWeightConfig,
283
+ exclude: exclude.selectorWeight,
284
+ patterns,
285
+ patternsRootDir
278
286
  }));
279
287
  } // plugins.push(new VariableConversionCollector({}));
280
288
 
@@ -121,7 +121,8 @@ class VariableConversionCollector {
121
121
  this.optimize = options.optimize;
122
122
  this.filename = options.cssVariableReplacementConfig;
123
123
  this.patterns = options.patterns;
124
- this.rootDir = options.patternsRootDir;
124
+ this.rootDir = options.patternsRootDir; // console.log(options.patterns, this.patterns);
125
+
125
126
  this.initializeFiles();
126
127
  }
127
128
 
@@ -12,6 +12,8 @@ var _ignore = _interopRequireDefault(require("ignore"));
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
+ const path = require('path');
16
+
15
17
  let aliasNames = {
16
18
  valueReplacer: 'postcss-value-replacer',
17
19
  selectorReplace: 'postcss-selector-replace-new',
@@ -50,14 +52,21 @@ function isFileNameMatchingPattern({
50
52
  rootDir
51
53
  }) {
52
54
  const finalPlugins = []; // console.log(rootDir);
55
+ // const regex = `^(.+?)${rootDir}?\\\\`;
56
+
57
+ const newFilename = path.relative(rootDir, filename); //windowsModificationFile(filename).replace(
58
+ // new RegExp(regex, 'gi'),
59
+ // ''
60
+ // );
61
+ // path.relative('supportapp', 'd:\')
53
62
 
54
- const regex = `^(.+?)${rootDir}?\\\\`;
55
- const newFilename = (0, _windowsModification.windowsModificationFile)(filename).replace(new RegExp(regex, 'gi'), '');
56
63
  Object.keys(filterObject).forEach(key => {
57
64
  plugins.forEach(x => {
58
65
  // console.log(key, x.postcssPlugin);
59
66
  if (aliasNames[key] === x.postcssPlugin) {
60
- const ig = (0, _ignore.default)().add(filterObject[key]);
67
+ const ig = (0, _ignore.default)({
68
+ allowRelativePaths: true
69
+ }).add(filterObject[key]);
61
70
 
62
71
  if (ig.ignores(newFilename)) {
63
72
  // console.log(newFilename);
@@ -78,11 +87,17 @@ function isFileNameMatchingPluginPattern({
78
87
  rootDir
79
88
  }) {
80
89
  let include = true; // console.log(rootDir);
90
+ // const regex = `^(.+?)${rootDir}?\\\\`;
91
+ // console.log(plugin);
81
92
 
82
- const regex = `^(.+?)${rootDir}?\\\\`; // console.log(plugin);
93
+ const newFilename = path.relative(rootDir, filename); // const newFilename = windowsModificationFile(filename).replace(
94
+ // new RegExp(regex, 'gi'),
95
+ // ''
96
+ // );
83
97
 
84
- const newFilename = (0, _windowsModification.windowsModificationFile)(filename).replace(new RegExp(regex, 'gi'), '');
85
- const ig = (0, _ignore.default)().add(filterArr);
98
+ const ig = (0, _ignore.default)({
99
+ allowRelativePaths: true
100
+ }).add(filterArr);
86
101
 
87
102
  if (!ig.ignores(newFilename)) {
88
103
  include = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.0.2-exp.2",
3
+ "version": "1.0.2-exp.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",