@zohodesk/react-cli 1.1.14-exp.3 → 1.1.14-kubernetes
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +16 -281
- package/bin/cli.js +55 -30
- package/docs/CustomChunks.md +9 -12
- package/docs/SelectorWeight.md +0 -3
- package/docs/ValueReplacer.md +0 -27
- package/docs/VariableConversion.md +1 -6
- package/lib/common/splitChunks.js +45 -65
- package/lib/common/testPattern.js +11 -9
- package/lib/common/valueReplacer.js +3 -1
- package/lib/configs/resolvers.js +5 -16
- package/lib/configs/webpack.css.umd.config.js +2 -3
- package/lib/configs/webpack.dev.config.js +5 -15
- package/lib/configs/webpack.docs.config.js +3 -14
- package/lib/configs/webpack.impact.config.js +2 -8
- package/lib/configs/webpack.prod.config.js +5 -15
- package/lib/constants.js +3 -3
- package/lib/loaderUtils/getCSSLoaders.js +49 -98
- package/lib/loaderUtils/windowsModification.js +1 -6
- package/lib/loaders/docsLoader.js +7 -18
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/pluginUtils/getDevPlugins.js +6 -25
- package/lib/pluginUtils/getProdPlugins.js +5 -32
- package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
- package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
- package/lib/plugins/EFCPlugin.js +9 -9
- package/lib/plugins/EFCTemplatePlugin.js +12 -10
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +9 -8
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +3 -2
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +13 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +7 -2
- package/lib/plugins/I18nSplitPlugin/index.js +1 -1
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/ReportGeneratePlugin.js +6 -8
- package/lib/plugins/ResourceHintsPlugin.js +3 -13
- package/lib/plugins/SelectorPlugin.js +37 -77
- package/lib/plugins/{MinifyPlugin.js → UglifyCSSPlugin.js} +3 -3
- package/lib/plugins/UnusedFilesFindPlugin.js +5 -7
- package/lib/plugins/VariableConversionCollector.js +101 -40
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +7 -7
- package/lib/postcss-plugins/ExcludePlugin.js +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +10 -4
- package/lib/postcss-plugins/ValueReplacer.js +29 -8
- package/lib/postcss-plugins/hoverActivePlugin.js +6 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +1 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +38 -94
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +18 -94
- package/lib/servers/devBuild.js +11 -13
- package/lib/servers/getCliPath.js +5 -3
- package/lib/servers/httpsOptions.js +13 -12
- package/lib/servers/nowatchserver.js +55 -62
- package/lib/servers/server.js +52 -53
- package/lib/utils/cssClassNameGenerate.js +13 -70
- package/lib/utils/getOptions.js +28 -35
- package/lib/utils/getServerURL.js +9 -1
- package/lib/utils/index.js +12 -14
- package/lib/utils/initPreCommitHook.js +5 -5
- package/lib/utils/pullOrigin.js +3 -3
- package/lib/utils/reinstallDependencies.js +3 -3
- package/lib/utils/switchBranch.js +2 -4
- package/package.json +3 -5
- package/templates/docs/all.html +0 -1
- package/templates/docs/component.html +0 -1
- package/templates/docs/components.html +0 -1
- package/templates/docs/css/style.css +169 -136
- package/templates/docs/index.html +632 -796
- package/.vscode/settings.json +0 -25
- package/docs/ComposeMinification.md +0 -13
- package/docs/MarkdownParser.md +0 -18
- package/docs/ReactLive.md +0 -14
- package/docs/patternFiltering.md +0 -57
- package/lib/common/buildEs.js +0 -12
- package/lib/common/runPreProcess.js +0 -71
- package/lib/deprecationLogger.js +0 -40
- package/lib/loaderUtils/tests/windowsModification.test.js +0 -10
- package/lib/loaders/__test__/markdownLoader.spec.js +0 -145
- package/lib/loaders/composeLoader.js +0 -298
- package/lib/loaders/markdownLoader.js +0 -71
- package/lib/loaders/reactLiveConvertor.js +0 -105
- package/lib/logger.js +0 -27
- package/lib/plugins/CustomAttributePlugin.js +0 -82
- package/lib/plugins/CustomAttributePlugin.md +0 -35
- package/lib/plugins/EfcResourceCleanupPlugin.js +0 -43
- package/lib/plugins/StatsPlugin.js +0 -82
- package/lib/plugins/utils/classHandling.js +0 -35
- package/lib/plugins/utils/fileHandling.js +0 -92
- package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
- package/lib/plugins/variableConvertorUtils.js +0 -133
- package/lib/postcss-plugins/EmptyPlugin.js +0 -8
- package/lib/postcss-plugins/IncludePlugin.js +0 -23
- package/lib/postcss-plugins/SelectorReplace.js +0 -80
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +0 -28
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +0 -43
- package/lib/servers/requireLocalOrGlobal.js +0 -61
- package/lib/utils/deprecationSupport.js +0 -134
- package/lib/utils/log.js +0 -11
- package/lib/utils/object-manipulation.js +0 -88
- package/lib/utils/selectorReplacer.js +0 -47
- package/lib/utils/variableConverter.js +0 -104
- package/npm-shrinkwrap.json +0 -33485
- package/templates/docs/css/markdown.css +0 -202
@@ -16,8 +16,6 @@ var _httpsOptions = require("./httpsOptions");
|
|
16
16
|
|
17
17
|
var _devBuild = require("./devBuild");
|
18
18
|
|
19
|
-
var _logger = require("../logger");
|
20
|
-
|
21
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22
20
|
|
23
21
|
// import webpack from 'webpack';
|
@@ -88,41 +86,38 @@ app.use('/wms/*', (req, res) => {
|
|
88
86
|
|
89
87
|
const httpsServer = _https.default.createServer(httpsOptions, app);
|
90
88
|
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
const wss = new _ws.default.Server({
|
90
|
+
server: httpsServer
|
91
|
+
});
|
92
|
+
let wsPool = [];
|
93
|
+
wss.on('connection', ws => {
|
94
|
+
wsPool.push(ws);
|
95
|
+
ws.on('close', () => {
|
96
|
+
wsPool = wsPool.filter(ws1 => ws1 !== ws);
|
94
97
|
});
|
95
|
-
|
96
|
-
|
97
|
-
wsPool.push(ws);
|
98
|
-
ws.on('close', () => {
|
99
|
-
wsPool = wsPool.filter(ws1 => ws1 !== ws);
|
100
|
-
});
|
101
|
-
ws.on('message', message => {
|
102
|
-
(0, _utils.log)('received: %s', message);
|
103
|
-
});
|
104
|
-
ws.send('something');
|
98
|
+
ws.on('message', message => {
|
99
|
+
(0, _utils.log)('received: %s', message);
|
105
100
|
});
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
101
|
+
ws.send('something');
|
102
|
+
});
|
103
|
+
app.post('/wmsmockapi', (req, res) => {
|
104
|
+
wsPool.forEach(ws => {
|
105
|
+
const {
|
106
|
+
body
|
107
|
+
} = req;
|
108
|
+
|
109
|
+
try {
|
110
|
+
ws.send(JSON.stringify(body));
|
111
|
+
} catch (e) {
|
112
|
+
(0, _utils.log)(e, body);
|
113
|
+
}
|
119
114
|
});
|
120
|
-
|
115
|
+
res.send('success');
|
116
|
+
}); // let webpackCompilation;
|
121
117
|
// compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
|
122
118
|
// webpackCompilation = compilation;
|
123
119
|
// });
|
124
120
|
|
125
|
-
|
126
121
|
if (zipname) {
|
127
122
|
app.use(`/zips/${zipname}.zip`, (req, res) => {
|
128
123
|
res.download(_path.default.join(process.cwd(), cssSelectorZipPath), err => {
|
@@ -130,7 +125,7 @@ if (zipname) {
|
|
130
125
|
throw err;
|
131
126
|
}
|
132
127
|
|
133
|
-
|
128
|
+
console.log(`${zipname}.zip downloaded`);
|
134
129
|
});
|
135
130
|
});
|
136
131
|
app.use('/zips/build.zip', (req, res) => {
|
@@ -139,7 +134,7 @@ if (zipname) {
|
|
139
134
|
throw err;
|
140
135
|
}
|
141
136
|
|
142
|
-
|
137
|
+
console.log('build.zip downloaded');
|
143
138
|
});
|
144
139
|
});
|
145
140
|
}
|
@@ -156,42 +151,40 @@ if (contextURL) {
|
|
156
151
|
app.use('/*', _express.default.static(context));
|
157
152
|
}
|
158
153
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
}
|
154
|
+
httpsServer.listen(port, err => {
|
155
|
+
if (err) {
|
156
|
+
throw err;
|
157
|
+
}
|
164
158
|
|
165
|
-
|
166
|
-
|
159
|
+
(0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
|
160
|
+
});
|
167
161
|
|
168
|
-
|
169
|
-
|
162
|
+
if (isCompatableHttp2) {
|
163
|
+
const http2 = require('http2');
|
170
164
|
|
171
|
-
|
165
|
+
const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
|
172
166
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
});
|
178
|
-
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
167
|
+
http2Server.on('stream', (stream, headers) => {
|
168
|
+
stream.respond({
|
169
|
+
'content-type': 'text/html',
|
170
|
+
':status': 200
|
179
171
|
});
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
172
|
+
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
173
|
+
});
|
174
|
+
const http2Port = Number(port) + 1;
|
175
|
+
http2Server.listen(http2Port, err => {
|
176
|
+
if (err) {
|
177
|
+
throw err;
|
178
|
+
}
|
185
179
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
}
|
180
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
181
|
+
host,
|
182
|
+
domain,
|
183
|
+
port: http2Port
|
184
|
+
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
185
|
+
});
|
186
|
+
} else {
|
187
|
+
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
195
188
|
}
|
196
189
|
|
197
190
|
const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
|
package/lib/servers/server.js
CHANGED
@@ -70,7 +70,8 @@ if (mode === 'prod') {
|
|
70
70
|
config = require('../configs/webpack.dev.config');
|
71
71
|
} else {
|
72
72
|
throw new Error('You must configure valid option in mode');
|
73
|
-
}
|
73
|
+
} // console.log({ contextURL });
|
74
|
+
|
74
75
|
|
75
76
|
const compiler = (0, _webpack.default)(config);
|
76
77
|
const webpackServerOptions = {
|
@@ -100,6 +101,7 @@ app.use((0, _HMRMiddleware.default)(compiler, {
|
|
100
101
|
path: '/sockjs-node/info'
|
101
102
|
}));
|
102
103
|
app.use((req, res, next) => {
|
104
|
+
//console.log('origin', req.get('origin'));
|
103
105
|
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
|
104
106
|
|
105
107
|
res.setHeader('Access-Control-Allow-Private-Network', true);
|
@@ -115,37 +117,34 @@ app.use('/wms/*', (req, res) => {
|
|
115
117
|
|
116
118
|
const httpsServer = _https.default.createServer(httpsOptions, app);
|
117
119
|
|
118
|
-
|
119
|
-
|
120
|
-
|
120
|
+
const wss = new _ws.default.Server({
|
121
|
+
server: httpsServer
|
122
|
+
});
|
123
|
+
let wsPool = [];
|
124
|
+
wss.on('connection', ws => {
|
125
|
+
wsPool.push(ws);
|
126
|
+
ws.on('close', () => {
|
127
|
+
wsPool = wsPool.filter(ws1 => ws1 !== ws);
|
121
128
|
});
|
122
|
-
|
123
|
-
|
124
|
-
wsPool.push(ws);
|
125
|
-
ws.on('close', () => {
|
126
|
-
wsPool = wsPool.filter(ws1 => ws1 !== ws);
|
127
|
-
});
|
128
|
-
ws.on('message', message => {
|
129
|
-
(0, _utils.log)('received: %s', message);
|
130
|
-
});
|
131
|
-
ws.send('something');
|
129
|
+
ws.on('message', message => {
|
130
|
+
(0, _utils.log)('received: %s', message);
|
132
131
|
});
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
132
|
+
ws.send('something');
|
133
|
+
});
|
134
|
+
app.post('/wmsmockapi', (req, res) => {
|
135
|
+
wsPool.forEach(ws => {
|
136
|
+
const {
|
137
|
+
body
|
138
|
+
} = req;
|
139
|
+
|
140
|
+
try {
|
141
|
+
ws.send(JSON.stringify(body));
|
142
|
+
} catch (e) {
|
143
|
+
(0, _utils.log)(e, body);
|
144
|
+
}
|
146
145
|
});
|
147
|
-
|
148
|
-
|
146
|
+
res.send('success');
|
147
|
+
});
|
149
148
|
let webpackCompilation;
|
150
149
|
let initalHTML;
|
151
150
|
compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
|
@@ -177,34 +176,34 @@ if (httpsOptions) {
|
|
177
176
|
|
178
177
|
(0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
|
179
178
|
});
|
179
|
+
}
|
180
180
|
|
181
|
-
|
182
|
-
|
181
|
+
if (isCompatableHttp2 && httpsOptions) {
|
182
|
+
const http2 = require('http2');
|
183
183
|
|
184
|
-
|
184
|
+
const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
|
185
185
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
});
|
191
|
-
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
192
|
-
});
|
193
|
-
const http2Port = Number(port) + 1;
|
194
|
-
http2Server.listen(http2Port, err => {
|
195
|
-
if (err) {
|
196
|
-
throw err;
|
197
|
-
}
|
198
|
-
|
199
|
-
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
200
|
-
host,
|
201
|
-
domain,
|
202
|
-
port: http2Port
|
203
|
-
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
186
|
+
http2Server.on('stream', (stream, headers) => {
|
187
|
+
stream.respond({
|
188
|
+
'content-type': 'text/html',
|
189
|
+
':status': 200
|
204
190
|
});
|
205
|
-
|
206
|
-
|
207
|
-
|
191
|
+
stream.end('<h1>Hello World! <br>Working with http2</h1>');
|
192
|
+
});
|
193
|
+
const http2Port = Number(port) + 1;
|
194
|
+
http2Server.listen(http2Port, err => {
|
195
|
+
if (err) {
|
196
|
+
throw err;
|
197
|
+
}
|
198
|
+
|
199
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
200
|
+
host,
|
201
|
+
domain,
|
202
|
+
port: http2Port
|
203
|
+
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
204
|
+
});
|
205
|
+
} else {
|
206
|
+
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
208
207
|
}
|
209
208
|
|
210
209
|
const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
|
@@ -9,15 +9,13 @@ var _os = _interopRequireDefault(require("os"));
|
|
9
9
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
11
11
|
|
12
|
-
var _fileHandling = require("../plugins/utils/fileHandling");
|
13
|
-
|
14
12
|
var _getHash = _interopRequireDefault(require("./getHash"));
|
15
13
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
15
|
|
18
|
-
|
16
|
+
let isWindows = _os.default.platform().toLowerCase() === 'win32';
|
19
17
|
|
20
|
-
|
18
|
+
let isSelectorPackage = (resourcePath, packages) => {
|
21
19
|
if (!resourcePath.includes('node_modules')) {
|
22
20
|
return false;
|
23
21
|
}
|
@@ -38,93 +36,38 @@ const isSelectorPackage = (resourcePath, packages) => {
|
|
38
36
|
return isValid;
|
39
37
|
};
|
40
38
|
|
41
|
-
function patternBasedClass({
|
42
|
-
customClassNamePrefix,
|
43
|
-
context,
|
44
|
-
relativePath,
|
45
|
-
localName
|
46
|
-
}) {
|
47
|
-
let newName = null;
|
48
|
-
customClassNamePrefix.forEach(obj => {
|
49
|
-
if (obj.enable) {
|
50
|
-
if (obj.patterns && obj.prefix && (0, _fileHandling.isFileNameMatchingPluginPattern)({
|
51
|
-
filename: context.resourcePath,
|
52
|
-
filterArr: obj.patterns
|
53
|
-
})) {
|
54
|
-
const h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
55
|
-
newName = `${obj.prefix}${h}`;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
});
|
59
|
-
return newName;
|
60
|
-
}
|
61
|
-
|
62
39
|
var _default = (unique = true, {
|
63
40
|
filenames,
|
64
41
|
packages
|
65
|
-
}, classNamePrefix
|
66
|
-
//
|
67
|
-
// NOTE: in build machine we use date as folder path.
|
42
|
+
}, classNamePrefix) => (context, localIdentName, localName) => {
|
43
|
+
// NOTE: in build macine we use date as folder path.
|
68
44
|
// So every time we create new build there is path will alway different
|
69
|
-
// in order to
|
45
|
+
// in order to minmaze that problem we try in relative path;
|
70
46
|
// console.log('context.resourcePath', context.resourcePath, context);
|
71
47
|
// let contextResourcePath = context.resourcePath;
|
72
|
-
|
73
|
-
const fileName = filePaths[filePaths.length - 1];
|
74
|
-
const [fileNameWithoutExt] = fileName.split('.');
|
75
|
-
const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
|
76
|
-
|
77
|
-
const relativePath = _path.default.relative(context.rootContext, context.resourcePath); // console.log('customClassNamePrefix', customClassNamePrefix);
|
78
|
-
|
79
|
-
/*
|
80
|
-
input :
|
81
|
-
context.resourcePath : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
|
82
|
-
|
83
|
-
patterns.cssVariableReplacement:
|
84
|
-
// include src folder, include deskapp folder, exclude node modules
|
85
|
-
"cssUniqueness": [
|
86
|
-
"src",
|
87
|
-
"deskapp",
|
88
|
-
"!node_modules"
|
89
|
-
]
|
90
|
-
output :
|
91
|
-
true or false
|
92
|
-
*/
|
93
|
-
|
48
|
+
let relativePath = _path.default.relative(context.rootContext, context.resourcePath);
|
94
49
|
|
95
50
|
if (context.resourcePath.endsWith('.plain.css')) {
|
96
51
|
return localName;
|
97
52
|
}
|
98
|
-
|
99
|
-
if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
|
100
|
-
filename: context.resourcePath,
|
101
|
-
filterArr: patterns.cssUniqueness
|
102
|
-
})) {
|
103
|
-
return `${classNamePrefix}-${cleanFileName}-${localName}`;
|
104
|
-
}
|
105
53
|
/* old production mode start without breaking so added. may be removed in future*/
|
106
54
|
|
107
55
|
|
108
56
|
if (unique) {
|
109
|
-
|
57
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
110
58
|
return `${classNamePrefix}${h}`;
|
111
59
|
}
|
60
|
+
/* old production mode end*/
|
112
61
|
|
113
|
-
const patternClass = patternBasedClass({
|
114
|
-
customClassNamePrefix,
|
115
|
-
context,
|
116
|
-
relativePath,
|
117
|
-
localName
|
118
|
-
});
|
119
62
|
|
120
|
-
|
121
|
-
|
122
|
-
|
63
|
+
let filePaths = context.resourcePath.split(_path.default.sep);
|
64
|
+
let fileName = filePaths[filePaths.length - 1];
|
65
|
+
let [fileNameWithoutExt] = fileName.split('.');
|
66
|
+
let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase(); //css file has casesensitive selector issue so can't toLowerCase
|
123
67
|
//let local = localName.toLowerCase()
|
124
68
|
|
125
|
-
|
126
69
|
if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
|
127
|
-
|
70
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
128
71
|
return `${classNamePrefix}${h}`;
|
129
72
|
}
|
130
73
|
|
package/lib/utils/getOptions.js
CHANGED
@@ -3,28 +3,18 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _child_process = require("child_process");
|
9
9
|
|
10
|
-
var _fs =
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
11
11
|
|
12
12
|
var _path = _interopRequireDefault(require("path"));
|
13
13
|
|
14
14
|
var _schemas = _interopRequireDefault(require("../schemas"));
|
15
15
|
|
16
|
-
var _deprecationSupport = require("./deprecationSupport");
|
17
|
-
|
18
|
-
var _deprecationLogger = require("../deprecationLogger");
|
19
|
-
|
20
|
-
var _logger = require("../logger");
|
21
|
-
|
22
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
17
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
-
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
-
|
28
18
|
// import { argv } from 'process';
|
29
19
|
const args = process.argv.slice(2); // console.log('argv', argv);
|
30
20
|
|
@@ -132,51 +122,54 @@ const defaulter = (target, source) => {
|
|
132
122
|
return defaultObject;
|
133
123
|
};
|
134
124
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
125
|
+
global.reactCLIOptions = null; // function selectn(obj, key) {
|
126
|
+
// let temp = obj;
|
127
|
+
// let keys = key.split('.');
|
128
|
+
// for (let i = 0; i < keys.length; i++) {
|
129
|
+
// const element = keys[i];
|
130
|
+
// temp = temp && temp[element];
|
131
|
+
// }
|
132
|
+
// return temp;
|
133
|
+
// }
|
134
|
+
|
135
|
+
function deprecationSupport(options) {
|
136
|
+
// if (selectn(options, ".app.hasRTL") === true) {
|
137
|
+
if (options.app.hasRTL === true) {
|
138
|
+
options.app.plugins.hasRTL = true;
|
143
139
|
}
|
144
140
|
|
145
|
-
|
146
|
-
|
147
|
-
if ((0, _fs.existsSync)(packagePath)) {
|
148
|
-
return require(packagePath).config;
|
141
|
+
if (options.docs.hasRTL === true) {
|
142
|
+
options.docs.plugins.hasRTL = true;
|
149
143
|
}
|
150
144
|
|
151
|
-
|
152
|
-
|
153
|
-
if ((0, _fs.existsSync)(oldDeprecatedConfigFilePath)) {
|
154
|
-
(0, _deprecationLogger.deprecateMessage)('"build.config.js" file was deprecated. So Kindly rename it as "react-cli.config.js"');
|
155
|
-
return require(oldDeprecatedConfigFilePath).config;
|
145
|
+
if (options.app.rtlExclude.length > 0) {
|
146
|
+
options.app.exclude.rtl = options.app.rtlExclude;
|
156
147
|
}
|
157
148
|
|
158
|
-
|
159
|
-
|
149
|
+
if (options.docs.rtlExclude.length > 0) {
|
150
|
+
options.docs.exclude.rtl = options.docs.rtlExclude;
|
151
|
+
}
|
152
|
+
}
|
160
153
|
|
161
|
-
const getOptions =
|
154
|
+
const getOptions = () => {
|
162
155
|
if (global.reactCLIOptions) {
|
163
156
|
return global.reactCLIOptions;
|
164
157
|
}
|
165
158
|
|
166
159
|
const appPath = process.cwd();
|
167
|
-
let userSchemas
|
160
|
+
let userSchemas;
|
168
161
|
|
169
162
|
const packagePath = _path.default.join(appPath, 'package.json');
|
170
163
|
|
171
164
|
if (_fs.default.existsSync(packagePath)) {
|
172
|
-
userSchemas =
|
165
|
+
userSchemas = require(packagePath)['react-cli'] || {};
|
173
166
|
}
|
174
167
|
|
175
168
|
const options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
176
169
|
|
177
170
|
options.npmVersion = getNpmVersion();
|
178
171
|
options.cwd = getCWD();
|
179
|
-
|
172
|
+
deprecationSupport(options);
|
180
173
|
options.packageVersion = process.env.npm_package_version;
|
181
174
|
global.reactCLIOptions = options;
|
182
175
|
return options;
|
@@ -13,6 +13,10 @@ let getServerURL = (serverInfo, protocol) => {
|
|
13
13
|
} = serverInfo;
|
14
14
|
|
15
15
|
if (protocol) {
|
16
|
+
if (domain === 'kubernetes') {
|
17
|
+
return `${protocol ? `${protocol}:` : ''}//${host}`;
|
18
|
+
}
|
19
|
+
|
16
20
|
if (protocol === 'ht' + 'tp') {
|
17
21
|
port = Number(port) + 1;
|
18
22
|
|
@@ -20,10 +24,14 @@ let getServerURL = (serverInfo, protocol) => {
|
|
20
24
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${Number(port) + 1}`;
|
21
25
|
}
|
22
26
|
|
23
|
-
return `${protocol ? `${protocol}:` : ''}//${host}:${port}`;
|
27
|
+
return `${protocol ? `${protocol}:` : ''}//${host}:${Number(port) + 1}`;
|
24
28
|
}
|
25
29
|
}
|
26
30
|
|
31
|
+
if (domain === 'kubernetes') {
|
32
|
+
return `${protocol ? `${protocol}:` : ''}//${host}`;
|
33
|
+
}
|
34
|
+
|
27
35
|
if (domain) {
|
28
36
|
return `${protocol ? `${protocol}:` : ''}//${host}.${domain}.zohocorpin.com:${port}`;
|
29
37
|
}
|
package/lib/utils/index.js
CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
var _exportNames = {
|
7
|
+
log: true,
|
7
8
|
writeFile: true,
|
8
9
|
makeDir: true,
|
9
10
|
getInfoFromPublicPaths: true,
|
10
11
|
getLibraryConflict: true,
|
11
|
-
log: true,
|
12
12
|
getOptions: true,
|
13
13
|
createEventStream: true,
|
14
14
|
getServerURL: true,
|
@@ -64,13 +64,7 @@ Object.defineProperty(exports, "jsonHelper", {
|
|
64
64
|
return _jsonHelper.default;
|
65
65
|
}
|
66
66
|
});
|
67
|
-
|
68
|
-
enumerable: true,
|
69
|
-
get: function () {
|
70
|
-
return _log.log;
|
71
|
-
}
|
72
|
-
});
|
73
|
-
exports.makeDir = void 0;
|
67
|
+
exports.makeDir = exports.log = void 0;
|
74
68
|
Object.defineProperty(exports, "pullOrigin", {
|
75
69
|
enumerable: true,
|
76
70
|
get: function () {
|
@@ -101,8 +95,6 @@ var _stream = require("stream");
|
|
101
95
|
|
102
96
|
var _fs = _interopRequireDefault(require("fs"));
|
103
97
|
|
104
|
-
var _log = require("./log");
|
105
|
-
|
106
98
|
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
107
99
|
|
108
100
|
var _createEventStream = _interopRequireDefault(require("./createEventStream"));
|
@@ -169,7 +161,13 @@ var _ssTestHack = _interopRequireDefault(require("./ssTestHack"));
|
|
169
161
|
|
170
162
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
171
163
|
|
172
|
-
|
164
|
+
let log = (...info) => {
|
165
|
+
let print = console;
|
166
|
+
print.log(...info);
|
167
|
+
};
|
168
|
+
|
169
|
+
exports.log = log;
|
170
|
+
|
173
171
|
let writeFile = (outputPath, src, isPath = false) => new Promise((resolve, reject) => {
|
174
172
|
let inStr;
|
175
173
|
|
@@ -316,9 +314,9 @@ let getLibraryConflict = (moduleObject, impactObj, changesOnly) => {
|
|
316
314
|
whichLibrary = "No component file changes!";
|
317
315
|
}
|
318
316
|
|
319
|
-
|
320
|
-
|
321
|
-
|
317
|
+
log('\n');
|
318
|
+
log('You can see the HTML out at coverageTest/impactLibrary.html!');
|
319
|
+
log('\x1b[33m%s\x1b[0m', '************************************************************ \n ');
|
322
320
|
return {
|
323
321
|
response: allImpactArray,
|
324
322
|
result: {
|
@@ -11,7 +11,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
|
12
12
|
var _child_process = require("child_process");
|
13
13
|
|
14
|
-
var
|
14
|
+
var _index = require("./index");
|
15
15
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
|
@@ -38,7 +38,7 @@ let copyEslintConfig = rootDir => {
|
|
38
38
|
|
39
39
|
_fs.default.writeFileSync(targetPath, src);
|
40
40
|
|
41
|
-
(0,
|
41
|
+
(0, _index.log)('Eslint config added in project root path');
|
42
42
|
}
|
43
43
|
};
|
44
44
|
|
@@ -58,7 +58,7 @@ let initPreCommitHook = (forReactCLI = false) => {
|
|
58
58
|
|
59
59
|
_fs.default.writeFileSync(targetPath, precommit);
|
60
60
|
|
61
|
-
(0,
|
61
|
+
(0, _index.log)('pre-commit hook added');
|
62
62
|
}
|
63
63
|
|
64
64
|
let packagePath = _path.default.join(process.cwd(), 'package.json');
|
@@ -71,10 +71,10 @@ let initPreCommitHook = (forReactCLI = false) => {
|
|
71
71
|
|
72
72
|
_fs.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
|
73
73
|
|
74
|
-
(0,
|
74
|
+
(0, _index.log)('lint script added in your package.json');
|
75
75
|
}
|
76
76
|
} catch (e) {
|
77
|
-
(0,
|
77
|
+
(0, _index.log)('package.json not found');
|
78
78
|
}
|
79
79
|
}
|
80
80
|
};
|