@zohodesk/react-cli 0.0.1-exp.166.1 → 0.0.1-exp.168.2
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/README.md +51 -2
- package/bin/cli.js +6 -1
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/DevStart.md +18 -0
- package/docs/InstallNode.md +28 -0
- package/lib/configs/webpack.dev.config.js +13 -17
- package/lib/configs/webpack.docs.config.js +13 -18
- package/lib/configs/webpack.impact.config.js +6 -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/postcss-plugins/hoverActivePlugin.js +264 -0
- package/lib/postcss-plugins/keyframesPlugin.js +126 -0
- package/lib/schemas/index.js +24 -2
- package/lib/servers/{devBulid.js → devBuild.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/DOTO.md +0 -13
- package/cert/cert.pem +0 -37
- package/cert/key.pem +0 -27
- package/cert/passphrase.pem +0 -1
- package/eslint/NOTES.md +0 -3
- package/eslint/a23.c +0 -16
- package/eslint/a28.c +0 -25
- package/eslint/a29.c +0 -25
- package/eslint/a30.c +0 -29
- package/eslint/a31.c +0 -23
- package/eslint/a35.c +0 -23
- package/eslint/a36.c +0 -18
- package/eslint/a37.c +0 -25
- package/eslint/a38.c +0 -28
- package/eslint/a39.c +0 -17
- package/eslint/a40.c +0 -32
- package/eslint/mockapi.html +0 -18
- package/eslint/mockapi.md +0 -5
@@ -0,0 +1,264 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
7
|
+
module.exports = _postcss.default.plugin("postcss-mobile-hover", () => {
|
8
|
+
return root => {
|
9
|
+
function checkHoverIgnore(rule, index) {
|
10
|
+
return rule.nodes !== undefined && rule.nodes[index - 1] !== undefined && rule.nodes[index - 1].type == "comment" && rule.nodes[index - 1].text.includes("hover:ignore");
|
11
|
+
}
|
12
|
+
|
13
|
+
function checkPositionNodeHov(parent) {
|
14
|
+
let clone = parent.clone();
|
15
|
+
clone.params = clone.params + " and (hover: hover)";
|
16
|
+
var posn = -1;
|
17
|
+
root.nodes.map((node, index) => {
|
18
|
+
if (node.params == clone.params) {
|
19
|
+
posn = index;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
return posn;
|
23
|
+
}
|
24
|
+
|
25
|
+
function checkPositionNodeAct(parent) {
|
26
|
+
let clone = parent.clone();
|
27
|
+
clone.params = clone.params + " and (hover: none)";
|
28
|
+
var posn = -1;
|
29
|
+
root.nodes.map((node, index) => {
|
30
|
+
if (clone.params == node.params) {
|
31
|
+
posn = index;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
return posn;
|
35
|
+
}
|
36
|
+
|
37
|
+
function checkPositionNodeFireFox(parent) {
|
38
|
+
var posn = -1;
|
39
|
+
root.nodes.map((nodes, index) => {
|
40
|
+
if (nodes.params == "all and (min--moz-device-pixel-ratio:0)") {
|
41
|
+
posn = index;
|
42
|
+
}
|
43
|
+
});
|
44
|
+
return posn;
|
45
|
+
}
|
46
|
+
|
47
|
+
const hoverRules = []; // Start by identifying all :hover rules
|
48
|
+
|
49
|
+
root.walkAtRules((atrule, index) => {
|
50
|
+
let hoverPresent = false;
|
51
|
+
atrule.walkRules((rule, index) => {
|
52
|
+
if (rule.selector.includes("hover")) {
|
53
|
+
hoverPresent = true;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
if (hoverPresent) {
|
58
|
+
root.append({
|
59
|
+
name: "media",
|
60
|
+
params: atrule.params + " and (hover: hover)"
|
61
|
+
});
|
62
|
+
root.append({
|
63
|
+
name: "media",
|
64
|
+
params: atrule.params + " and (hover: none)"
|
65
|
+
});
|
66
|
+
root.append({
|
67
|
+
name: "media",
|
68
|
+
params: "all and (min--moz-device-pixel-ratio:0)"
|
69
|
+
});
|
70
|
+
}
|
71
|
+
});
|
72
|
+
root.walkRules(/:hover/i, (rule, index) => {
|
73
|
+
if (!checkHoverIgnore(rule, index)) {
|
74
|
+
// media hover query with ',' ' ' '+'
|
75
|
+
if (rule.parent.name != undefined && rule.parent.params !== undefined) {
|
76
|
+
//console.log(rule.parent.params)
|
77
|
+
// console.log("media query" , rule.selector)
|
78
|
+
if (rule.selector.includes(" ") && rule.selector.includes(",") || !rule.selector.includes(" ") && rule.selector.includes(",")) {
|
79
|
+
//console.log("media comma", rule.selector)
|
80
|
+
if (rule.parent.params != undefined && !rule.parent.params.includes("hover")) {
|
81
|
+
//console.log("not hovered")
|
82
|
+
var posHov = checkPositionNodeHov(rule.parent);
|
83
|
+
var actHov = checkPositionNodeAct(rule.parent);
|
84
|
+
var firHov = checkPositionNodeFireFox(rule.parent);
|
85
|
+
var hovMed = root.nodes[posHov];
|
86
|
+
var actMed = root.nodes[actHov];
|
87
|
+
var firMed = root.nodes[firHov]; //console.log(hovMed, actMed);
|
88
|
+
|
89
|
+
var str = ",";
|
90
|
+
|
91
|
+
if (rule.selector.includes(",\n")) {
|
92
|
+
str = ",\n";
|
93
|
+
}
|
94
|
+
|
95
|
+
rule.selector.split(str).map(subrule => {
|
96
|
+
subrule = subrule.trim();
|
97
|
+
let clone = rule.clone();
|
98
|
+
|
99
|
+
if (subrule.includes("hover")) {
|
100
|
+
clone.selector = subrule;
|
101
|
+
hovMed.append(clone);
|
102
|
+
firMed.append(clone);
|
103
|
+
actMed.append(clone.clone({
|
104
|
+
selector: clone.selector.replace(/:hover/gi, ":active")
|
105
|
+
}));
|
106
|
+
} else {
|
107
|
+
clone.selector = subrule;
|
108
|
+
root.append(clone);
|
109
|
+
}
|
110
|
+
});
|
111
|
+
rule.remove();
|
112
|
+
}
|
113
|
+
} else if (rule.selector.includes(" ") && rule.selector.includes("+") || !rule.selector.includes(" ") && rule.selector.includes("+")) {
|
114
|
+
//console.log("media plus", rule.selector)
|
115
|
+
if (rule.parent.params != undefined && !rule.parent.params.includes("hover")) {
|
116
|
+
//console.log("not hovered")
|
117
|
+
var posHov = checkPositionNodeHov(rule.parent);
|
118
|
+
var actHov = checkPositionNodeAct(rule.parent);
|
119
|
+
var firHov = checkPositionNodeFireFox(rule.parent);
|
120
|
+
var hovMed = root.nodes[posHov];
|
121
|
+
var actMed = root.nodes[actHov];
|
122
|
+
var firMed = root.nodes[firHov]; // console.log(hovMed, actMed);
|
123
|
+
|
124
|
+
if (rule.selector.includes("hover")) {
|
125
|
+
console.log(rule.selector);
|
126
|
+
firMed.append(rule);
|
127
|
+
hovMed.append(rule);
|
128
|
+
actMed.append(rule.clone({
|
129
|
+
selector: rule.selector.replace(/:hover/gi, ":active")
|
130
|
+
}));
|
131
|
+
} else {
|
132
|
+
root.append(rule);
|
133
|
+
}
|
134
|
+
} else {// console.log(rule.selector)
|
135
|
+
}
|
136
|
+
} else if (rule.selector.includes(" ")) {
|
137
|
+
//console.log("media space", rule.selector)
|
138
|
+
if (rule.parent.params != undefined && !rule.parent.params.includes("hover")) {
|
139
|
+
//console.log("not hovered")
|
140
|
+
var posHov = checkPositionNodeHov(rule.parent);
|
141
|
+
var actHov = checkPositionNodeAct(rule.parent);
|
142
|
+
var firHov = checkPositionNodeFireFox(rule.parent);
|
143
|
+
var hovMed = root.nodes[posHov];
|
144
|
+
var actMed = root.nodes[actHov];
|
145
|
+
var firMed = root.nodes[firMed]; //console.log(hovMed, actMed);
|
146
|
+
|
147
|
+
if (rule.selector.includes("hover")) {
|
148
|
+
hovMed.append(rule);
|
149
|
+
actMed.append(rule.clone({
|
150
|
+
selector: rule.selector.replace(/:hover/gi, ":active")
|
151
|
+
}));
|
152
|
+
} else {
|
153
|
+
root.append(rule);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
} //usual hover query with ',' ' ' '+'
|
158
|
+
else if ((rule.selector.includes(",") || rule.selector.includes(" ") || rule.selector.includes("+")) && rule.parent.name == undefined) {
|
159
|
+
if (rule.selector.includes(" ") && rule.selector.includes(",") || !rule.selector.includes(" ") && rule.selector.includes(",")) {
|
160
|
+
//console.log("comma" , rule.selector.split('\n'));
|
161
|
+
rule.selector.split(",\n").map(subrule => {
|
162
|
+
subrule = subrule.trim();
|
163
|
+
let clone = rule.clone();
|
164
|
+
|
165
|
+
if (subrule.includes("hover")) {
|
166
|
+
clone.selector = subrule;
|
167
|
+
hoverRules.push(clone);
|
168
|
+
} else {
|
169
|
+
clone.selector = subrule;
|
170
|
+
root.append(clone);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
rule.remove();
|
174
|
+
} else if (rule.selector.includes(" ") && rule.selector.includes("+") || !rule.selector.includes(" ") && rule.selector.includes("+")) {
|
175
|
+
//console.log("plus" , rule.selector);
|
176
|
+
if (rule.selector.includes("hover")) {
|
177
|
+
//console.log("plus:", rule.selector);
|
178
|
+
hoverRules.push(rule);
|
179
|
+
rule.remove();
|
180
|
+
}
|
181
|
+
} else if (rule.selector.includes(" ")) {
|
182
|
+
//console.log("space", rule.selector);
|
183
|
+
hoverRules.push(rule);
|
184
|
+
rule.remove();
|
185
|
+
}
|
186
|
+
} // usual hover query
|
187
|
+
else {
|
188
|
+
//console.log(rule);
|
189
|
+
if (rule.selector.includes("hover")) {
|
190
|
+
hoverRules.push(rule);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}); // If there are any :hover rules in the input, then create media queries
|
195
|
+
// to automatically translate it into :active on touch-based devices
|
196
|
+
|
197
|
+
if (hoverRules.length > 0) {
|
198
|
+
//console.log(hoverRules)
|
199
|
+
// Create a media query targetting ie10 + 11, as these browsers
|
200
|
+
// wont support @media (hover: hover) - but we know that this
|
201
|
+
// browser never runs on mobile devices, so we'll just push the
|
202
|
+
// hover rules there
|
203
|
+
// const ieQuery = root.append({
|
204
|
+
// name: 'media',
|
205
|
+
// params:
|
206
|
+
// 'all and ' +
|
207
|
+
// '(-ms-high-contrast: none), ' +
|
208
|
+
// '(-ms-high-contrast: active)'
|
209
|
+
// }).last;
|
210
|
+
// Create a media query targetting firefox, as this browser doesn't
|
211
|
+
// support @media (hover: hover)... Technically this browser could
|
212
|
+
// run on both desktop and mobile devices, but we're going to be
|
213
|
+
// applying :hover and hope for the best
|
214
|
+
const firefoxQuery = root.append({
|
215
|
+
name: "media",
|
216
|
+
params: "all and (min--moz-device-pixel-ratio:0)"
|
217
|
+
}).last; // Create a media query targetting devices that actually support
|
218
|
+
// hover
|
219
|
+
|
220
|
+
const hoverQuery = root.append({
|
221
|
+
name: "media",
|
222
|
+
params: "(hover: hover)"
|
223
|
+
}).last; // Create a media query targetting devices that don't support hover
|
224
|
+
// (ie. devices where we should fall back to :active instead)
|
225
|
+
|
226
|
+
const activeQuery = root.append({
|
227
|
+
name: "media",
|
228
|
+
params: "(hover: none)"
|
229
|
+
}).last; // Loop through the hover rules and apply them to each of the media
|
230
|
+
// queries
|
231
|
+
// eslint-disable-next-line no-labels
|
232
|
+
|
233
|
+
outerLoop: for (const hoverRule of hoverRules) {
|
234
|
+
// determine if the rule has been nested inside another media
|
235
|
+
// query; in that case bail out as we have no way of reliably
|
236
|
+
// nesting these queries
|
237
|
+
let parentRule = hoverRule.parent;
|
238
|
+
|
239
|
+
while (parentRule) {
|
240
|
+
if (parentRule.type === "atrule" && parentRule.name === "media") {
|
241
|
+
// eslint-disable-next-line no-labels
|
242
|
+
continue outerLoop;
|
243
|
+
}
|
244
|
+
|
245
|
+
parentRule = parentRule.parent;
|
246
|
+
} // Push a clone of the :hover rule 'as is' to queries where we
|
247
|
+
// expect the user's device to support hover
|
248
|
+
// ieQuery.append(hoverRule.clone());
|
249
|
+
|
250
|
+
|
251
|
+
firefoxQuery.append(hoverRule.clone());
|
252
|
+
hoverQuery.append(hoverRule.clone()); // Push a clone of the :hover rule, where we transform the
|
253
|
+
// selector to :active to the query targetting devices that
|
254
|
+
// don't support hover
|
255
|
+
|
256
|
+
activeQuery.append(hoverRule.clone({
|
257
|
+
selector: hoverRule.selector.replace(/:hover/gi, ":active")
|
258
|
+
})); // remove legacy rule from output
|
259
|
+
|
260
|
+
hoverRule.remove();
|
261
|
+
}
|
262
|
+
}
|
263
|
+
};
|
264
|
+
});
|
@@ -0,0 +1,126 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _postcss = _interopRequireWildcard(require("postcss"));
|
4
|
+
|
5
|
+
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); }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
module.exports = _postcss.default.plugin("postcss-reduced-motion", () => {
|
10
|
+
function animDeclPosn(rule) {
|
11
|
+
let posn = -1;
|
12
|
+
rule.walkDecls((decl, index) => {
|
13
|
+
//console.log(decl.prop, " " , decl.value);
|
14
|
+
if (decl.prop.includes("animation")) {
|
15
|
+
//console.log(decl.prop," selected")
|
16
|
+
posn = index;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
return posn;
|
20
|
+
}
|
21
|
+
|
22
|
+
return root => {
|
23
|
+
let redRules = [];
|
24
|
+
root.walkAtRules((atrule, index) => {
|
25
|
+
if (index != 0) {
|
26
|
+
//ignore case
|
27
|
+
let ignore = false;
|
28
|
+
|
29
|
+
if (root.nodes[index - 1].type == "comment") {
|
30
|
+
ignore = root.nodes[index - 1].text.includes("reduced-motion:ignore");
|
31
|
+
} //animation none push to reduced motion
|
32
|
+
|
33
|
+
|
34
|
+
if (!ignore) {
|
35
|
+
//console.log(atrule)
|
36
|
+
atrule.walkRules(rule => {
|
37
|
+
let pos = animDeclPosn(rule);
|
38
|
+
|
39
|
+
if (pos != -1) {
|
40
|
+
let ruleNew = rule.clone();
|
41
|
+
let decl = ruleNew.nodes[pos];
|
42
|
+
let declClone = decl.clone();
|
43
|
+
declClone.value = "none";
|
44
|
+
ruleNew.walkDecls(declVal => declVal.remove());
|
45
|
+
ruleNew.append(declClone);
|
46
|
+
let atRuleNew = atrule.clone();
|
47
|
+
atRuleNew.nodes = [];
|
48
|
+
atRuleNew.push(ruleNew);
|
49
|
+
redRules.push(atRuleNew);
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
} else {
|
54
|
+
//animation none push to reduced motion
|
55
|
+
//console.log(atrule)
|
56
|
+
atrule.walkRules(rule => {
|
57
|
+
let pos = animDeclPosn(rule);
|
58
|
+
|
59
|
+
if (pos != -1) {
|
60
|
+
let ruleNew = rule.clone();
|
61
|
+
let decl = ruleNew.nodes[pos];
|
62
|
+
let declClone = decl.clone();
|
63
|
+
declClone.value = "none";
|
64
|
+
ruleNew.walkDecls(declVal => declVal.remove());
|
65
|
+
ruleNew.append(declClone);
|
66
|
+
let atRuleNew = atrule.clone();
|
67
|
+
atRuleNew.nodes = [];
|
68
|
+
atRuleNew.push(ruleNew);
|
69
|
+
redRules.push(atRuleNew);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
});
|
74
|
+
root.walkRules((rule, index) => {
|
75
|
+
if (rule.type === "rule" && rule.parent.name == undefined) {
|
76
|
+
if (index != 0) {
|
77
|
+
//ignore case
|
78
|
+
let ignore = false;
|
79
|
+
|
80
|
+
if (root.nodes[index - 1].type == "comment") {
|
81
|
+
ignore = root.nodes[index - 1].text.includes("reduced-motion:ignore");
|
82
|
+
} //animation none push to reduced motion
|
83
|
+
|
84
|
+
|
85
|
+
if (!ignore) {
|
86
|
+
//console.log(atrule)
|
87
|
+
rule.walkDecls(decl => {
|
88
|
+
if (decl != undefined && decl.prop.includes("animation")) {
|
89
|
+
let declClone = decl.clone();
|
90
|
+
let newRule = rule.clone();
|
91
|
+
declClone.value = "none";
|
92
|
+
newRule.walkDecls(declVal => declVal.remove());
|
93
|
+
newRule.append(declClone);
|
94
|
+
redRules.push(newRule);
|
95
|
+
}
|
96
|
+
});
|
97
|
+
}
|
98
|
+
} else {
|
99
|
+
//animation none push to reduced motion
|
100
|
+
//console.log(atrule)
|
101
|
+
rule.walkDecls(decl => {
|
102
|
+
if (decl != undefined && decl.prop.includes("animation")) {
|
103
|
+
let declClone = decl.clone();
|
104
|
+
let newRule = rule.clone();
|
105
|
+
declClone.value = "none";
|
106
|
+
newRule.walkDecls(declVal => declVal.remove());
|
107
|
+
newRule.append(declClone);
|
108
|
+
redRules.push(newRule);
|
109
|
+
}
|
110
|
+
});
|
111
|
+
}
|
112
|
+
}
|
113
|
+
});
|
114
|
+
|
115
|
+
if (redRules.length > 0) {
|
116
|
+
let redMtnQuery = (0, _postcss.atRule)({
|
117
|
+
name: "media",
|
118
|
+
params: "(prefers-reduced-motion)"
|
119
|
+
});
|
120
|
+
root.append(redMtnQuery).last;
|
121
|
+
redRules.map(rule => {
|
122
|
+
redMtnQuery.append(rule);
|
123
|
+
});
|
124
|
+
}
|
125
|
+
};
|
126
|
+
});
|
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,7 +65,10 @@ 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
74
|
version: 'default',
|
@@ -148,7 +156,10 @@ var _default = {
|
|
148
156
|
disableES5Transpile: false,
|
149
157
|
isReactMig: false,
|
150
158
|
hasWidget: false,
|
151
|
-
hasEFC:
|
159
|
+
hasEFC: {
|
160
|
+
value: false,
|
161
|
+
cli: 'enable_efc'
|
162
|
+
},
|
152
163
|
enableChunkHash: {
|
153
164
|
value: false,
|
154
165
|
cli: 'hash_enable'
|
@@ -204,6 +215,8 @@ var _default = {
|
|
204
215
|
value: 'zd',
|
205
216
|
cli: 'class_prefix'
|
206
217
|
},
|
218
|
+
combinerMq: false,
|
219
|
+
hoverActive: false,
|
207
220
|
selectorReplace: null,
|
208
221
|
devConsoleExculde: {
|
209
222
|
value: false,
|
@@ -256,7 +269,12 @@ var _default = {
|
|
256
269
|
value: true,
|
257
270
|
cli: 'css_unique'
|
258
271
|
},
|
272
|
+
enableChunkHash: false,
|
273
|
+
combinerMq: false,
|
274
|
+
hoverActive: false,
|
275
|
+
keyframesRedMtn: false,
|
259
276
|
folder: 'src',
|
277
|
+
disableES5Transpile: false,
|
260
278
|
hasRTL: false,
|
261
279
|
rtlExclude: [],
|
262
280
|
cssHashSelectors: {
|
@@ -553,6 +571,10 @@ var _default = {
|
|
553
571
|
value: null,
|
554
572
|
cli: 'clone_revision'
|
555
573
|
},
|
574
|
+
shallowClone: {
|
575
|
+
value: false,
|
576
|
+
cli: 'shallow_clone'
|
577
|
+
},
|
556
578
|
projectName: {
|
557
579
|
value: null,
|
558
580
|
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`);
|
@@ -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
|
+
}));
|