@zohodesk/react-cli 0.0.1-exp.162.2 → 0.0.1-exp.162.3
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/.eslintrc.js +2 -6
- package/README.md +28 -1
- package/bin/cli.js +32 -34
- package/lib/common/splitChunks.js +63 -10
- package/lib/configs/webpack.dev.config.js +3 -3
- package/lib/configs/webpack.prod.config.js +12 -22
- package/lib/pluginUtils/getProdPlugins.js +3 -9
- package/lib/schemas/index.js +7 -1
- package/lib/utils/getOptions.js +7 -5
- package/lib/utils/jsonHelper.js +11 -2
- package/package.json +3 -8
- package/eslint/NOTES.md +0 -3
- package/eslint/mockapi.html +0 -18
- package/eslint/mockapi.md +0 -5
- package/log.log +0 -702
package/.eslintrc.js
CHANGED
@@ -108,6 +108,8 @@ let commonConfigs = {
|
|
108
108
|
'comma-dangle': [logLevel],
|
109
109
|
'comma-spacing': [logLevel],
|
110
110
|
'func-call-spacing': [logLevel],
|
111
|
+
// reference to this https://stackoverflow.com/questions/56337176/prettier-and-eslint-indents-not-working-together
|
112
|
+
// when using prettier, we should disable eslint's indent rule
|
111
113
|
indent: ['off', 2, { SwitchCase: 1 }],
|
112
114
|
'jsx-quotes': [logLevel, 'prefer-single'],
|
113
115
|
'key-spacing': [logLevel],
|
@@ -140,8 +142,6 @@ let commonConfigs = {
|
|
140
142
|
'prefer-template': [logLevel],
|
141
143
|
'prefer-rest-params': [logLevel],
|
142
144
|
'no-useless-constructor': [logLevel],
|
143
|
-
'no-duplicate-imports': [logLevel],
|
144
|
-
'array-callback-return': [logLevel],
|
145
145
|
'no-use-before-define': [logLevel],
|
146
146
|
|
147
147
|
'react/default-props-match-prop-types': [logLevel],
|
@@ -152,7 +152,6 @@ let commonConfigs = {
|
|
152
152
|
'react/no-this-in-sfc': [logLevel],
|
153
153
|
'react/no-will-update-set-state': [logLevel],
|
154
154
|
'react/no-unused-state': [logLevel],
|
155
|
-
'react/no-will-update-set-state': [logLevel],
|
156
155
|
// 'react/require-default-props': [logLevel],
|
157
156
|
// 'react/require-optimization': [logLevel],
|
158
157
|
|
@@ -171,9 +170,6 @@ let commonConfigs = {
|
|
171
170
|
'react/jsx-no-duplicate-props': [logLevel],
|
172
171
|
'react/no-deprecated': [logLevel],
|
173
172
|
'react/no-children-prop': [logLevel],
|
174
|
-
'react/no-unused-state': [logLevel],
|
175
|
-
'react/destructuring-assignment': [logLevel],
|
176
|
-
'react/default-props-match-prop-types': [logLevel],
|
177
173
|
|
178
174
|
'css-modules/no-unused-class': [logLevel, { camelCase: true }],
|
179
175
|
'css-modules/no-undef-class': [logLevel, { camelCase: 'only' }]
|
package/README.md
CHANGED
@@ -2,6 +2,29 @@
|
|
2
2
|
|
3
3
|
A CLI tool for build modern web application and libraries
|
4
4
|
|
5
|
+
# 0.0.1-beta.164
|
6
|
+
|
7
|
+
- typo fix
|
8
|
+
|
9
|
+
# 0.0.1-beta.163
|
10
|
+
|
11
|
+
- **Issue Fix:-**
|
12
|
+
|
13
|
+
- if git not installed react-cli throws error for any command due to `getCurrentBranch` in `shemas/index.js` now fixed
|
14
|
+
- jest test cases not runnig issue fix (typo moduleNameMapper => libAlias)
|
15
|
+
|
16
|
+
- **Features :-**
|
17
|
+
- feature added for pre process logic
|
18
|
+
- tailer made requirement for preprocess, just write node js file
|
19
|
+
- mention file in `"react-cli" => "preprocess" => "runner"`
|
20
|
+
- option parse logic added for react-cli (exprimental)
|
21
|
+
- `--stop_nodemon` usally preprocessor run in `nodemon` so to stop it this option is provided
|
22
|
+
|
23
|
+
# 0.0.1-exp.162.3
|
24
|
+
|
25
|
+
- **Optimazation:-**
|
26
|
+
- Split chunks Optimization check
|
27
|
+
|
5
28
|
# 0.0.1-exp.162.2
|
6
29
|
|
7
30
|
- **Optimazation:-**
|
@@ -20,6 +43,10 @@ A CLI tool for build modern web application and libraries
|
|
20
43
|
- mention file in `"react-cli" => "preprocess" => "runner"`
|
21
44
|
- option parse logic added for react-cli (exprimental)
|
22
45
|
|
46
|
+
# 0.0.1-beta.162
|
47
|
+
|
48
|
+
- @zohodesk/datetimejs package updated to beta.8
|
49
|
+
|
23
50
|
# 0.0.1-beta.161
|
24
51
|
|
25
52
|
- **Features :-**
|
@@ -51,7 +78,7 @@ A CLI tool for build modern web application and libraries
|
|
51
78
|
- feature added for efc `cdnStatement`
|
52
79
|
- Issue fixes:-
|
53
80
|
- css classname hash change issue fix
|
54
|
-
- debug package conflit issue fix in nock in (react-cli test)
|
81
|
+
- debug package conflit issue fix in nock in (react-cli test)
|
55
82
|
- manifest.json css file name correction issue for rtl and ltr
|
56
83
|
|
57
84
|
# 0.0.1-beta.160
|
package/bin/cli.js
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
const path = require('path');
|
4
|
+
const os = require('os');
|
5
|
+
const { existsSync } = require('fs');
|
6
|
+
const { spawnSync, spawn } = require('child_process');
|
7
|
+
const { getOptions } = require('../lib/utils/index.js');
|
7
8
|
|
8
|
-
|
9
|
+
const { log } = require('../lib/utils');
|
9
10
|
//initPreCommitHook();
|
10
11
|
|
11
|
-
|
12
|
+
const options = getOptions();
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
const { esLint: esLintOptions } = options || {};
|
15
|
+
const { preprocess } = options;
|
16
|
+
const {
|
15
17
|
ignoreFilePaths: esLintIgnorePaths,
|
16
18
|
fix: esLintFix,
|
17
19
|
isCI: isCI,
|
18
20
|
reportPath: reportPath
|
19
21
|
} = esLintOptions || {};
|
20
22
|
|
21
|
-
|
23
|
+
const isWindows = os.platform().toLowerCase() === 'win32';
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
const [, , option] = process.argv;
|
26
|
+
const args = process.argv.slice(3);
|
27
|
+
const appPath = process.cwd();
|
26
28
|
|
27
29
|
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
28
30
|
|
@@ -35,28 +37,23 @@ function getCliPath(libName) {
|
|
35
37
|
return _getCliPath(libName) + suffixExt;
|
36
38
|
}
|
37
39
|
|
38
|
-
|
40
|
+
const webpack = getCliPath('webpack');
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
const nodemon = getCliPath('nodemon');
|
43
|
+
const babel = getCliPath('babel');
|
44
|
+
const propertyToJson = getCliPath('propertyToJson');
|
45
|
+
const esLint = getCliPath('eslint');
|
44
46
|
|
45
|
-
|
46
|
-
? path.join(process.cwd(),
|
47
|
+
const preprocesserPath = preprocess.runner
|
48
|
+
? path.join(process.cwd(), preprocess.runner)
|
47
49
|
: '';
|
48
|
-
|
49
|
-
|
50
|
-
// 'options.app.preprocessor',
|
51
|
-
// options.preprocessor.runner,
|
52
|
-
// preprocesserPath
|
53
|
-
// );
|
54
|
-
if (preprocesserPath) {
|
50
|
+
const preprocessCli = preprocess.stopNodemon ? 'node' : nodemon;
|
51
|
+
if (preprocesserPath && existsSync(preprocesserPath)) {
|
55
52
|
// eslint-disable-next-line default-case
|
56
53
|
switch (option) {
|
57
54
|
case 'start':
|
58
55
|
case 'docs':
|
59
|
-
spawn(
|
56
|
+
spawn(preprocessCli, [preprocesserPath], {
|
60
57
|
stdio: 'inherit',
|
61
58
|
cwd: preprocesserPath.slice(0, preprocesserPath.lastIndexOf('/') + 1)
|
62
59
|
});
|
@@ -79,14 +76,14 @@ if (preprocesserPath) {
|
|
79
76
|
let result;
|
80
77
|
switch (option) {
|
81
78
|
case 'preprocessor':
|
82
|
-
if (preprocesserPath) {
|
83
|
-
result = spawnSync(
|
79
|
+
if (preprocesserPath && existsSync(preprocesserPath)) {
|
80
|
+
result = spawnSync(preprocessCli, [preprocesserPath], {
|
84
81
|
stdio: 'inherit',
|
85
82
|
cwd: preprocesserPath.slice(0, preprocesserPath.lastIndexOf('/') + 1)
|
86
83
|
});
|
87
84
|
process.exit(result.status);
|
88
85
|
} else {
|
89
|
-
console.error(
|
86
|
+
console.error(`preProcessor not exists ${preprocesserPath}`);
|
90
87
|
}
|
91
88
|
break;
|
92
89
|
case 'lint-setup': {
|
@@ -200,10 +197,11 @@ switch (option) {
|
|
200
197
|
break;
|
201
198
|
|
202
199
|
case 'clean':
|
203
|
-
args = args.map(arg => path.join(appPath, arg));
|
204
200
|
result = spawnSync(
|
205
201
|
'node',
|
206
|
-
[require.resolve('../lib/utils/clean')].concat(
|
202
|
+
[require.resolve('../lib/utils/clean')].concat(
|
203
|
+
args.map(arg => path.join(appPath, arg))
|
204
|
+
),
|
207
205
|
{ stdio: 'inherit' }
|
208
206
|
);
|
209
207
|
process.exit(result.status);
|
@@ -263,10 +261,10 @@ switch (option) {
|
|
263
261
|
result = spawnSync(
|
264
262
|
webpack,
|
265
263
|
[
|
264
|
+
// '--progress',
|
265
|
+
// '--profile',
|
266
266
|
'--config',
|
267
267
|
require.resolve('../lib/configs/webpack.prod.config.js'),
|
268
|
-
'--progress',
|
269
|
-
'--profile'
|
270
268
|
].concat(args),
|
271
269
|
{ stdio: 'inherit' }
|
272
270
|
);
|
@@ -39,22 +39,75 @@ let isReact = module => {
|
|
39
39
|
} = module;
|
40
40
|
let reactBundle = ['react', 'react-dom'];
|
41
41
|
return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
|
42
|
-
};
|
42
|
+
}; // let defaultChunks = {
|
43
|
+
// 'react.vendor': {
|
44
|
+
// name: 'react.vendor',
|
45
|
+
// chunks: 'all',
|
46
|
+
// minChunks: 1,
|
47
|
+
// test: isReact,
|
48
|
+
// priority: -10
|
49
|
+
// },
|
50
|
+
// vendor: {
|
51
|
+
// name: 'vendor',
|
52
|
+
// chunks: 'all',
|
53
|
+
// minChunks: 1,
|
54
|
+
// test: isVendor,
|
55
|
+
// priority: -10
|
56
|
+
// },
|
57
|
+
// zohocharts: {
|
58
|
+
// chunks: 'all',
|
59
|
+
// minChunks: 1,
|
60
|
+
// test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
|
61
|
+
// priority: 30,
|
62
|
+
// enforce: true
|
63
|
+
// }
|
64
|
+
// };
|
65
|
+
|
43
66
|
|
44
67
|
let defaultChunks = {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
68
|
+
vendors: {
|
69
|
+
// picks up everything from node_modules as long as the sum of node modules is larger than minSize
|
70
|
+
//test: /[\\/]node_modules[\\/]((?!react).*)[\\/]/,
|
71
|
+
test: isVendor,
|
72
|
+
name: 'vendors',
|
73
|
+
priority: 19,
|
74
|
+
enforce: true,
|
75
|
+
// causes maxInitialRequests to be ignored, minSize still respected if specified in cacheGroup
|
76
|
+
minSize: 30000 // use the default minSize
|
77
|
+
|
78
|
+
},
|
79
|
+
vendorsAsync: {
|
80
|
+
// vendors async chunk, remaining asynchronously used node modules as single chunk file
|
81
|
+
test: /[\\/]node_modules[\\/]((?!react).*)[\\/]/,
|
82
|
+
name: 'vendors.async',
|
83
|
+
chunks: 'async',
|
84
|
+
priority: 9,
|
85
|
+
reuseExistingChunk: true,
|
86
|
+
minSize: 10000 // use smaller minSize to avoid too much potential bundle bloat due to module duplication.
|
87
|
+
|
88
|
+
},
|
89
|
+
react: {
|
90
|
+
automaticNamePrefix: 'react',
|
91
|
+
test: /[\\/]node_modules[\\/]((react).*)[\\/]/,
|
50
92
|
priority: -10
|
51
93
|
},
|
52
|
-
|
53
|
-
|
94
|
+
commonsAsync: {
|
95
|
+
// commons async chunk, remaining asynchronously used modules as single chunk file
|
96
|
+
name: 'commons.async',
|
97
|
+
minChunks: 2,
|
98
|
+
// Minimum number of chunks that must share a module before splitting
|
99
|
+
chunks: 'async',
|
100
|
+
priority: -10,
|
101
|
+
reuseExistingChunk: true,
|
102
|
+
//minSize: 10000 // use smaller minSize to avoid too much potential bundle bloat due to module duplication.
|
103
|
+
minSize: 5000
|
104
|
+
},
|
105
|
+
zohocharts: {
|
54
106
|
chunks: 'all',
|
55
107
|
minChunks: 1,
|
56
|
-
test:
|
57
|
-
priority:
|
108
|
+
test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
|
109
|
+
priority: 30,
|
110
|
+
enforce: true
|
58
111
|
}
|
59
112
|
};
|
60
113
|
let customChunksConfig = {};
|
@@ -57,9 +57,9 @@ module.exports = {
|
|
57
57
|
entry: (0, _common.getEntries)(options, 'dev'),
|
58
58
|
devtool: sourcemap,
|
59
59
|
mode: 'development',
|
60
|
-
watchOptions: {
|
61
|
-
|
62
|
-
},
|
60
|
+
// watchOptions: {
|
61
|
+
// ignored: /node_modules.(?!@zohodesk)/
|
62
|
+
// },
|
63
63
|
output,
|
64
64
|
stats: options.app.disableWatch ? 'errors-only' : {
|
65
65
|
children: false
|
@@ -12,10 +12,9 @@ var _loaderUtils = require("../loaderUtils");
|
|
12
12
|
|
13
13
|
var _libAlias = require("./libAlias");
|
14
14
|
|
15
|
-
var _terserWebpackPlugin = _interopRequireDefault(require("terser-webpack-plugin"));
|
16
|
-
|
17
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
16
|
|
17
|
+
// import TerserPlugin from 'terser-webpack-plugin';
|
19
18
|
let options = (0, _utils.getOptions)();
|
20
19
|
let {
|
21
20
|
app: {
|
@@ -68,10 +67,6 @@ if (isDevelopment) {
|
|
68
67
|
}
|
69
68
|
|
70
69
|
let shouldRemovePropTypes = !isDevelopment && removePropTypes;
|
71
|
-
const useEsbulid = false; // const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
|
72
|
-
// const smp = new SpeedMeasurePlugin();
|
73
|
-
// module.exports = smp.wrap({
|
74
|
-
|
75
70
|
module.exports = {
|
76
71
|
entry: (0, _common.getEntries)(options, 'production'),
|
77
72
|
devtool: isDevelopment ? 'cheap-module-source-map' : enableSMap ? 'hidden-source-map' : 'none',
|
@@ -86,18 +81,21 @@ module.exports = {
|
|
86
81
|
minimize: true,
|
87
82
|
// by default if minimize: true in webpack minimize then webpack automaticaly add TerserPlugin,
|
88
83
|
// So we are overrideing it.
|
89
|
-
minimizer: [
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
84
|
+
// minimizer: [
|
85
|
+
// new TerserPlugin({
|
86
|
+
// cache: true,
|
87
|
+
// parallel: true,
|
88
|
+
// sourceMap: isDevelopment && enableSMap,
|
89
|
+
// exclude: /\/smap/
|
90
|
+
// })
|
91
|
+
// ],
|
95
92
|
moduleIds: 'named'
|
96
93
|
},
|
97
94
|
stats: {
|
98
95
|
children: false,
|
99
96
|
colors: true,
|
100
|
-
excludeAssets:
|
97
|
+
// excludeAssets: /i18n/,
|
98
|
+
// excludeAssets: /./,
|
101
99
|
warningsFilter: /\[mini-css-extract-plugin\]/
|
102
100
|
},
|
103
101
|
plugins: (0, _pluginUtils.getProdPlugins)(options, output.publicPath),
|
@@ -106,15 +104,7 @@ module.exports = {
|
|
106
104
|
strictExportPresence: true,
|
107
105
|
rules: [{
|
108
106
|
test: /\.js$/,
|
109
|
-
use: [
|
110
|
-
loader: 'esbuild-loader',
|
111
|
-
options: {
|
112
|
-
loader: 'jsx',
|
113
|
-
// Remove this if you're not using JSX
|
114
|
-
target: 'es2015' // Syntax to compile to (see options below for possible values)
|
115
|
-
|
116
|
-
}
|
117
|
-
}, !useEsbulid && {
|
107
|
+
use: [{
|
118
108
|
loader: 'babel-loader',
|
119
109
|
options: {
|
120
110
|
presets: [[require.resolve('@babel/preset-env'), disableES5Transpile ? {
|
@@ -35,10 +35,7 @@ var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
|
35
35
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
37
|
|
38
|
-
// import { ESBuildMinifyPlugin } from 'esbuild-loader';
|
39
|
-
const useEsbulid = false; // console.log('build is runnnig');
|
40
38
|
// eslint-disable-next-line no-unused-vars
|
41
|
-
|
42
39
|
let getProdPlugins = (options, publicPath = '') => {
|
43
40
|
let {
|
44
41
|
enableChunkHash,
|
@@ -97,7 +94,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
97
94
|
// ignoreOrder: true,
|
98
95
|
filename: cssLTRFileNameTempalte,
|
99
96
|
chunkFilename: cssLTRFileNameTempalte
|
100
|
-
}), new _plugins.ResourceHintsPlugin(),
|
97
|
+
}), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
|
101
98
|
|
102
99
|
if (enableRTLSplit) {
|
103
100
|
plugins.push(new _RtlCssPlugin.RtlCssPlugin({
|
@@ -226,11 +223,8 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
226
223
|
hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
|
227
224
|
|
228
225
|
if (!isDevelopment) {
|
229
|
-
enableSMap && enableSMapHook && plugins.push(new _plugins.SourceMapHookPlugin());
|
230
|
-
|
231
|
-
// plugins.push(
|
232
|
-
// );
|
233
|
-
|
226
|
+
enableSMap && enableSMapHook && plugins.push(new _plugins.SourceMapHookPlugin());
|
227
|
+
optimize && plugins.push(new _plugins.OptimizeJSPlugin());
|
234
228
|
plugins.push(new _plugins.ManifestPlugin({
|
235
229
|
fileName: manifestFileName
|
236
230
|
}));
|
package/lib/schemas/index.js
CHANGED
@@ -18,10 +18,16 @@ var _default = {
|
|
18
18
|
value: null,
|
19
19
|
cli: 'ssl_cert_url'
|
20
20
|
},
|
21
|
-
|
21
|
+
preprocess: {
|
22
|
+
// This option is for tell the react-cli which in preprocessor js file path
|
22
23
|
runner: {
|
23
24
|
value: '',
|
24
25
|
cli: 'preprocessor'
|
26
|
+
},
|
27
|
+
// usally preprocessor run in nodemon for, start and docs , preprocessor
|
28
|
+
stopNodemon: {
|
29
|
+
value: false,
|
30
|
+
cli: 'stop_nodemon'
|
25
31
|
}
|
26
32
|
},
|
27
33
|
i18n: {
|
package/lib/utils/getOptions.js
CHANGED
@@ -16,7 +16,7 @@ var _schemas = _interopRequireDefault(require("../schemas"));
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
|
18
18
|
// import { argv } from 'process';
|
19
|
-
|
19
|
+
const args = process.argv.slice(2); // console.log('argv', argv);
|
20
20
|
|
21
21
|
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
22
22
|
// if user use react-cli stritly without using npm scripts options won't work,
|
@@ -62,13 +62,14 @@ function getCWD() {
|
|
62
62
|
try {
|
63
63
|
let ress = (0, _child_process.execSync)('npm bin').toString();
|
64
64
|
let i = ress.lastIndexOf('node_modules');
|
65
|
-
cwd = i === -1 ? cwd : ress.slice(0,
|
65
|
+
cwd = i === -1 ? cwd : ress.slice(0, i);
|
66
66
|
} catch (error) {
|
67
67
|
console.log(error);
|
68
68
|
}
|
69
69
|
|
70
70
|
return cwd;
|
71
|
-
}
|
71
|
+
} // experimental argumnet parsing logic
|
72
|
+
|
72
73
|
|
73
74
|
args.forEach(option => {
|
74
75
|
if (/^--./.test(option)) {
|
@@ -82,7 +83,7 @@ args.forEach(option => {
|
|
82
83
|
value = true;
|
83
84
|
}
|
84
85
|
|
85
|
-
key = key.replace(
|
86
|
+
key = key.replace(/-|:/g, '_');
|
86
87
|
processEnv[key] = value;
|
87
88
|
}
|
88
89
|
});
|
@@ -137,7 +138,8 @@ let getOptions = () => {
|
|
137
138
|
userSchemas = require(packagePath)['react-cli'] || {};
|
138
139
|
}
|
139
140
|
|
140
|
-
let options = defaulter(_schemas.default, userSchemas || {});
|
141
|
+
let options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
142
|
+
|
141
143
|
options.npmVersion = getNpmVersion();
|
142
144
|
options.cwd = getCWD();
|
143
145
|
options.packageVersion = process.env.npm_package_version;
|
package/lib/utils/jsonHelper.js
CHANGED
@@ -45,12 +45,21 @@ let fileHandler = {
|
|
45
45
|
};
|
46
46
|
exports.fileHandler = fileHandler;
|
47
47
|
|
48
|
+
const isObject = obj => obj && obj.constructor === {}.constructor;
|
49
|
+
|
50
|
+
const isArray = obj => obj && obj.constructor === [].constructor; // In below funtion
|
51
|
+
// this function is for concat two json object like _.extend,
|
52
|
+
// if botha array we concat them
|
53
|
+
// if both object we use call this function recurcively
|
54
|
+
// if both differend data type we will just assign it
|
55
|
+
|
56
|
+
|
48
57
|
let jsonConcate = (receiverObj, senterObj) => {
|
49
58
|
Object.keys(senterObj).map(key => {
|
50
59
|
if (Object.prototype.hasOwnProperty.call(receiverObj, key)) {
|
51
|
-
if (receiverObj[key]
|
60
|
+
if (isObject(receiverObj[key]) && isObject(senterObj[key])) {
|
52
61
|
jsonConcate(receiverObj[key], senterObj[key]);
|
53
|
-
} else if (receiverObj[key]
|
62
|
+
} else if (isArray(receiverObj[key]) && isArray(senterObj[key])) {
|
54
63
|
receiverObj[key] = receiverObj[key].concat(senterObj[key]);
|
55
64
|
} else {
|
56
65
|
receiverObj[key] = senterObj[key];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zohodesk/react-cli",
|
3
|
-
"version": "0.0.1-exp.162.
|
3
|
+
"version": "0.0.1-exp.162.3",
|
4
4
|
"description": "A CLI tool for build modern web application and libraries",
|
5
5
|
"scripts": {
|
6
6
|
"init": "node ./lib/utils/init.js",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"@babel/preset-env": "7.11.0",
|
36
36
|
"@babel/preset-react": "7.10.4",
|
37
37
|
"@babel/runtime": "7.11.2",
|
38
|
-
"@zohodesk/datetimejs": "1.0.0-beta.
|
38
|
+
"@zohodesk/datetimejs": "1.0.0-beta.8",
|
39
39
|
"@zohodesk/eslint-plugin-react-performance": "1.0.3",
|
40
40
|
"@zohodesk/eslint-plugin-zsecurity": "0.0.1-beta.4",
|
41
41
|
"@zohodesk/normalizer": "1.0.2",
|
@@ -56,7 +56,6 @@
|
|
56
56
|
"core-js": "3.6.5",
|
57
57
|
"css-loader": "4.2.1",
|
58
58
|
"debug": "4.3.3",
|
59
|
-
"esbuild-loader": "^2.18.0",
|
60
59
|
"escodegen": "2.0.0",
|
61
60
|
"eslint": "7.6.0",
|
62
61
|
"eslint-html-reporter": "0.7.4",
|
@@ -101,7 +100,7 @@
|
|
101
100
|
"react-redux": "7.2.1",
|
102
101
|
"react-router": "5.2.0",
|
103
102
|
"react-router-redux": "4.0.8",
|
104
|
-
"react-test-renderer": "
|
103
|
+
"react-test-renderer": "18.0.0-rc.0",
|
105
104
|
"react-transition-group": "2.7.1",
|
106
105
|
"redis": "3.0.2",
|
107
106
|
"redux": "4.0.5",
|
@@ -114,7 +113,6 @@
|
|
114
113
|
"script-loader": "0.7.2",
|
115
114
|
"selectn": "1.1.2",
|
116
115
|
"simple-normalizr": "1.2.5",
|
117
|
-
"terser-webpack-plugin": "^1.4.3",
|
118
116
|
"uglifycss": "0.0.29",
|
119
117
|
"url-loader": "4.1.0",
|
120
118
|
"velocity-react": "1.4.3",
|
@@ -142,8 +140,5 @@
|
|
142
140
|
],
|
143
141
|
"@babel/react"
|
144
142
|
]
|
145
|
-
},
|
146
|
-
"devDependencies": {
|
147
|
-
"speed-measure-webpack-plugin": "^1.5.0"
|
148
143
|
}
|
149
144
|
}
|
package/eslint/NOTES.md
DELETED
package/eslint/mockapi.html
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6
|
-
<title>mock api</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<h1>We are going to see how to use mock api</h1>
|
10
|
-
<ul>
|
11
|
-
<li>
|
12
|
-
Step 1:-
|
13
|
-
you need to start the app with "react-cli"."app"."server"."hasMock" as "true" in package.json
|
14
|
-
<code>npm run start --app-port=9090</code>
|
15
|
-
</li>
|
16
|
-
</ul>
|
17
|
-
</body>
|
18
|
-
</html>
|
package/eslint/mockapi.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# We are going to see how to use `Mock api`
|
2
|
-
|
3
|
-
- Step 1:-
|
4
|
-
you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` and **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>
|
5
|
-
- Step 2:- you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>
|