@zohodesk/react-cli 1.1.14-exp.3 → 1.1.14-kubernetes
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 +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
@@ -0,0 +1,244 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const postcss = require('postcss');
|
4
|
+
|
5
|
+
const path = require('path');
|
6
|
+
|
7
|
+
const fs = require('fs');
|
8
|
+
|
9
|
+
function populateArray(start, end) {
|
10
|
+
let temp = [];
|
11
|
+
|
12
|
+
for (var i = start; i < end; i++) {
|
13
|
+
temp.push(i);
|
14
|
+
}
|
15
|
+
|
16
|
+
return temp;
|
17
|
+
}
|
18
|
+
|
19
|
+
let allwdVars = {
|
20
|
+
'font-size': ['px', 'em']
|
21
|
+
};
|
22
|
+
let numberObject = {
|
23
|
+
'font-size': {
|
24
|
+
allowed: ['px', 'em'],
|
25
|
+
replacements: {
|
26
|
+
px: 'var(--zd_font_size$$)',
|
27
|
+
em: 'var(--zd_font_size$$em)'
|
28
|
+
},
|
29
|
+
//[5,10,15,20,25],
|
30
|
+
available: populateArray(0, 251),
|
31
|
+
replacementValues: {
|
32
|
+
px: [],
|
33
|
+
em: []
|
34
|
+
}
|
35
|
+
},
|
36
|
+
'margin': {
|
37
|
+
allowed: ['px'],
|
38
|
+
replacements: {
|
39
|
+
px: 'var(--zd_size$$)'
|
40
|
+
},
|
41
|
+
available: populateArray(-250, 251),
|
42
|
+
replacementValues: {
|
43
|
+
px: []
|
44
|
+
}
|
45
|
+
},
|
46
|
+
'margin-left': {
|
47
|
+
allowed: ['px'],
|
48
|
+
replacements: {
|
49
|
+
px: 'var(--zd_size$$)'
|
50
|
+
},
|
51
|
+
available: populateArray(-250, 251),
|
52
|
+
replacementValues: {
|
53
|
+
px: []
|
54
|
+
}
|
55
|
+
},
|
56
|
+
'margin-right': {
|
57
|
+
allowed: ['px'],
|
58
|
+
replacements: {
|
59
|
+
px: 'var(--zd_size$$)'
|
60
|
+
},
|
61
|
+
available: populateArray(-250, 251),
|
62
|
+
replacementValues: {
|
63
|
+
px: []
|
64
|
+
}
|
65
|
+
},
|
66
|
+
'margin-top': {
|
67
|
+
allowed: ['px'],
|
68
|
+
replacements: {
|
69
|
+
px: 'var(--zd_size$$)'
|
70
|
+
},
|
71
|
+
available: populateArray(-250, 251),
|
72
|
+
replacementValues: {
|
73
|
+
px: []
|
74
|
+
}
|
75
|
+
},
|
76
|
+
'margin-bottom': {
|
77
|
+
allowed: ['px'],
|
78
|
+
replacements: {
|
79
|
+
px: 'var(--zd_size$$)'
|
80
|
+
},
|
81
|
+
available: populateArray(-250, 251),
|
82
|
+
replacementValues: {
|
83
|
+
px: []
|
84
|
+
}
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
function hasIgnoreComment(node) {
|
89
|
+
return node ? node.type == 'comment' ? node.text == 'Variable:Ignore' ? true : false : false : false;
|
90
|
+
}
|
91
|
+
|
92
|
+
let errors = [];
|
93
|
+
module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal => {
|
94
|
+
// console.log('inside postcss plugin')
|
95
|
+
// fs.writeFile('./css_error.log', '\r\nLog File: \r\n\r\n', (err) => {
|
96
|
+
// if(err)console.log(err);
|
97
|
+
// });
|
98
|
+
// console.log(rootOriginal.source.input.file);
|
99
|
+
if (!rootOriginal.source.input.file.includes('css_error')) {
|
100
|
+
rootOriginal.walkRules(rule => {
|
101
|
+
rule.walkDecls((decl, position) => {
|
102
|
+
// case font-size
|
103
|
+
if (!hasIgnoreComment(rule.nodes[position - 1])) {
|
104
|
+
console.log(settings);
|
105
|
+
let unit = decl.value.replace(/[0-9]/g, '');
|
106
|
+
let settings = numberObject[decl.prop];
|
107
|
+
let path = rootOriginal.source.input.from;
|
108
|
+
let filename = path.split('\\');
|
109
|
+
filename = filename[filename.length - 1];
|
110
|
+
|
111
|
+
if (decl.prop === 'font-size' || decl.prop === 'margin-left' || decl.prop === 'margin-right' || decl.prop === 'margin-top' || decl.prop === 'margin-bottom') {
|
112
|
+
let {
|
113
|
+
allowed,
|
114
|
+
replacements,
|
115
|
+
available
|
116
|
+
} = settings;
|
117
|
+
|
118
|
+
if (!rootOriginal.source.input.from.includes('node_modules')) {
|
119
|
+
if (unit != 0) {
|
120
|
+
if (allowed.includes(unit)) {
|
121
|
+
// console.log(available, parseInt(decl.value))
|
122
|
+
if (available.includes(parseInt(decl.value))) {
|
123
|
+
// replacementValues[unit].push({[decl.value] : replacements[unit].replace('$$', parseInt(decl.value))})
|
124
|
+
decl.value = replacements[unit].replace('$$', parseInt(decl.value)); //console.log("replacements:")
|
125
|
+
} else {
|
126
|
+
let err = {
|
127
|
+
prop: decl.prop,
|
128
|
+
value: decl.value,
|
129
|
+
filename,
|
130
|
+
filepath: rootOriginal.source.input.from,
|
131
|
+
line: decl.source.start.line,
|
132
|
+
unit,
|
133
|
+
message: 'value not available consider others'
|
134
|
+
};
|
135
|
+
errors.push(err);
|
136
|
+
}
|
137
|
+
} else {
|
138
|
+
let err = {
|
139
|
+
prop: decl.prop,
|
140
|
+
value: decl.value,
|
141
|
+
filename,
|
142
|
+
filepath: rootOriginal.source.input.from,
|
143
|
+
line: decl.source.start.line,
|
144
|
+
unit,
|
145
|
+
message: 'Unit not supported'
|
146
|
+
};
|
147
|
+
errors.push(err);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
} else if (decl.prop === 'margin') {
|
152
|
+
let {
|
153
|
+
allowed,
|
154
|
+
replacements,
|
155
|
+
available
|
156
|
+
} = settings; //console.log(decl.prop + " " + decl.value)
|
157
|
+
|
158
|
+
let valArr = decl.value.split(' '); //console.log(valArr)
|
159
|
+
//console.log(allowed, replacements, available)
|
160
|
+
|
161
|
+
let hasError = false;
|
162
|
+
let newVal = '';
|
163
|
+
valArr.forEach(val => {
|
164
|
+
let unit = val.replace(parseInt(val), '');
|
165
|
+
let numVal = parseInt(val);
|
166
|
+
|
167
|
+
if (unit != 0) {
|
168
|
+
if (allowed.includes(unit)) {
|
169
|
+
if (available.includes(numVal)) {
|
170
|
+
if (numVal >= 0) {
|
171
|
+
if (!hasError) {
|
172
|
+
newVal += replacements[unit].replace('$$', numVal) + " ";
|
173
|
+
}
|
174
|
+
} else {
|
175
|
+
if (!hasError) {
|
176
|
+
newVal += `calc(${replacements[unit].replace('$$', numVal * -1)} * -1)` + " ";
|
177
|
+
}
|
178
|
+
}
|
179
|
+
} else {
|
180
|
+
hasError = true;
|
181
|
+
let err = {
|
182
|
+
prop: decl.prop,
|
183
|
+
value: numVal,
|
184
|
+
filename,
|
185
|
+
filepath: rootOriginal.source.input.from,
|
186
|
+
line: decl.source.start.line,
|
187
|
+
unit,
|
188
|
+
message: 'value not available consider others'
|
189
|
+
};
|
190
|
+
errors.push(err);
|
191
|
+
}
|
192
|
+
} else {
|
193
|
+
hasError = true;
|
194
|
+
let err = {
|
195
|
+
prop: decl.prop,
|
196
|
+
value: decl.value,
|
197
|
+
filename,
|
198
|
+
filepath: rootOriginal.source.input.from,
|
199
|
+
line: decl.source.start.line,
|
200
|
+
unit,
|
201
|
+
message: 'Unit not supported'
|
202
|
+
};
|
203
|
+
errors.push(err);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
});
|
207
|
+
|
208
|
+
if (!hasError) {
|
209
|
+
decl.value = newVal;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
});
|
214
|
+
}); //fs.writeFile('./src/trial.json', JSON.stringify(variables) ,(err) =>{
|
215
|
+
// if(err)console.log(err);
|
216
|
+
// else{
|
217
|
+
// console.log('updated successfully');
|
218
|
+
// }
|
219
|
+
// })
|
220
|
+
// console.log(errors)
|
221
|
+
|
222
|
+
let errorArr = [];
|
223
|
+
errors.forEach(errStr => {
|
224
|
+
errorArr.push(` prop: ${errStr.prop} ,\n value : ${errStr.value} ,\n filename : ${errStr.filename} ,\n filepath : ${errStr.filepath} ,\n line : ${errStr.line} ,\n unit : ${errStr.unit} ,\n message : ${errStr.message} \r`);
|
225
|
+
}); //fs.writeFile('./css_error.log','', (err) =>{
|
226
|
+
// if(err){
|
227
|
+
// console.log(err);
|
228
|
+
// }
|
229
|
+
//});
|
230
|
+
// errorArr.forEach(err => {
|
231
|
+
// let data = `\n{\n${err}\n},\n`;
|
232
|
+
// //fs.appendFile('./css_error.log',data,(err)=>{
|
233
|
+
// // if(err){
|
234
|
+
// // console.log(err);
|
235
|
+
// // }
|
236
|
+
// //})
|
237
|
+
// });
|
238
|
+
// fs.writeFileSync('./css_error.log','');
|
239
|
+
// errorArr.forEach(err => {
|
240
|
+
// let data = `\n{\n${err}\n},\n`;
|
241
|
+
// fs.appendFileSync('./css_error.log',data);
|
242
|
+
// });
|
243
|
+
}
|
244
|
+
});
|
package/lib/schemas/index.js
CHANGED
@@ -15,6 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
15
15
|
|
16
16
|
// TODO move deprecated options to separate file and manage seperately
|
17
17
|
var _default = {
|
18
|
+
cliRootPath: null,
|
18
19
|
unstableDepsInverse: {
|
19
20
|
value: false,
|
20
21
|
cli: 'unstable_deps_inverse'
|
@@ -35,9 +36,6 @@ var _default = {
|
|
35
36
|
cli: 'stop_nodemon'
|
36
37
|
}
|
37
38
|
},
|
38
|
-
resourceHints: {
|
39
|
-
allowPrefetchingMultipleChunks: false
|
40
|
-
},
|
41
39
|
i18n: {
|
42
40
|
chunkSplitEnable: {
|
43
41
|
value: false,
|
@@ -65,39 +63,7 @@ var _default = {
|
|
65
63
|
// ],
|
66
64
|
templateLabel: '{{--dir}}',
|
67
65
|
disableMiniFiySelector: false,
|
68
|
-
dirVarName: 'document.dir'
|
69
|
-
selectorReplace: {
|
70
|
-
before: [],
|
71
|
-
after: []
|
72
|
-
},
|
73
|
-
plugins: null,
|
74
|
-
// @type {Boolean | Array}
|
75
|
-
postCssPluginOrder: null,
|
76
|
-
patterns: {
|
77
|
-
valueReplacer: [],
|
78
|
-
selectorReplace: [],
|
79
|
-
hoverActive: [],
|
80
|
-
combinerMediaQuery: [],
|
81
|
-
hasRTL: [],
|
82
|
-
cssVariableReplacement: [],
|
83
|
-
selectorWeight: [],
|
84
|
-
cssUniqueness: [],
|
85
|
-
composeMinification: []
|
86
|
-
},
|
87
|
-
exclude: {
|
88
|
-
rtl: [],
|
89
|
-
hoverActive: [],
|
90
|
-
combinerMediaQuery: [],
|
91
|
-
cssVariableReplacement: [],
|
92
|
-
selectorWeight: [],
|
93
|
-
hasRTL: []
|
94
|
-
},
|
95
|
-
cssVariableReplacementConfig: '',
|
96
|
-
selectorWeightConfig: {
|
97
|
-
defaultSelector: '',
|
98
|
-
customFileDetails: '',
|
99
|
-
excludeStrings: []
|
100
|
-
}
|
66
|
+
dirVarName: 'document.dir'
|
101
67
|
},
|
102
68
|
efc: {
|
103
69
|
hasEFC: {
|
@@ -126,10 +92,9 @@ var _default = {
|
|
126
92
|
},
|
127
93
|
app: {
|
128
94
|
moduleResolvePath: {
|
129
|
-
value: '
|
95
|
+
value: '',
|
130
96
|
cli: 'module_resolve_path'
|
131
97
|
},
|
132
|
-
customClassNamePrefix: [],
|
133
98
|
// this option only for impact testing
|
134
99
|
devCssFileBountry: {
|
135
100
|
value: '',
|
@@ -159,13 +124,6 @@ var _default = {
|
|
159
124
|
filenames: [],
|
160
125
|
packages: []
|
161
126
|
},
|
162
|
-
customAttributes: {
|
163
|
-
enable: false,
|
164
|
-
attributes: null,
|
165
|
-
jsAttributes: null,
|
166
|
-
cssAttributes: null,
|
167
|
-
i18nAttributes: null
|
168
|
-
},
|
169
127
|
server: {
|
170
128
|
host: {
|
171
129
|
value: (0, _os.hostname)(),
|
@@ -263,26 +221,19 @@ var _default = {
|
|
263
221
|
value: true,
|
264
222
|
cli: 'enable_smaphook'
|
265
223
|
},
|
266
|
-
plugins:
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
combinerMediaQuery: [],
|
273
|
-
hasRTL: [],
|
274
|
-
cssVariableReplacement: [],
|
275
|
-
selectorWeight: [],
|
276
|
-
cssUniqueness: [],
|
277
|
-
composeMinification: []
|
224
|
+
plugins: {
|
225
|
+
hasRTL: false,
|
226
|
+
hoverActive: false,
|
227
|
+
combinerMediaQuery: false,
|
228
|
+
cssVariableReplacement: false,
|
229
|
+
selectorWeight: false
|
278
230
|
},
|
279
231
|
exclude: {
|
280
232
|
rtl: [],
|
281
233
|
hoverActive: [],
|
282
234
|
combinerMediaQuery: [],
|
283
235
|
cssVariableReplacement: [],
|
284
|
-
selectorWeight: []
|
285
|
-
hasRTL: []
|
236
|
+
selectorWeight: []
|
286
237
|
},
|
287
238
|
cssVariableReplacementConfig: '',
|
288
239
|
selectorWeightConfig: {
|
@@ -321,7 +272,6 @@ var _default = {
|
|
321
272
|
inject: true
|
322
273
|
},
|
323
274
|
removePropTypes: false,
|
324
|
-
customChunksBaseConfig: null,
|
325
275
|
customChunks: [{
|
326
276
|
name: 'styles',
|
327
277
|
pattern: '\\.css$'
|
@@ -357,7 +307,6 @@ var _default = {
|
|
357
307
|
hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
|
358
308
|
none: '(hover: none)'
|
359
309
|
},
|
360
|
-
customClassNamePrefix: [],
|
361
310
|
componentFolder: 'src',
|
362
311
|
cssUniqueness: {
|
363
312
|
value: true,
|
@@ -368,35 +317,20 @@ var _default = {
|
|
368
317
|
disableES5Transpile: false,
|
369
318
|
// TODO: Deprecated
|
370
319
|
hasRTL: false,
|
371
|
-
enableReactLive: {
|
372
|
-
value: true,
|
373
|
-
cli: 'react_live'
|
374
|
-
},
|
375
|
-
enableMDParser: {
|
376
|
-
value: true,
|
377
|
-
cli: 'markdown_parser'
|
378
|
-
},
|
379
320
|
rtlExclude: [],
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
hoverActive: [],
|
387
|
-
combinerMediaQuery: [],
|
388
|
-
hasRTL: [],
|
389
|
-
cssVariableReplacement: [],
|
390
|
-
selectorWeight: [],
|
391
|
-
cssUniqueness: []
|
321
|
+
plugins: {
|
322
|
+
hasRTL: false,
|
323
|
+
hoverActive: false,
|
324
|
+
combinerMediaQuery: false,
|
325
|
+
cssVariableReplacement: false,
|
326
|
+
selectorWeight: false
|
392
327
|
},
|
393
328
|
exclude: {
|
394
329
|
rtl: [],
|
395
330
|
hoverActive: [],
|
396
331
|
combinerMediaQuery: [],
|
397
332
|
cssVariableReplacement: [],
|
398
|
-
selectorWeight: []
|
399
|
-
hasRTL: []
|
333
|
+
selectorWeight: []
|
400
334
|
},
|
401
335
|
cssVariableReplacementConfig: '',
|
402
336
|
selectorWeightConfig: {
|
@@ -723,16 +657,6 @@ var _default = {
|
|
723
657
|
cli: 'module_mode'
|
724
658
|
},
|
725
659
|
disableES5Transpile: true
|
726
|
-
}
|
727
|
-
stats: {
|
728
|
-
enable: {
|
729
|
-
value: false,
|
730
|
-
cli: 'enable_stats'
|
731
|
-
},
|
732
|
-
fileName: null,
|
733
|
-
options: null,
|
734
|
-
excludeKeys: null
|
735
|
-
},
|
736
|
-
externals: null
|
660
|
+
}
|
737
661
|
};
|
738
662
|
exports.default = _default;
|
package/lib/servers/devBuild.js
CHANGED
@@ -15,8 +15,6 @@ var _utils = require("../utils");
|
|
15
15
|
|
16
16
|
var _getCliPath = require("./getCliPath");
|
17
17
|
|
18
|
-
var _logger = require("../logger");
|
19
|
-
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
19
|
|
22
20
|
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
@@ -37,28 +35,28 @@ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).nam
|
|
37
35
|
const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
|
38
36
|
|
39
37
|
function execSyncDefalut(command) {
|
40
|
-
|
38
|
+
console.log(' command running ==>', command);
|
41
39
|
return (0, _child_process.execSync)(command, {
|
42
40
|
stdio: 'inherit'
|
43
41
|
});
|
44
42
|
}
|
45
43
|
|
46
44
|
const isQuiet = 'q';
|
47
|
-
const webpack = (0, _getCliPath.getCliPath)('webpack'); //
|
45
|
+
const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
|
48
46
|
|
49
47
|
if (_fs.default.existsSync(outputFolderLocation)) {
|
50
48
|
execSyncDefalut(`rm -rf ${outputFolder}`);
|
51
|
-
|
49
|
+
console.log(`previous ${outputFolder} removed`);
|
52
50
|
}
|
53
51
|
|
54
52
|
if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
|
55
53
|
execSyncDefalut('rm build.zip');
|
56
|
-
|
54
|
+
console.log('previous build.zip removed');
|
57
55
|
} // execSyncDefalut(`${webpack } --version`);
|
58
56
|
// execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
59
57
|
|
60
58
|
|
61
|
-
|
59
|
+
console.log('webpack compilation starts...');
|
62
60
|
const startTime = Date.now(); // const result = spawnSync(
|
63
61
|
// webpack,
|
64
62
|
// ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
|
@@ -69,31 +67,31 @@ const startTime = Date.now(); // const result = spawnSync(
|
|
69
67
|
// --disable_watch=true
|
70
68
|
|
71
69
|
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
72
|
-
result &&
|
70
|
+
result && console.log(result);
|
73
71
|
|
74
72
|
if (result && result.stderr) {
|
75
73
|
throw result.stderr;
|
76
74
|
}
|
77
75
|
|
78
|
-
|
76
|
+
console.log(`compailation done in ${Date.now() - startTime}ms`);
|
79
77
|
|
80
78
|
if (zipname) {
|
81
79
|
execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
|
82
|
-
|
80
|
+
console.log('build.zip file created');
|
83
81
|
const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
|
84
82
|
execSyncDefalut(`rm -rf ${zipname}`);
|
85
83
|
|
86
84
|
if (result && result.stderr) {
|
87
|
-
|
85
|
+
console.log('zip file not created', cssSelectorZipPath);
|
88
86
|
console.error(result.stderr);
|
89
87
|
} else {
|
90
|
-
|
88
|
+
console.log('zip file created', cssSelectorZipPath);
|
91
89
|
}
|
92
90
|
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
93
91
|
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
94
92
|
|
95
93
|
|
96
|
-
|
94
|
+
console.log(`compailation done in ${Date.now() - startTime}ms`);
|
97
95
|
|
98
96
|
function getPaths() {
|
99
97
|
return {
|
@@ -5,17 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getCliPath = getCliPath;
|
7
7
|
|
8
|
-
var _path = require("path");
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
10
|
var _os = require("os");
|
11
11
|
|
12
12
|
var _fs = require("fs");
|
13
13
|
|
14
|
-
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
+
const appPath = process.cwd();
|
17
|
+
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
16
18
|
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
17
19
|
|
18
|
-
const _getCliPath = libName =>
|
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
|
|
@@ -6,17 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.httpsOptions = httpsOptions;
|
7
7
|
exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
// import fs from 'fs';
|
10
|
+
// import path from 'path';
|
11
|
+
// export const httpsOptions = {
|
12
|
+
// key: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.key')),
|
13
|
+
// cert: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.crt'))
|
14
|
+
// };
|
15
15
|
function httpsOptions(options) {
|
16
16
|
const {
|
17
17
|
httpsCerts
|
18
18
|
} = options.app.server;
|
19
|
-
|
19
|
+
|
20
|
+
const certificate = require(require.resolve(httpsCerts, {
|
21
|
+
paths: [process.cwd()]
|
22
|
+
})); // TODO: in future we may do some version based check. certificate.version
|
23
|
+
|
20
24
|
|
21
25
|
return certificate.httpsOptions;
|
22
26
|
}
|
@@ -32,16 +36,13 @@ function httpsOptionsWithUserFriendlyError(options) {
|
|
32
36
|
return certificate;
|
33
37
|
} catch (error) {
|
34
38
|
if (error.message.indexOf('Cannot find module') !== -1) {
|
35
|
-
|
39
|
+
console.error(`You have given react-cli.app.server.httpsCerts as "${httpsCerts}". \n But it seems that file path have some problem.\n we are unable to locate "${httpsCerts}" in "${process.cwd()}"`);
|
36
40
|
} else {
|
37
|
-
|
41
|
+
console.error(error);
|
38
42
|
}
|
39
43
|
|
40
44
|
process.exit(0);
|
41
45
|
}
|
42
|
-
} else if (globalCertificate) {
|
43
|
-
(0, _logger.messageLogger)('global `@zohodesk-private/client_dev_cert` package taken as https certificate');
|
44
|
-
return globalCertificate.httpsOptions;
|
45
46
|
} else {
|
46
47
|
return null;
|
47
48
|
}
|