@zohodesk/react-cli 0.0.1-exp.161.3 → 0.0.1-exp.164.1
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 +3 -7
- package/README.md +120 -9
- package/bin/cli.js +67 -21
- package/eslint/NOTES.md +3 -0
- package/eslint/a23.c +16 -0
- package/eslint/a28.c +25 -0
- package/eslint/a29.c +25 -0
- package/eslint/a30.c +29 -0
- package/eslint/a31.c +23 -0
- package/eslint/a35.c +23 -0
- package/eslint/a36.c +18 -0
- package/eslint/a37.c +25 -0
- package/eslint/a38.c +28 -0
- package/eslint/a39.c +17 -0
- package/eslint/a40.c +32 -0
- package/eslint/mockapi.html +18 -0
- package/eslint/mockapi.md +5 -0
- package/lib/common/criteriaHandler.js +91 -0
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +54 -18
- package/lib/common/splitChunks1.js +95 -0
- package/lib/common/splitChunksNew.js +129 -0
- package/lib/common/testPattern.js +71 -0
- package/lib/configs/jest.config.js +12 -3
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.dev.config.js +6 -19
- package/lib/configs/webpack.prod.config.js +18 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/pluginUtils/getDevPlugins.js +2 -0
- package/lib/pluginUtils/getProdPlugins.js +2 -0
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/EFCPlugin.js +43 -13
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
- package/lib/plugins/ManifestPlugin.js +8 -0
- package/lib/plugins/index.js +36 -36
- package/lib/postcss-plugins/RTLSplitPlugin.js +1 -1
- package/lib/schemas/index.js +15 -0
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +1 -1
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getOptions.js +55 -1
- package/lib/utils/index.js +21 -19
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/npm8.md +9 -0
- package/package.json +4 -4
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.htmlTemplate = exports.endTag = void 0;
|
7
7
|
const htmlTemplate = '<!DOCTYPE html><html> <head> <title>Eslint Security Rule</title> <style type="text/css"> body{margin: 0; font: 93.75%/1.6 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;}body, html{width: 100%; height: 100%;}.pkCont{}.pkEmpty{height: 300px;display: flex;align-items: center;justify-content: center;font-size: 20px;}.pkUl{margin: 0; padding: 0; list-style-type: none;}.pkLi{}.pkRow{display: flex; padding: 12px 16px;}.pkArrowCont{cursor: pointer; width: 50px; display: flex; align-items: center; justify-content: center; background-color: #f4f5f5; border-radius: 4px;}.pkArrow{width: 1px; height: 1px; border: 5px solid; border-color: #000 transparent transparent; margin-top: 7px;}.pkDetailsOpen .pkArrow{margin: 0 0 7px; border-color: transparent transparent #000;}.pkFileName{font-weight: 600; margin: 0 8px;}.pkUrl{flex: 1; min-width: 0; min-height: 0; word-break: break-word; word-wrap: break-word; color: blue;}.pkDetails{margin-left: 66px; display: none;}.pkDetailsOpen .pkDetails{display: block;}.pkDetailsHead{font-weight: 600; display: flex; border: 1px solid #e5e5e5; padding: 3px 8px;}.pkDetailsBody{max-height: 400px; overflow: auto;}.pkDetailsRow{display: flex; padding: 10px 8px;}.pkDetailsRow:nth-child(even){background-color: #f4f5f5;}.pkDetailsCol{word-break: break-word; word-wrap: break-word;}.pkError{color: red;}.pkDetailsCol:nth-child(1){width: 10%;}.pkDetailsCol:nth-child(2){width: 10%;}.pkDetailsCol:nth-child(3){width: 40%;}.pkDetailsCol:nth-child(4){width: 40%;}</style> <script>function toggleWrapper(element){var classArray=element.parentElement.parentElement.className; if (classArray.includes("pkDetailsOpen")){element.parentElement.parentElement.className="pkLi";}else{element.parentElement.parentElement.className="pkLi pkDetailsOpen";}}</script> </head> <body> <div class="pkCont">';
|
8
8
|
exports.htmlTemplate = htmlTemplate;
|
9
9
|
const endTag = '</div></body></html>';
|
@@ -40,6 +40,13 @@ var _default = (unique = true, {
|
|
40
40
|
filenames,
|
41
41
|
packages
|
42
42
|
}, classNamePrefix) => (context, localIdentName, localName) => {
|
43
|
+
// NOTE: in build macine we use date as folder path.
|
44
|
+
// So every time we create new build there is path will alway different
|
45
|
+
// in order to minmaze that problem we try in relative path;
|
46
|
+
// console.log('context.resourcePath', context.resourcePath, context);
|
47
|
+
// let contextResourcePath = context.resourcePath;
|
48
|
+
let relativePath = _path.default.relative(context.rootContext, context.resourcePath);
|
49
|
+
|
43
50
|
if (context.resourcePath.endsWith('.plain.css')) {
|
44
51
|
return localName;
|
45
52
|
}
|
@@ -47,7 +54,7 @@ var _default = (unique = true, {
|
|
47
54
|
|
48
55
|
|
49
56
|
if (unique) {
|
50
|
-
let h = (0, _getHash.default)(
|
57
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
51
58
|
return `${classNamePrefix}${h}`;
|
52
59
|
}
|
53
60
|
/* old production mode end*/
|
@@ -60,7 +67,7 @@ var _default = (unique = true, {
|
|
60
67
|
//let local = localName.toLowerCase()
|
61
68
|
|
62
69
|
if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
|
63
|
-
let h = (0, _getHash.default)(
|
70
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
64
71
|
return `${classNamePrefix}${h}`;
|
65
72
|
}
|
66
73
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.getUrls = exports.getFileType = exports.cssUrlReplacer = void 0;
|
7
7
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
9
|
|
@@ -22,7 +22,7 @@ var _default = (type = 'git', cwd = process.cwd()) => {
|
|
22
22
|
});
|
23
23
|
}
|
24
24
|
|
25
|
-
let [currentBranch] = results.output.filter(d => d);
|
25
|
+
let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
|
26
26
|
return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
|
27
27
|
};
|
28
28
|
|
package/lib/utils/getOptions.js
CHANGED
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
+
var _child_process = require("child_process");
|
9
|
+
|
8
10
|
var _fs = _interopRequireDefault(require("fs"));
|
9
11
|
|
10
12
|
var _path = _interopRequireDefault(require("path"));
|
@@ -13,6 +15,9 @@ var _schemas = _interopRequireDefault(require("../schemas"));
|
|
13
15
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
17
|
|
18
|
+
// import { argv } from 'process';
|
19
|
+
const args = process.argv.slice(2); // console.log('argv', argv);
|
20
|
+
|
16
21
|
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
17
22
|
// if user use react-cli stritly without using npm scripts options won't work,
|
18
23
|
// So we have to write our own option parse logic or some other library
|
@@ -37,6 +42,52 @@ keysWithColon.forEach(key => {
|
|
37
42
|
processEnv[nkey] = processEnv[key];
|
38
43
|
});
|
39
44
|
|
45
|
+
function getNpmVersion() {
|
46
|
+
// require("child_process").
|
47
|
+
let vers = '6';
|
48
|
+
|
49
|
+
try {
|
50
|
+
[vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
|
51
|
+
} catch (error) {
|
52
|
+
console.log(error);
|
53
|
+
}
|
54
|
+
|
55
|
+
return vers;
|
56
|
+
}
|
57
|
+
|
58
|
+
function getCWD() {
|
59
|
+
// require("child_process").
|
60
|
+
let cwd = process.cwd();
|
61
|
+
|
62
|
+
try {
|
63
|
+
let ress = (0, _child_process.execSync)('npm bin').toString();
|
64
|
+
let i = ress.lastIndexOf('node_modules');
|
65
|
+
cwd = i === -1 ? cwd : ress.slice(0, i);
|
66
|
+
} catch (error) {
|
67
|
+
console.log(error);
|
68
|
+
}
|
69
|
+
|
70
|
+
return cwd;
|
71
|
+
} // experimental argumnet parsing logic
|
72
|
+
|
73
|
+
|
74
|
+
args.forEach(option => {
|
75
|
+
if (/^--./.test(option)) {
|
76
|
+
let equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
77
|
+
|
78
|
+
let key = option.slice(2, equIndex);
|
79
|
+
let value = option.slice(equIndex + 1);
|
80
|
+
|
81
|
+
if (equIndex === -1) {
|
82
|
+
key = option.slice(2);
|
83
|
+
value = true;
|
84
|
+
}
|
85
|
+
|
86
|
+
key = key.replace(/-|:/g, '_');
|
87
|
+
processEnv[key] = value;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
40
91
|
let defaulter = (target, source) => {
|
41
92
|
let defaultObject = {};
|
42
93
|
Object.keys(target).forEach(key => {
|
@@ -87,7 +138,10 @@ let getOptions = () => {
|
|
87
138
|
userSchemas = require(packagePath)['react-cli'] || {};
|
88
139
|
}
|
89
140
|
|
90
|
-
let options = defaulter(_schemas.default, userSchemas || {});
|
141
|
+
let options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
142
|
+
|
143
|
+
options.npmVersion = getNpmVersion();
|
144
|
+
options.cwd = getCWD();
|
91
145
|
options.packageVersion = process.env.npm_package_version;
|
92
146
|
global.reactCLIOptions = options;
|
93
147
|
return options;
|
package/lib/utils/index.js
CHANGED
@@ -21,22 +21,16 @@ var _exportNames = {
|
|
21
21
|
getComponents: true,
|
22
22
|
ssTestHack: true
|
23
23
|
};
|
24
|
-
Object.defineProperty(exports, "getOptions", {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () {
|
27
|
-
return _getOptions.default;
|
28
|
-
}
|
29
|
-
});
|
30
24
|
Object.defineProperty(exports, "createEventStream", {
|
31
25
|
enumerable: true,
|
32
26
|
get: function () {
|
33
27
|
return _createEventStream.default;
|
34
28
|
}
|
35
29
|
});
|
36
|
-
Object.defineProperty(exports, "
|
30
|
+
Object.defineProperty(exports, "getComponents", {
|
37
31
|
enumerable: true,
|
38
32
|
get: function () {
|
39
|
-
return
|
33
|
+
return _getComponents.default;
|
40
34
|
}
|
41
35
|
});
|
42
36
|
Object.defineProperty(exports, "getCurrentBranch", {
|
@@ -45,22 +39,23 @@ Object.defineProperty(exports, "getCurrentBranch", {
|
|
45
39
|
return _getCurrentBranch.default;
|
46
40
|
}
|
47
41
|
});
|
48
|
-
Object.defineProperty(exports, "
|
42
|
+
Object.defineProperty(exports, "getDependenciesImpactList", {
|
49
43
|
enumerable: true,
|
50
44
|
get: function () {
|
51
|
-
return
|
45
|
+
return _getDependenciesImpactList.default;
|
52
46
|
}
|
53
47
|
});
|
54
|
-
|
48
|
+
exports.getLibraryConflict = exports.getInfoFromPublicPaths = void 0;
|
49
|
+
Object.defineProperty(exports, "getOptions", {
|
55
50
|
enumerable: true,
|
56
51
|
get: function () {
|
57
|
-
return
|
52
|
+
return _getOptions.default;
|
58
53
|
}
|
59
54
|
});
|
60
|
-
Object.defineProperty(exports, "
|
55
|
+
Object.defineProperty(exports, "getServerURL", {
|
61
56
|
enumerable: true,
|
62
57
|
get: function () {
|
63
|
-
return
|
58
|
+
return _getServerURL.default;
|
64
59
|
}
|
65
60
|
});
|
66
61
|
Object.defineProperty(exports, "jsonHelper", {
|
@@ -69,16 +64,17 @@ Object.defineProperty(exports, "jsonHelper", {
|
|
69
64
|
return _jsonHelper.default;
|
70
65
|
}
|
71
66
|
});
|
72
|
-
|
67
|
+
exports.makeDir = exports.log = void 0;
|
68
|
+
Object.defineProperty(exports, "pullOrigin", {
|
73
69
|
enumerable: true,
|
74
70
|
get: function () {
|
75
|
-
return
|
71
|
+
return _pullOrigin.default;
|
76
72
|
}
|
77
73
|
});
|
78
|
-
Object.defineProperty(exports, "
|
74
|
+
Object.defineProperty(exports, "request", {
|
79
75
|
enumerable: true,
|
80
76
|
get: function () {
|
81
|
-
return
|
77
|
+
return _request.default;
|
82
78
|
}
|
83
79
|
});
|
84
80
|
Object.defineProperty(exports, "ssTestHack", {
|
@@ -87,7 +83,13 @@ Object.defineProperty(exports, "ssTestHack", {
|
|
87
83
|
return _ssTestHack.default;
|
88
84
|
}
|
89
85
|
});
|
90
|
-
|
86
|
+
Object.defineProperty(exports, "switchBranch", {
|
87
|
+
enumerable: true,
|
88
|
+
get: function () {
|
89
|
+
return _switchBranch.default;
|
90
|
+
}
|
91
|
+
});
|
92
|
+
exports.writeFile = void 0;
|
91
93
|
|
92
94
|
var _stream = require("stream");
|
93
95
|
|
package/lib/utils/jsonHelper.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.
|
6
|
+
exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.getRunnerDetail = exports.fileHandler = void 0;
|
7
7
|
|
8
8
|
let fs = require('fs');
|
9
9
|
|
@@ -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];
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.reinstallDependencies1 = exports.reinstallDependencies = exports.collectPackageDiff = void 0;
|
7
7
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
9
|
|
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.
|
3
|
+
"version": "0.0.1-exp.164.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",
|
@@ -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-
|
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",
|
@@ -55,6 +55,7 @@
|
|
55
55
|
"copy-webpack-plugin": "5.1.2",
|
56
56
|
"core-js": "3.6.5",
|
57
57
|
"css-loader": "4.2.1",
|
58
|
+
"debug": "4.3.3",
|
58
59
|
"escodegen": "2.0.0",
|
59
60
|
"eslint": "7.6.0",
|
60
61
|
"eslint-html-reporter": "0.7.4",
|
@@ -94,7 +95,6 @@
|
|
94
95
|
"postcss-selector-replace": "1.0.2",
|
95
96
|
"prop-types": "15.7.2",
|
96
97
|
"react": "16.13.1",
|
97
|
-
"react-dev-utils": "10.2.1",
|
98
98
|
"react-dom": "16.13.1",
|
99
99
|
"react-error-overlay": "6.0.7",
|
100
100
|
"react-redux": "7.2.1",
|
@@ -117,7 +117,7 @@
|
|
117
117
|
"url-loader": "4.1.0",
|
118
118
|
"velocity-react": "1.4.3",
|
119
119
|
"webpack": "4.44.1",
|
120
|
-
"webpack-bundle-analyzer": "
|
120
|
+
"webpack-bundle-analyzer": "4.5.0",
|
121
121
|
"webpack-cli": "3.3.12",
|
122
122
|
"webpack-core": "0.6.9",
|
123
123
|
"webpack-dev-middleware": "3.7.2",
|