@zohodesk/react-cli 0.0.1-exp.164.2 → 0.0.1-exp.166.1

Sign up to get free protection for your applications and to get access to all the features.
package/DOTO.md ADDED
@@ -0,0 +1,13 @@
1
+ Things that can be done
2
+
3
+ 1. react-cli total revamp dependency packages version update (must for future (2-4 months) But not problem for now)
4
+ 1. when we do revamp we may can to create a document with full detailed.
5
+ 2. react-cli find the chain set for 0.0.1-alpha.113 version (must for future( 20 may 2022 ) But not problem for now) -- DONE
6
+ 3. react version update 17 or 18 (must for future (until desk as efc or until get confilct with gc or some kind) But not problem for now)
7
+ 1. if we move react 18, may be I can remove some hacks form virtualizer. we put hacks for batching since react 18 has auto batch we can remove that
8
+ 2. same for react-dnd
9
+ 4. react-cli package split (good to have)
10
+ 5. efc unification (must for good future (2-4 months) But not problem for now)
11
+ 6. i18n build as separate then client build I have some Ideas with some drawbacks (good to have)
12
+ 7. react own implmention (good to have and also have a posiblity for Diamonds since it can lead as to some thing great for example preformance enforceing like always PureComponent , built in context optimazation, and issue fix we found in react reorder preformance problem. In my point of view react highly focus on declarative rather then preformance in some places may be there is reason but we may not have a use for that reason, and in some place I need to bend like hell to make what I want)
13
+ 8. all repo links and build process and documention for steps
package/README.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
4
 
5
+ # 0.0.1-exp.166.1
6
+
7
+ Changes:-
8
+
9
+ - `__testUtils__/globals.js` to jest is not mantatory
10
+ - disableES5Transpile option libAlias added
11
+
12
+ # 0.0.1-beta.166
13
+
14
+ this version has same as `# 0.0.1-exp.164.1`, `# 0.0.1-exp.164.2` and below and some minor changes
15
+
16
+ - google chorme cors preflight issue fix
17
+
18
+ # 0.0.1-beta.165
19
+
20
+ - `valueReplacer` option added in shemas for font name replace related issue handling, for more [details](./docs/ValueReplacer.md)
21
+ - `valuereplacer` option added in react-cli it takes three
22
+ 1. sourceDir
23
+ 2. distDir
24
+ 3. `copyAll` is boolean flag which is for copy all other file or not. "true" means copy all files.
25
+
26
+ # 0.0.1-exp.164.1
27
+
28
+ - extra features in custom chunks reffer [this](./docs/CustomChunks.md)
29
+
5
30
  # 0.0.1-exp.164.2
6
31
 
7
32
  - `devbuild` option add to react cli
package/bin/cli.js CHANGED
@@ -121,6 +121,15 @@ switch (option) {
121
121
  { stdio: 'inherit' }
122
122
  );
123
123
 
124
+ process.exit(result.status);
125
+ break;
126
+ case 'valuereplacer':
127
+ result = spawnSync(
128
+ 'node',
129
+ [require.resolve('../lib/common/valueReplacer')].concat(args),
130
+ { stdio: 'inherit' }
131
+ );
132
+
124
133
  process.exit(result.status);
125
134
  break;
126
135
  case 'app':
