@zohodesk/react-cli 0.0.1-beta.166 → 0.0.1-beta.169
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/.prettierrc +6 -0
- package/README.md +83 -3
- package/bin/cli.js +10 -15
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/lib/configs/jest.config.js +6 -1
- package/lib/configs/webpack.dev.config.js +13 -17
- package/lib/configs/webpack.docs.config.js +35 -36
- package/lib/configs/webpack.impact.config.js +8 -14
- package/lib/configs/webpack.prod.config.js +8 -5
- package/lib/loaderUtils/configsAssetsLoaders.js +88 -0
- package/lib/loaderUtils/getCSSLoaders.js +5 -3
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +63 -54
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +365 -0
- package/lib/schemas/index.js +31 -4
- package/lib/servers/{devBulid.js → devBuild.js} +7 -3
- package/lib/servers/getCliPath.js +7 -3
- package/lib/servers/httpsOptions.js +2 -3
- package/lib/servers/nowatchserver.js +2 -2
- package/lib/servers/server.js +11 -3
- package/lib/utils/repoClone.js +5 -2
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/package.json +5 -1
- package/postpublish.js +6 -0
- package/cert/cert.pem +0 -37
- package/cert/key.pem +0 -27
- package/cert/passphrase.pem +0 -1
@@ -0,0 +1,365 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
7
|
+
/**
|
8
|
+
* we have give support for ignore(exclude) comments
|
9
|
+
* These are the comments' keyword
|
10
|
+
*/
|
11
|
+
const hoverIgnoreQuery = 'Hover:ignore',
|
12
|
+
activeIgnoreQuery = 'Active:ignore',
|
13
|
+
hoverActiveIgnoreQuery = 'HoverActive:ignore';
|
14
|
+
const medHoverIgnoreQuery = 'MedHover:ignore',
|
15
|
+
medActiveIgnoreQuery = 'MedActive:ignore',
|
16
|
+
medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
|
17
|
+
const hoverMedQuerySuffix = '(min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)';
|
18
|
+
const ruleIgnoreCommentRegex = /(Hover:ignore|Active:ignore|HoverActive:ignore)/g;
|
19
|
+
const mediaQueryIgnoreCommentRegex = /(MedHover:ignore|MedActive:ignore|MedHoverActive:ignore)/g;
|
20
|
+
|
21
|
+
function isComment(node) {
|
22
|
+
return node && node.type === 'comment' && node.text !== undefined;
|
23
|
+
}
|
24
|
+
|
25
|
+
function isHoverPresent(atrule) {
|
26
|
+
let hoverPresent = false;
|
27
|
+
atrule.walkRules(rule => {
|
28
|
+
if (rule.selector.includes('hover')) {
|
29
|
+
hoverPresent = true;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
return hoverPresent;
|
33
|
+
}
|
34
|
+
|
35
|
+
module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOriginal => {
|
36
|
+
const hoverRules = [];
|
37
|
+
let positionsObj = {};
|
38
|
+
|
39
|
+
function isRuleHasIgnoreComment(index, type) {
|
40
|
+
const prevNode = rootOriginal.nodes[index - 1];
|
41
|
+
|
42
|
+
if (isComment(prevNode)) {
|
43
|
+
return prevNode.text === type;
|
44
|
+
}
|
45
|
+
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
|
49
|
+
function isMediaQueryHasIgnoreComment(node, type) {
|
50
|
+
if (isComment(node)) {
|
51
|
+
return node.text === type;
|
52
|
+
}
|
53
|
+
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
|
57
|
+
function hasIgnoreComment({
|
58
|
+
index,
|
59
|
+
atrule,
|
60
|
+
type
|
61
|
+
}) {
|
62
|
+
if (type.match(mediaQueryIgnoreCommentRegex)) {
|
63
|
+
return isMediaQueryHasIgnoreComment(atrule.nodes[index - 1], type.slice(3));
|
64
|
+
}
|
65
|
+
|
66
|
+
if (type.match(ruleIgnoreCommentRegex)) {
|
67
|
+
return isRuleHasIgnoreComment(index, type);
|
68
|
+
}
|
69
|
+
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
|
73
|
+
function getPositionsOfHoverAndActiveMedQueries(parent) {
|
74
|
+
const allNodes = rootOriginal.nodes;
|
75
|
+
const hoverMediaQuery = `${parent.params} and all and ${hoverMedQuerySuffix}`;
|
76
|
+
const hoverNoneMediaQuery = `${parent.params} and (hover: none)`;
|
77
|
+
const positions = {
|
78
|
+
hovMed: allNodes[positionsObj[hoverMediaQuery]],
|
79
|
+
actMed: allNodes[positionsObj[hoverNoneMediaQuery]]
|
80
|
+
};
|
81
|
+
return positions;
|
82
|
+
}
|
83
|
+
|
84
|
+
function handleMedHoverAndHoverActiveIgnore(atrule, index) {
|
85
|
+
return !hasIgnoreComment({
|
86
|
+
atrule,
|
87
|
+
index,
|
88
|
+
type: medHoverIgnoreQuery
|
89
|
+
}) && !hasIgnoreComment({
|
90
|
+
atrule,
|
91
|
+
index,
|
92
|
+
type: medHoverActiveIgnoreQuery
|
93
|
+
});
|
94
|
+
}
|
95
|
+
|
96
|
+
function handleMedActiveAndHoverActiveIgnore(atrule, index) {
|
97
|
+
return !hasIgnoreComment({
|
98
|
+
atrule,
|
99
|
+
index,
|
100
|
+
type: medActiveIgnoreQuery
|
101
|
+
}) && !hasIgnoreComment({
|
102
|
+
atrule,
|
103
|
+
index,
|
104
|
+
type: medHoverActiveIgnoreQuery
|
105
|
+
});
|
106
|
+
}
|
107
|
+
|
108
|
+
function handleHoverAndHoverActiveIgnore(index) {
|
109
|
+
return !hasIgnoreComment({
|
110
|
+
index,
|
111
|
+
type: hoverIgnoreQuery
|
112
|
+
}) && !hasIgnoreComment({
|
113
|
+
index,
|
114
|
+
type: hoverActiveIgnoreQuery
|
115
|
+
});
|
116
|
+
}
|
117
|
+
|
118
|
+
function handleActiveAndHoverActiveIgnore(index) {
|
119
|
+
return !hasIgnoreComment({
|
120
|
+
index,
|
121
|
+
type: activeIgnoreQuery
|
122
|
+
}) && !hasIgnoreComment({
|
123
|
+
index,
|
124
|
+
type: hoverActiveIgnoreQuery
|
125
|
+
});
|
126
|
+
}
|
127
|
+
|
128
|
+
function handleAllIgnoreCases(index) {
|
129
|
+
return !hasIgnoreComment({
|
130
|
+
index,
|
131
|
+
type: activeIgnoreQuery
|
132
|
+
}) && !hasIgnoreComment({
|
133
|
+
index,
|
134
|
+
type: hoverIgnoreQuery
|
135
|
+
}) && !hasIgnoreComment({
|
136
|
+
index,
|
137
|
+
type: hoverActiveIgnoreQuery
|
138
|
+
});
|
139
|
+
}
|
140
|
+
|
141
|
+
function mediaCommaQuery(rule, index) {
|
142
|
+
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
143
|
+
//console.log(hovMed, actMed);
|
144
|
+
let newSelector = '';
|
145
|
+
let {
|
146
|
+
hovMed,
|
147
|
+
actMed
|
148
|
+
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
149
|
+
let hovQueries = [];
|
150
|
+
let actQueries = [];
|
151
|
+
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
152
|
+
let subrule = _subrule.trim();
|
153
|
+
|
154
|
+
let clone = rule.clone();
|
155
|
+
|
156
|
+
if (subrule.includes('hover')) {
|
157
|
+
clone.selector = subrule;
|
158
|
+
|
159
|
+
if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
|
160
|
+
hovQueries.push(subrule);
|
161
|
+
}
|
162
|
+
|
163
|
+
if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
|
164
|
+
actQueries.push(subrule);
|
165
|
+
}
|
166
|
+
} else {
|
167
|
+
newSelector += `${subrule}, `;
|
168
|
+
}
|
169
|
+
});
|
170
|
+
|
171
|
+
if (hovQueries.length > 0) {
|
172
|
+
let clone = rule.clone();
|
173
|
+
clone.selector = hovQueries.join(',');
|
174
|
+
hovMed.append(clone);
|
175
|
+
}
|
176
|
+
|
177
|
+
if (actQueries.length > 0) {
|
178
|
+
let clone = rule.clone();
|
179
|
+
clone.selector = actQueries.join(',');
|
180
|
+
actMed.append(clone.clone({
|
181
|
+
selector: clone.selector.replace(/:hover/gi, ':active')
|
182
|
+
}));
|
183
|
+
}
|
184
|
+
|
185
|
+
if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
|
186
|
+
rule.selector = newSelector.substring(0, newSelector.length - 2);
|
187
|
+
}
|
188
|
+
|
189
|
+
if (rule.selector === '') {
|
190
|
+
rule.remove();
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
function mediaQuery(rule, index) {
|
196
|
+
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
197
|
+
let {
|
198
|
+
hovMed,
|
199
|
+
actMed
|
200
|
+
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
201
|
+
|
202
|
+
if (rule.selector.includes('hover') && hovMed !== undefined && rule.parent.type === 'atrule') {
|
203
|
+
if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
|
204
|
+
hovMed.append(rule);
|
205
|
+
}
|
206
|
+
|
207
|
+
if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
|
208
|
+
actMed.append(rule.clone({
|
209
|
+
selector: rule.selector.replace(/:hover/gi, ':active')
|
210
|
+
}));
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
function commaQuery(rule, index) {
|
217
|
+
//console.log("comma" , rule.selector.split('\n'));
|
218
|
+
let newSelector = '';
|
219
|
+
let hovQueries = [];
|
220
|
+
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
221
|
+
let subrule = _subrule.trim();
|
222
|
+
|
223
|
+
if (subrule.includes('hover')) {
|
224
|
+
// hoverRules.push({ rule: clone, index });
|
225
|
+
hovQueries.push(subrule);
|
226
|
+
} else {
|
227
|
+
newSelector += `${subrule}, `;
|
228
|
+
}
|
229
|
+
});
|
230
|
+
|
231
|
+
if (hovQueries.length > 0) {
|
232
|
+
let clone = rule.clone();
|
233
|
+
clone.selector = hovQueries.join(',');
|
234
|
+
hoverRules.push({
|
235
|
+
rule: clone,
|
236
|
+
index
|
237
|
+
});
|
238
|
+
}
|
239
|
+
|
240
|
+
if (handleHoverAndHoverActiveIgnore(index)) {
|
241
|
+
rule.selector = newSelector.substring(0, newSelector.length - 2).trim();
|
242
|
+
}
|
243
|
+
|
244
|
+
if (rule.selector === '') {
|
245
|
+
rule.remove();
|
246
|
+
}
|
247
|
+
} // Start by identifying all :hover rules
|
248
|
+
|
249
|
+
|
250
|
+
rootOriginal.walkAtRules(atrule => {
|
251
|
+
const hoverQuery = `${atrule.params} and all and ${hoverMedQuerySuffix}`;
|
252
|
+
const activeQuery = `${atrule.params} and (hover: none)`;
|
253
|
+
|
254
|
+
if (isHoverPresent(atrule)) {
|
255
|
+
if (!positionsObj[hoverQuery] && !positionsObj[activeQuery]) {
|
256
|
+
rootOriginal.append({
|
257
|
+
name: 'media',
|
258
|
+
params: hoverQuery
|
259
|
+
});
|
260
|
+
positionsObj[hoverQuery] = rootOriginal.nodes.length - 1;
|
261
|
+
rootOriginal.append({
|
262
|
+
name: 'media',
|
263
|
+
params: activeQuery
|
264
|
+
});
|
265
|
+
positionsObj[activeQuery] = rootOriginal.nodes.length - 1;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
});
|
269
|
+
rootOriginal.walkRules(/:hover/i, (rule, index) => {
|
270
|
+
// media hover query with ',' ' ' '+'
|
271
|
+
// console.log("media query" , rule.selector)
|
272
|
+
if (rule.parent.type === 'atrule' && rule.selector.includes(',')) {
|
273
|
+
//console.log("media comma", rule.selector)
|
274
|
+
mediaCommaQuery(rule, index);
|
275
|
+
} else {
|
276
|
+
// plus, space and other media queries
|
277
|
+
//console.log("media", rule.selector)
|
278
|
+
mediaQuery(rule, index);
|
279
|
+
} // usual hover query
|
280
|
+
|
281
|
+
|
282
|
+
if (!rule.selector.match(/,+| +|\++/g) && rule.parent !== undefined && rule.parent.name === undefined) {
|
283
|
+
hoverRules.push({
|
284
|
+
rule,
|
285
|
+
index
|
286
|
+
});
|
287
|
+
} //usual hover query with ',' ' ' '+'
|
288
|
+
|
289
|
+
|
290
|
+
if (rule.selector.match(/,+| +|\++/g) && rule.parent.name === undefined) {
|
291
|
+
if (rule.selector.includes(',')) {
|
292
|
+
commaQuery(rule, index);
|
293
|
+
} else if (rule.selector.match(/ +|\++/g)) {
|
294
|
+
//console.log("plus or space" , rule.selector);
|
295
|
+
if (rule.selector.includes('hover')) {
|
296
|
+
hoverRules.push({
|
297
|
+
rule,
|
298
|
+
index
|
299
|
+
}); //rule.remove();
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}); // If there are any :hover rules in the input, then create media queries
|
304
|
+
// to automatically translate it into :active on touch-based devices
|
305
|
+
|
306
|
+
if (hoverRules.length > 0) {
|
307
|
+
// Create a media query targetting devices that actually support
|
308
|
+
// hover
|
309
|
+
const hoverQuery = rootOriginal.append({
|
310
|
+
name: 'media',
|
311
|
+
params: `all and ${hoverMedQuerySuffix}`
|
312
|
+
}).last; // Create a media query targetting devices that don't support hover
|
313
|
+
// (ie. devices where we should fall back to :active instead)
|
314
|
+
|
315
|
+
const activeQuery = rootOriginal.append({
|
316
|
+
name: 'media',
|
317
|
+
params: '(hover: none)'
|
318
|
+
}).last; // Loop through the hover rules and apply them to each of the media
|
319
|
+
// queries
|
320
|
+
// eslint-disable-next-line no-labels
|
321
|
+
|
322
|
+
outerLoop: for (const hoverRule of hoverRules) {
|
323
|
+
// determine if the rule has been nested inside another media
|
324
|
+
// query; in that case bail out as we have no way of reliably
|
325
|
+
// nesting these queries
|
326
|
+
let parentRule = hoverRule.rule.parent;
|
327
|
+
|
328
|
+
while (parentRule) {
|
329
|
+
if (parentRule.type === 'atrule' && parentRule.name === 'media') {
|
330
|
+
// eslint-disable-next-line no-labels
|
331
|
+
continue outerLoop;
|
332
|
+
}
|
333
|
+
|
334
|
+
parentRule = parentRule.parent;
|
335
|
+
} // Push a clone of the :hover rule 'as is' to queries where we
|
336
|
+
// expect the user's device to support hover
|
337
|
+
// ieQuery.append(hoverRule.clone());
|
338
|
+
|
339
|
+
|
340
|
+
if (handleHoverAndHoverActiveIgnore(hoverRule.index)) {
|
341
|
+
hoverQuery.append(hoverRule.rule.clone());
|
342
|
+
} // Push a clone of the :hover rule, where we transform the
|
343
|
+
// selector to :active to the query targetting devices that
|
344
|
+
// don't support hover
|
345
|
+
|
346
|
+
|
347
|
+
if (handleActiveAndHoverActiveIgnore(hoverRule.index)) {
|
348
|
+
activeQuery.append(hoverRule.rule.clone({
|
349
|
+
selector: hoverRule.rule.selector.replace(/:hover/gi, ':active')
|
350
|
+
}));
|
351
|
+
} // remove legacy rule from output
|
352
|
+
|
353
|
+
|
354
|
+
if (handleAllIgnoreCases(hoverRule.index)) {
|
355
|
+
hoverRule.rule.remove();
|
356
|
+
}
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
rootOriginal.walkAtRules(atrule => {
|
361
|
+
if (atrule !== undefined && atrule.nodes !== undefined && atrule.nodes.length === 0 || atrule.nodes === undefined) {
|
362
|
+
atrule.remove();
|
363
|
+
}
|
364
|
+
});
|
365
|
+
});
|
package/lib/schemas/index.js
CHANGED
@@ -14,6 +14,11 @@ var _getCurrentBranch = _interopRequireDefault(require("../utils/getCurrentBranc
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
16
|
var _default = {
|
17
|
+
cliRootPath: null,
|
18
|
+
unstableDepsInverse: {
|
19
|
+
value: false,
|
20
|
+
cli: 'unstable_deps_inverse'
|
21
|
+
},
|
17
22
|
sslCertURL: {
|
18
23
|
value: null,
|
19
24
|
cli: 'ssl_cert_url'
|
@@ -60,11 +65,20 @@ var _default = {
|
|
60
65
|
dirVarName: 'document.dir'
|
61
66
|
},
|
62
67
|
efc: {
|
63
|
-
hasEFC:
|
68
|
+
hasEFC: {
|
69
|
+
value: false,
|
70
|
+
cli: 'enable_efc'
|
71
|
+
},
|
64
72
|
createSDkFile: false,
|
65
73
|
nameScope: 'ZOHODESK',
|
66
|
-
version:
|
67
|
-
|
74
|
+
version: {
|
75
|
+
value: 'stable',
|
76
|
+
cli: 'efc_version'
|
77
|
+
},
|
78
|
+
outputFile: {
|
79
|
+
value: 'efc-sdk-[version].js',
|
80
|
+
cli: 'efc_output_file'
|
81
|
+
},
|
68
82
|
templateFilePath: '',
|
69
83
|
localeAttr: 'data-efc-locale',
|
70
84
|
localeDefaultValue: 'en_US',
|
@@ -148,7 +162,10 @@ var _default = {
|
|
148
162
|
disableES5Transpile: false,
|
149
163
|
isReactMig: false,
|
150
164
|
hasWidget: false,
|
151
|
-
hasEFC:
|
165
|
+
hasEFC: {
|
166
|
+
value: false,
|
167
|
+
cli: 'enable_efc'
|
168
|
+
},
|
152
169
|
enableChunkHash: {
|
153
170
|
value: false,
|
154
171
|
cli: 'hash_enable'
|
@@ -204,6 +221,8 @@ var _default = {
|
|
204
221
|
value: 'zd',
|
205
222
|
cli: 'class_prefix'
|
206
223
|
},
|
224
|
+
combinerMq: false,
|
225
|
+
hoverActive: false,
|
207
226
|
selectorReplace: null,
|
208
227
|
devConsoleExculde: {
|
209
228
|
value: false,
|
@@ -256,7 +275,11 @@ var _default = {
|
|
256
275
|
value: true,
|
257
276
|
cli: 'css_unique'
|
258
277
|
},
|
278
|
+
enableChunkHash: false,
|
279
|
+
combinerMq: false,
|
280
|
+
hoverActive: false,
|
259
281
|
folder: 'src',
|
282
|
+
disableES5Transpile: false,
|
260
283
|
hasRTL: false,
|
261
284
|
rtlExclude: [],
|
262
285
|
cssHashSelectors: {
|
@@ -553,6 +576,10 @@ var _default = {
|
|
553
576
|
value: null,
|
554
577
|
cli: 'clone_revision'
|
555
578
|
},
|
579
|
+
shallowClone: {
|
580
|
+
value: false,
|
581
|
+
cli: 'shallow_clone'
|
582
|
+
},
|
556
583
|
projectName: {
|
557
584
|
value: null,
|
558
585
|
cli: 'clone_proj_name'
|
@@ -18,6 +18,9 @@ var _getCliPath = require("./getCliPath");
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
19
|
|
20
20
|
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
21
|
+
// NOTE: need to discuss about in below codes,
|
22
|
+
// when we run webpack the usable options that comes for npm run not working as automatical
|
23
|
+
// we are use this option always --disable_watch=true reason for now no need for
|
21
24
|
|
22
25
|
const {
|
23
26
|
app: {
|
@@ -61,8 +64,9 @@ const startTime = Date.now(); // const result = spawnSync(
|
|
61
64
|
// ),
|
62
65
|
// { stdio: 'inherit' }
|
63
66
|
// );
|
67
|
+
// --disable_watch=true
|
64
68
|
|
65
|
-
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
69
|
+
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
66
70
|
result && console.log(result);
|
67
71
|
|
68
72
|
if (result && result.stderr) {
|
@@ -83,8 +87,8 @@ if (zipname) {
|
|
83
87
|
} else {
|
84
88
|
console.log('zip file created', cssSelectorZipPath);
|
85
89
|
}
|
86
|
-
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
87
|
-
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
90
|
+
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
91
|
+
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
88
92
|
|
89
93
|
|
90
94
|
console.log(`compailation done in ${Date.now() - startTime}ms`);
|
@@ -9,16 +9,20 @@ var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
10
10
|
var _os = require("os");
|
11
11
|
|
12
|
+
var _fs = require("fs");
|
13
|
+
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
15
|
|
14
|
-
|
16
|
+
const appPath = process.cwd();
|
15
17
|
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
16
|
-
|
18
|
+
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
17
19
|
|
18
20
|
const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
|
19
21
|
|
20
22
|
const suffixExt = isWindows ? '.cmd' : '';
|
21
23
|
|
22
24
|
function getCliPath(libName) {
|
23
|
-
|
25
|
+
const cliPath = _getCliPath(libName + suffixExt);
|
26
|
+
|
27
|
+
return (0, _fs.existsSync)(cliPath) ? cliPath : libName;
|
24
28
|
}
|
@@ -12,8 +12,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
|
14
14
|
const httpsOptions = {
|
15
|
-
key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/key
|
16
|
-
cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/
|
17
|
-
passphrase: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/passphrase.pem')).toString()
|
15
|
+
key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
|
16
|
+
cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
|
18
17
|
};
|
19
18
|
exports.httpsOptions = httpsOptions;
|
@@ -14,7 +14,7 @@ var _utils = require("../utils");
|
|
14
14
|
|
15
15
|
var _httpsOptions = require("./httpsOptions");
|
16
16
|
|
17
|
-
var
|
17
|
+
var _devBuild = require("./devBuild");
|
18
18
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
20
|
|
@@ -42,7 +42,7 @@ const {
|
|
42
42
|
zipname,
|
43
43
|
cssSelectorZipPath,
|
44
44
|
outputFolderLocation
|
45
|
-
} = (0,
|
45
|
+
} = (0, _devBuild.getPaths)();
|
46
46
|
const app = (0, _express.default)();
|
47
47
|
|
48
48
|
if (hasMock) {
|
package/lib/servers/server.js
CHANGED
@@ -69,7 +69,8 @@ if (mode === 'prod') {
|
|
69
69
|
config = require('../configs/webpack.dev.config');
|
70
70
|
} else {
|
71
71
|
throw new Error('You must configure valid option in mode');
|
72
|
-
}
|
72
|
+
} // console.log({ contextURL });
|
73
|
+
|
73
74
|
|
74
75
|
let compiler = (0, _webpack.default)(config);
|
75
76
|
let webpackServerOptions = {
|
@@ -144,15 +145,22 @@ app.post('/wmsmockapi', (req, res) => {
|
|
144
145
|
res.send('success');
|
145
146
|
});
|
146
147
|
let webpackCompilation;
|
148
|
+
let initalHTML;
|
147
149
|
compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
|
148
150
|
webpackCompilation = compilation;
|
149
151
|
});
|
152
|
+
compiler.hooks.done.tap('ReactCLI', () => {
|
153
|
+
const indexHtml = webpackCompilation.assets['index.html'];
|
154
|
+
|
155
|
+
if (indexHtml) {
|
156
|
+
initalHTML = indexHtml.source();
|
157
|
+
}
|
158
|
+
});
|
150
159
|
|
151
160
|
if (contextURL) {
|
152
161
|
app.use(contextURL, _express.default.static(context));
|
153
162
|
app.use(`${contextURL}/*`, (req, res) => {
|
154
|
-
|
155
|
-
res.send(indexHtml && indexHtml.source());
|
163
|
+
res.send(initalHTML);
|
156
164
|
});
|
157
165
|
} else {
|
158
166
|
app.use(_express.default.static(context));
|
package/lib/utils/repoClone.js
CHANGED
@@ -28,6 +28,7 @@ let {
|
|
28
28
|
branch,
|
29
29
|
revision,
|
30
30
|
projectName,
|
31
|
+
shallowClone,
|
31
32
|
cacheDir,
|
32
33
|
remoteName,
|
33
34
|
shouldDelete
|
@@ -73,9 +74,11 @@ let cloneRepo = () => {
|
|
73
74
|
}
|
74
75
|
}
|
75
76
|
|
76
|
-
(0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
|
77
|
+
(0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
|
77
78
|
|
78
|
-
|
79
|
+
let oargs = ['clone', url, revisionOrBranch, projectName];
|
80
|
+
type === 'git' && shallowClone && oargs.push('--depth=1');
|
81
|
+
spawnSyncWithErrorLog(type, oargs, {
|
79
82
|
cwd: cacheDir,
|
80
83
|
stdio: 'inherit'
|
81
84
|
});
|
package/lib/utils/rtl.js
CHANGED
@@ -18,7 +18,10 @@ let src = _path.default.join(cwd, process.argv[2]);
|
|
18
18
|
|
19
19
|
let dist = _path.default.join(cwd, process.argv[3]);
|
20
20
|
|
21
|
-
|
21
|
+
let canWacth = '-w' === process.argv[4];
|
22
|
+
|
23
|
+
// import { useExitCleanup } from './useExitCleanup';
|
24
|
+
function watchHandler(fromPath, toPath) {
|
22
25
|
let css = _fs.default.readFileSync(fromPath);
|
23
26
|
|
24
27
|
(0, _postcss.default)([(0, _postcssRtl.default)({
|
@@ -39,4 +42,18 @@ let dist = _path.default.join(cwd, process.argv[3]);
|
|
39
42
|
_fs.default.writeFile(`${toPath}.map`, result.map, () => true);
|
40
43
|
}
|
41
44
|
});
|
42
|
-
}
|
45
|
+
}
|
46
|
+
|
47
|
+
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
48
|
+
if (canWacth && fromPath) {
|
49
|
+
_fs.default.watchFile(fromPath, () => {
|
50
|
+
watchHandler(fromPath, toPath);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
watchHandler(fromPath, toPath);
|
55
|
+
}); // if (canWacth) {
|
56
|
+
// useExitCleanup(() => {
|
57
|
+
// fs.unwatchFile(src, watchHandler);
|
58
|
+
// });
|
59
|
+
// }
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useExitCleanup = useExitCleanup;
|
7
|
+
//so the program will not close instantly
|
8
|
+
let listeners = [];
|
9
|
+
let hasCalled = false;
|
10
|
+
|
11
|
+
function useExitCleanup(listener) {
|
12
|
+
if (!hasCalled) {
|
13
|
+
process.stdin.resume();
|
14
|
+
hasCalled = true;
|
15
|
+
}
|
16
|
+
|
17
|
+
listeners.push(listeners);
|
18
|
+
return () => {
|
19
|
+
listeners = listeners.filter(l => l !== listener);
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
function exitHandler(options, exitCode) {
|
24
|
+
if (options.cleanup) {
|
25
|
+
console.log('clean');
|
26
|
+
}
|
27
|
+
|
28
|
+
if (exitCode || exitCode === 0) {
|
29
|
+
console.log(exitCode);
|
30
|
+
}
|
31
|
+
|
32
|
+
if (options.exit) {
|
33
|
+
process.exit();
|
34
|
+
}
|
35
|
+
} //do something when app is closing
|
36
|
+
|
37
|
+
|
38
|
+
process.on('exit', exitHandler.bind(null, {
|
39
|
+
cleanup: true
|
40
|
+
})); //catches ctrl+c event
|
41
|
+
|
42
|
+
process.on('SIGINT', exitHandler.bind(null, {
|
43
|
+
exit: true
|
44
|
+
})); // catches "kill pid" (for example: nodemon restart)
|
45
|
+
|
46
|
+
process.on('SIGUSR1', exitHandler.bind(null, {
|
47
|
+
exit: true
|
48
|
+
}));
|
49
|
+
process.on('SIGUSR2', exitHandler.bind(null, {
|
50
|
+
exit: true
|
51
|
+
})); //catches uncaught exceptions
|
52
|
+
|
53
|
+
process.on('uncaughtException', exitHandler.bind(null, {
|
54
|
+
exit: true
|
55
|
+
}));
|