@@ -0,0 +1,26 @@
1
+ # Custom Chunks
2
+
3
+ In react-cli we provide options to create custom chunks.
4
+ This Custom Chunk Option is array of Object
5
+ that Object keys are
6
+
7
+ - `pattern` regex pattern as string
8
+ - `name` chunk name
9
+ - `size` is count which is minmum chunk dublicated or need in chunks
10
+
11
+ > Since 0.0.1-exp.164.1
12
+
13
+ extra features in custom chunks :-
14
+ for more details [SplitChunkPlugin](https://webpack.js.org/plugins/split-chunks-plugin/) webpack
15
+
16
+ - `minChunks`: `minChunks` is alies of `size` default value is `2`,
17
+ - `rules`: `rules` is same as `pattern` with some easy hooks
18
+ - use `/` for both windows and linux we will replace internally
19
+ - for `.*` we need to use `*`
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
21
+ - `chunks`: by this option we can specify , default value is `all`,
22
+ - `priority`: priority default value is `-10 * (index + 2)`,
23
+ - `enforce`: enforce default value is true,
24
+ - `maxSize`: maxSize, default value is 0,
25
+ - `minSize`: minSize, default value is 20000,
26
+ includeDepenency: includeDepenency default value is false
package/docs/TODOS.md ADDED
@@ -0,0 +1,10 @@
1
+ we need to fix all the warning print while install react-cli
2
+
3
+ 1. npm WARN deprecated `babel-eslint@10.1.0`: babel-eslint is now `@babel/eslint-parser`. This package will no longer receive updates.
4
+ to resolve this warning use https://tjaddison.com/blog/2021/03/updating-babel-eslint-to-babeleslint-parser-for-react-apps/
5
+
6
+ 2. npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin.
7
+ for this warning we need to confirm `is eslint-loader need while build` it's simplely waste of time if you ask me.
8
+ 3. gitlab@14.2.2: The gitlab package has found a new home in the @gitbeaker organization. For the latest gitlab node library, check out @gitbeaker/node
9
+ for this warning we need to check with gitbeaker and impact team as well.
10
+ 4. `fsevents@1.2.13` and `chokidar@2.1.8` these are just dependent packages need to check parent package of this package
@@ -0,0 +1,60 @@
1
+ # value replacer
2
+
3
+ <!-- file paths
4
+ 1. src/postcss-plugins/ValueReplacer.js
5
+ 2. src/common/valueReplacer.js
6
+ -->
7
+
8
+ this option is array of objects which will have a two keys
9
+ new option `valueReplacer` added for replace css property value while build running
10
+
11
+ - this option is array of object, that object two keys
12
+ 1. `props` key for array of property names
13
+ 2. `values` key is object ,this object key contents will be replaced as value content
14
+ - this option wiil be work for below
15
+
16
+ - `start`
17
+ - `docs`
18
+ - `nowatchstart`
19
+ - `devbuild`
20
+ - `build:library:es`
21
+ - `build:component:es`
22
+ - `build:library:cmjs`
23
+ - `build:component:cmjs`
24
+ Example data:-
25
+
26
+ ```json
27
+ {
28
+ "react-cli": {
29
+ "css": {
30
+ "valueReplacer": [
31
+ {
32
+ "props": ["font", "font-family"],
33
+ "values": {
34
+ "zdfonts-rCallBar": "zdf-rCallBar_1",
35
+ "zdfonts-rPuvi": "zdf-rPuvi_1"
36
+ }
37
+ // ,suffix: '0'
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ Example Replace:-
46
+ before replace
47
+
48
+ ```css
49
+ .some-selector {
50
+ font: zdfonts-rCallBar !important;
51
+ }
52
+ ```
53
+
54
+ after replace
55
+
56
+ ```css
57
+ .some-selector {
58
+ font: zdf-rCallBar_1 !important;
59
+ }
60
+ ```
@@ -0,0 +1,35 @@
1
+ npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
2
+ npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin
3
+ npm WARN deprecated gitlab@14.2.2: The gitlab package has found a new home in the @gitbeaker organization. For the latest gitlab node library, check out @gitbeaker/node. A full list of the features can be found here: https://github.com/jdalrymple/gitbeaker#readme
4
+ npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
5
+ npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
6
+ npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
7
+ npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
8
+ npm WARN deprecated cross-spawn-async@1.0.1: cross-spawn no longer requires a build toolchain, use it instead
9
+ npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
10
+ npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
11
+ npm WARN deprecated har-validator@5.1.5: this library is no longer supported
12
+ npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
13
+ npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
14
+ npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
15
+ npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
16
+ npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
17
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
18
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
20
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
21
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
22
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
23
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
24
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25
+ npm WARN check2@1.0.0 No description
26
+ npm WARN check2@1.0.0 No repository field.
27
+
28
+ + @zohodesk/react-cli@0.0.1-beta.165
29
+ updated 1 package and audited 1899 packages in 51.509s
30
+
31
+ 21 packages are looking for funding
32
+ run `npm fund` for details
33
+
34
+ found 42 vulnerabilities (2 low, 20 moderate, 8 high, 12 critical)
35
+ run `npm audit fix` to fix them, or `npm audit` for details
@@ -7,9 +7,11 @@ exports.default = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
10
+ var _os = _interopRequireDefault(require("os"));
11
+
10
12
  var _utils = require("../utils");
11
13
 
12
- var _os = _interopRequireDefault(require("os"));
14
+ var _testPattern = require("./testPattern");
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
@@ -47,30 +49,75 @@ let defaultChunks = {
47
49
  chunks: 'all',
48
50
  minChunks: 1,
49
51
  test: isReact,
52
+ enforce: true,
53
+ // priority: 10
50
54
  priority: -10
51
55
  },
52
56
  vendor: {
53
57
  name: 'vendor',
54
58
  chunks: 'all',
59
+ // chunks: 'initial',
55
60
  minChunks: 1,
56
61
  test: isVendor,
62
+ // priority: 19,
57
63
  priority: -10
58
64
  }
59
65
  };
60
66
  let customChunksConfig = {};
61
- customChunks.map(({
67
+ customChunks.map((obj, index) => ({
68
+ name: obj.name,
69
+ pattern: obj.pattern,
70
+ minChunks: obj.minChunks || obj.size || 2,
71
+ rules: obj.rules,
72
+ // includeDepenency: obj.includeDepenency || false,
73
+ priority: obj.priority || -10 * (index + 2),
74
+ enforce: obj.enforce || true,
75
+ maxSize: obj.maxSize,
76
+ // || 0,
77
+ minSize: obj.minSize,
78
+ // || 20000,
79
+ chunks: obj.chunks || 'all'
80
+ })).map(({
62
81
  name,
63
82
  pattern,
64
- size = 2
65
- }, index) => customChunksConfig[name] = {
66
- name,
67
- test: new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
68
- chunks: 'all',
69
- enforce: true,
70
- minChunks: size,
71
- priority: -10 * (index + 2)
83
+ minChunks,
84
+ rules,
85
+ priority,
86
+ // includeDepenency,
87
+ enforce,
88
+ minSize,
89
+ maxSize,
90
+ chunks = 'all'
91
+ }) => {
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),
103
+ chunks,
104
+ enforce,
105
+ minChunks,
106
+ priority
107
+ };
108
+
109
+ if (minSize !== undefined) {
110
+ obj.minSize = minSize;
111
+ }
112
+
113
+ if (maxSize !== undefined) {
114
+ obj.maxSize = maxSize;
115
+ }
116
+
117
+ return customChunksConfig[name] = obj;
72
118
  });
73
119
  var _default = {
120
+ minSize: 12000,
74
121
  cacheGroups: Object.assign({
75
122
  default: false,
76
123
  vendors: false
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isDependency = isDependency;
7
+ exports.isRelatedPackage = exports.isRelated = void 0;
8
+ exports.testPattern = testPattern;
9
+
10
+ var _path = require("path");
11
+
12
+ // in our development we only use windows, mac and linux
13
+ const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
14
+
15
+ function _testPattern(req, pattern) {
16
+ let modifyedPattern = pattern;
17
+
18
+ if (/[*.$^]/.test(modifyedPattern)) {
19
+ if (isWindows) {
20
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
22
+ }
23
+
24
+ modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
+ const re = new RegExp(modifyedPattern);
26
+ return re.test(req);
27
+ }
28
+
29
+ if (isWindows) {
30
+ // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
+ modifyedPattern = modifyedPattern.replace(/\//g, '\\');
32
+ }
33
+
34
+ return req.indexOf(modifyedPattern) !== -1;
35
+ }
36
+
37
+ function testPattern(req, pattern) {
38
+ if (!req || !pattern) {
39
+ return false;
40
+ }
41
+
42
+ if (Array.isArray(pattern)) {
43
+ // eslint-disable-next-line no-unused-vars
44
+ return pattern.every(p => testPattern(req, p));
45
+ }
46
+
47
+ if (pattern[0] === '!') {
48
+ return !_testPattern(req, pattern.slice(1));
49
+ }
50
+
51
+ return _testPattern(req, pattern);
52
+ }
53
+
54
+ const isRelated = (req, item) => req && req.indexOf(item) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
55
+
56
+
57
+ exports.isRelated = isRelated;
58
+
59
+ const isRelatedPackage = (req, item) => isRelated(req, `node_modules${_path.sep}${item}${_path.sep}`) !== -1; // export const isRelated = (req, item) => testPattern(req, item);
60
+
61
+
62
+ exports.isRelatedPackage = isRelatedPackage;
63
+
64
+ function isDependency(m, excludeList) {
65
+ // let reasons = m.reasons.map(r => r.module.userRequest);
66
+ // m.reasons.some(r => !r.module || !r.module.userRequest) && console.log(m.reasons);
67
+ return m.reasons.some(r => excludeList.some(item => r.module && isRelated(r.module.userRequest, item)));
68
+ } // export function queryHandler(conditions, pattern) {
69
+ // }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _postcss = _interopRequireDefault(require("postcss"));
4
+
5
+ var _path = _interopRequireDefault(require("path"));
6
+
7
+ var _fs = _interopRequireDefault(require("fs"));
8
+
9
+ var _folderIterator = _interopRequireDefault(require("../utils/folderIterator"));
10
+
11
+ var _utils = require("../utils");
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ const cwd = process.cwd();
16
+
17
+ const src = _path.default.join(cwd, process.argv[2]);
18
+
19
+ const dist = _path.default.join(cwd, process.argv[3]);
20
+
21
+ const docopy = process.argv[4] === 'true';
22
+ const {
23
+ css: {
24
+ valueReplacer
25
+ }
26
+ } = (0, _utils.getOptions)();
27
+
28
+ if (!_fs.default.existsSync(dist)) {
29
+ _fs.default.mkdirSync(dist, {
30
+ recursive: true
31
+ });
32
+ }
33
+
34
+ (0, _folderIterator.default)(src, dist, docopy ? false : ['.css'], false, (fromPath, toPath) => {
35
+ //console.log({ fromPath: fromPath, toPath: toPath });
36
+ let css = _fs.default.readFileSync(fromPath);
37
+
38
+ if (docopy && !fromPath.endsWith('.css')) {
39
+ //console.log(toPath,'....');
40
+ _fs.default.writeFileSync(toPath, css);
41
+
42
+ return;
43
+ }
44
+
45
+ (0, _postcss.default)([valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer)]).process(css, {
46
+ from: fromPath,
47
+ to: toPath
48
+ }).then(result => {
49
+ _fs.default.writeFile(toPath, result.css, () => true);
50
+
51
+ if (result.map) {
52
+ _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
53
+ }
54
+ });
55
+ });
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _fs = require("fs");
4
+
3
5
  var _path = _interopRequireDefault(require("path"));
4
6
 
5
7
  var _libAlias = require("./libAlias");
@@ -13,6 +15,9 @@ let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, ke
13
15
  previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
14
16
  return previousValue;
15
17
  }, {});
18
+
19
+ const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
20
+
16
21
  let commonConfig = {
17
22
  coverageReporters: ['json', 'html', 'json-summary', 'text'],
18
23
  collectCoverage: true,
@@ -28,7 +33,7 @@ let commonConfig = {
28
33
  transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
29
34
  // transformIgnorePatterns: ['/node_modules.*?.js$'],
30
35
  moduleFileExtensions: ['js'],
31
- setupFiles: [_path.default.resolve(appPath, '__testUtils__', 'globals.js'), _path.default.resolve(__dirname, '..', 'jest', 'setup.js')],
36
+ setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
32
37
  globals: {
33
38
  __DEVELOPMENT__: true,
34
39
  __DOCS__: false,
@@ -8,6 +8,8 @@ var _pluginUtils = require("../pluginUtils");
8
8
 
9
9
  var _loaderUtils = require("../loaderUtils");
10
10
 
11
+ var _libAlias = require("./libAlias");
12
+
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
13
15
  let options = (0, _utils.getOptions)();
@@ -21,46 +23,47 @@ let {
21
23
  classNamePrefix
22
24
  },
23
25
  app: {
24
- folder
26
+ folder,
27
+ disableES5Transpile
25
28
  }
26
29
  } = options;
27
30
  let appPath = process.cwd();
28
31
 
29
32
  module.exports = isSSTest => ({
30
33
  entry: {
31
- main: [_path.default.resolve(__dirname, "..", "hooks", "docsProptypeHook.js"), _path.default.join(appPath, componentFolder, "index.js")],
32
- vendor: ["react", "react-dom", "redux", "react-redux"]
34
+ main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
35
+ vendor: ['react', 'react-dom', 'redux', 'react-redux']
33
36
  },
34
- devtool: "none",
35
- mode: "development",
37
+ devtool: 'none',
38
+ mode: 'development',
36
39
  output: {
37
- path: _path.default.join(appPath, "build"),
38
- filename: "js/[name].js",
39
- publicPath: "/docs/",
40
- library: "Component",
41
- libraryTarget: "umd"
40
+ path: _path.default.join(appPath, 'build'),
41
+ filename: 'js/[name].js',
42
+ publicPath: '/docs/',
43
+ library: 'Component',
44
+ libraryTarget: 'umd'
42
45
  },
43
46
  plugins: (0, _pluginUtils.getDocsPlugins)(isSSTest, options),
44
47
  module: {
45
48
  rules: [{
46
49
  test: /\.js$/,
47
50
  use: [{
48
- loader: "babel-loader",
51
+ loader: 'babel-loader',
49
52
  options: {
50
- presets: [[require.resolve("@babel/preset-env"), {
53
+ presets: [[require.resolve('@babel/preset-env'), {
51
54
  modules: false
52
- }], require.resolve("@babel/preset-react")],
53
- plugins: [[require.resolve("@babel/plugin-transform-runtime"), {
55
+ }], require.resolve('@babel/preset-react')],
56
+ plugins: [[require.resolve('@babel/plugin-transform-runtime'), {
54
57
  helpers: true,
55
58
  regenerator: false
56
- }], require.resolve("@babel/plugin-syntax-dynamic-import"), require.resolve("@babel/plugin-syntax-object-rest-spread")],
59
+ }], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('@babel/plugin-syntax-object-rest-spread')],
57
60
  cacheDirectory: true
58
61
  }
59
62
  }],
60
63
  include: _path.default.join(appPath, folder)
61
64
  }, {
62
65
  test: /\.docs\.js$/,
63
- use: require.resolve("../loaders/docsLoader.js"),
66
+ use: require.resolve('../loaders/docsLoader.js'),
64
67
  include: _path.default.join(appPath, folder),
65
68
  exclude: /node_modules/
66
69
  }, {
@@ -68,29 +71,29 @@ module.exports = isSSTest => ({
68
71
  use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
69
72
  }, {
70
73
  test: /\.jpe?g$|\.gif$|\.png$/,
71
- use: ["url-loader?limit=1000&name=./images/[name].[ext]"]
74
+ use: ['url-loader?limit=1000&name=./images/[name].[ext]']
72
75
  }, {
73
76
  test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
74
- use: ["url-loader?limit=1000&name=./fonts/[name].[ext]"]
77
+ use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
75
78
  }, {
76
79
  test: /\.svg$/,
77
- use: ["url-loader?limit=1&name=./fonts/[name].[ext]"]
80
+ use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
78
81
  }, {
79
82
  test: /\.html$/,
80
83
  use: {
81
- loader: "html-loader",
84
+ loader: 'html-loader',
82
85
  options: {
83
- attrs: [":data-src"],
84
- interpolate: "require"
86
+ attrs: [':data-src'],
87
+ interpolate: 'require'
85
88
  }
86
89
  }
87
90
  }, {
88
91
  test: /\.ogg$/,
89
- use: ["file-loader?name=./fonts/[name].[ext]"]
92
+ use: ['file-loader?name=./fonts/[name].[ext]']
90
93
  }, {
91
94
  test: /\.tmpl$/,
92
95
  use: [{
93
- loader: "html-loader",
96
+ loader: 'html-loader',
94
97
  options: {
95
98
  minimize: {
96
99
  removeComments: true,
@@ -104,12 +107,13 @@ module.exports = isSSTest => ({
104
107
  }]
105
108
  },
106
109
  externals: {
107
- ZC: "$ZC"
110
+ ZC: '$ZC'
108
111
  },
109
112
  resolve: {
110
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
113
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
114
+ alias: disableES5Transpile ? _libAlias.libAlias : {}
111
115
  },
112
116
  resolveLoader: {
113
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
117
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
114
118
  }
115
119
  });
@@ -20,6 +20,9 @@ let getCSSLoaders = (hasRTL, rtlExclude, classNameBlob, cssUniqueness, selectorR
20
20
  const {
21
21
  devCssFileBountry
22
22
  } = options.app;
23
+ const {
24
+ valueReplacer
25
+ } = options.css;
23
26
  const {
24
27
  cssSelectorZipPath
25
28
  } = options.impactService;
@@ -36,6 +39,18 @@ let getCSSLoaders = (hasRTL, rtlExclude, classNameBlob, cssUniqueness, selectorR
36
39
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix);
37
40
  }
38
41
 
42
+ const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), hasRTL && require('../postcss-plugins/ExcludeRTLPlugin')({
43
+ ignore: rtlExcludeLocal,
44
+ plugins: [require('@zohodesk/postcss-rtl')({
45
+ addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
46
+ if (prefix === '[dir]') {
47
+ return selector;
48
+ }
49
+
50
+ return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
51
+ }
52
+ })]
53
+ })].filter(Boolean);
39
54
  return [cssSelectorZipPath && {
40
55
  loader: require.resolve('../loaders/selectorMappingLoader')
41
56
  }, {
@@ -51,23 +66,12 @@ let getCSSLoaders = (hasRTL, rtlExclude, classNameBlob, cssUniqueness, selectorR
51
66
  options: {
52
67
  devCssFileBountry
53
68
  }
54
- }, hasRTL || selectorReplace ? {
69
+ }, postcssPlugins.length > 0 ? {
55
70
  loader: 'postcss-loader',
56
71
  options: {
57
72
  ident: 'postcss',
58
73
  plugins: function () {
59
- return [selectorReplace && require('postcss-selector-replace')(selectorReplace), hasRTL && require('../postcss-plugins/ExcludeRTLPlugin')({
60
- ignore: rtlExcludeLocal,
61
- plugins: [require('@zohodesk/postcss-rtl')({
62
- addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
63
- if (prefix === '[dir]') {
64
- return selector;
65
- }
66
-
67
- return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
68
- }
69
- })]
70
- })].filter(Boolean);
74
+ return postcssPlugins;
71
75
  }
72
76
  }
73
77
  } : null].filter(Boolean);
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _postcss = _interopRequireDefault(require("postcss"));
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
7
+ // module.exports = postcss.plugin('postcss-value-replacer', opts => {
8
+ // const { plugins } = opts;
9
+ // return (root, result) => {
10
+ // const inputFile = root.source.input.file;
11
+ // let isIgnoredFile= opts.ignore.some(file => inputFile.indexOf(file)!==-1);
12
+ // if (!isIgnoredFile) {
13
+ // const handler = response =>
14
+ // response.messages.forEach(msg => result.messages.push(msg));
15
+ // return postcss(plugins)
16
+ // .process(root, { from: undefined })
17
+ // .then(handler);
18
+ // }
19
+ // };
20
+ // });
21
+ // export default
22
+ module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) => // Work with options here
23
+ root => {
24
+ root.walkDecls(decl => {
25
+ valueReplacer.forEach(obj => {
26
+ if (obj.props.indexOf(decl.prop) !== -1) {
27
+ let ks = Object.keys(obj.values).sort((a, b) => b.length - a.length);
28
+ ks.forEach(k => {
29
+ decl.value = decl.value.replace(k, obj.values[k]);
30
+ }); //decl.value = obj.values[decl.value];
31
+ }
32
+ }); //console.log({root, roots:root+""}, root+"")
33
+ // Transform CSS AST here
34
+ }); // root.walkDecls(decl => {
35
+ // valueReplacer.forEach(obj => {
36
+ // if (
37
+ // obj.props.indexOf(decl.prop) !== -1 &&
38
+ // obj.values[decl.value] !== undefined
39
+ // ) {
40
+ // decl.value = obj.values[decl.value];
41
+ // }
42
+ // });
43
+ // //console.log({root, roots:root+""}, root+"")
44
+ // // Transform CSS AST here
45
+ // });
46
+ });
@@ -44,6 +44,17 @@ var _default = {
44
44
  },
45
45
  css: {
46
46
  enableRTLSplit: false,
47
+ valueReplacer: null,
48
+ //valueReplacer: [
49
+ // {
50
+ // props: ['font', 'font-family'],
51
+ // values: {
52
+ // 'zdfonts-rCallBar': 'zdfonts-rCallBar01',
53
+ // 'zdfonts-rCall': 'zdfonts-rCallBar02'
54
+ // }
55
+ // // ,suffix: '0'
56
+ // }
57
+ // ],
47
58
  templateLabel: '{{--dir}}',
48
59
  disableMiniFiySelector: false,
49
60
  dirVarName: 'document.dir'
@@ -99,9 +99,16 @@ app.use((0, _HMRMiddleware.default)(compiler, {
99
99
  path: '/sockjs-node/info'
100
100
  }));
101
101
  app.use((req, res, next) => {
102
- res.setHeader('Access-Control-Allow-Origin', '*');
102
+ //console.log('origin', req.get('origin'));
103
+ res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
104
+
105
+ res.setHeader('Access-Control-Allow-Private-Network', true);
106
+ res.setHeader('Access-Control-Allow-Credentials', true);
103
107
  next();
104
108
  }).use(`${contextURL}/fonts`, _express.default.static(`${context}/fonts`));
109
+ app.options('/*', (req, res) => {
110
+ res.send('Ok');
111
+ });
105
112
  app.use('/wms/*', (req, res) => {
106
113
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
107
114
  });
@@ -197,6 +204,6 @@ app.listen(httpPort, err => {
197
204
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
198
205
  host,
199
206
  domain,
200
- port: httpPort
207
+ port: port
201
208
  }, 'ht' + 'tp')}${contextURL}/`);
202
209
  });
package/npm8.md ADDED
@@ -0,0 +1,9 @@
1
+ # npm 8 change related things
2
+
3
+ 1. in npm run script config options `:` not working (properly|correctly), So we need to use `_` in the place of `:`
4
+ For Example:
5
+ - `--app:port` wouldn't work we have to do like this `--app_port`
6
+ - `--clone:proj:name` wouldn't work we have to do like this `----clone_proj_name`
7
+
8
+ @zohodes/react-cli or fz-react-cli regardless of what cli you use.
9
+ So, we need to change all package.json script which is using this (`:`) we need to change as (`_`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-exp.164.2",
3
+ "version": "0.0.1-exp.166.1",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",