@zohodesk/react-cli 1.0.2 → 1.0.3-exp.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/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/Changelog.md +1019 -1019
- package/README.md +1209 -1165
- package/bin/cli.js +489 -483
- package/docs/ComposeMinification.md +14 -0
- package/docs/CustomChunks.md +26 -26
- package/docs/DevServerPort.md +39 -39
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/SelectorWeight.md +8 -8
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +729 -729
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/buildEs.js +12 -0
- package/lib/common/testPattern.js +0 -2
- package/lib/common/valueReplacer.js +1 -3
- package/lib/configs/resolvers.js +14 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +6 -0
- package/lib/configs/webpack.docs.config.js +4 -0
- package/lib/configs/webpack.impact.config.js +4 -0
- package/lib/configs/webpack.prod.config.js +6 -0
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- package/lib/loaderUtils/getCSSLoaders.js +78 -49
- package/lib/loaderUtils/tests/windowsModification.test.js +10 -0
- package/lib/loaderUtils/windowsModification.js +6 -1
- package/lib/loaders/composeLoader.js +172 -0
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/logger.js +20 -0
- package/lib/pluginUtils/getDevPlugins.js +23 -8
- package/lib/pluginUtils/getProdPlugins.js +20 -8
- package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
- package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
- package/lib/plugins/CustomAttributePlugin.js +82 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +9 -9
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +10 -12
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -13
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +10 -15
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/{UglifyCSSPlugin.js → MinifyPlugin.js} +3 -3
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/SelectorPlugin.js +66 -48
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +94 -88
- package/lib/plugins/index.js +7 -7
- package/lib/plugins/utils/classHandling.js +20 -0
- package/lib/plugins/utils/fileHandling.js +107 -0
- package/lib/plugins/utils/tests/fileHandling.test.js +30 -0
- package/lib/postcss-plugins/EmptyPlugin.js +8 -0
- package/lib/postcss-plugins/ExcludePlugin.js +1 -1
- package/lib/postcss-plugins/IncludePlugin.js +0 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +14 -20
- package/lib/postcss-plugins/ValueReplacer.js +2 -13
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +3 -9
- package/lib/postcss-plugins/variableModificationPlugin/index.js +2 -21
- package/lib/schemas/index.js +39 -4
- package/lib/servers/devBuild.js +13 -11
- package/lib/servers/httpsOptions.js +12 -13
- package/lib/servers/nowatchserver.js +5 -3
- package/lib/servers/requireLocalOrGlobal.js +61 -0
- package/lib/servers/server.js +3 -5
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +38 -12
- package/lib/utils/getOptions.js +9 -0
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/variableConvertor.js +159 -0
- package/npm8.md +9 -9
- package/package-lock.json +14412 -0
- package/package.json +121 -120
- package/postpublish.js +8 -8
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1501
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/lib/plugins/composeCommonPlugin.js +0 -30
- package/lib/postcss-plugins/variableModifier.js +0 -244
- package/result.json +0 -1
- package/unittest/index.html +0 -37
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/*Hover_active:ignore*/
|
|
2
|
-
g,a:hover{
|
|
3
|
-
color : red
|
|
4
|
-
}
|
|
5
|
-
/*Hover:ignore*/
|
|
6
|
-
h:hover{
|
|
7
|
-
background : yellow
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Hover_active:ignore */
|
|
11
|
-
g,d+e:hover{
|
|
12
|
-
color : black
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
g,d e:hover{
|
|
16
|
-
color : black
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@media screen and (max-width:61.25em){
|
|
20
|
-
/* Hover_active:ignore */
|
|
21
|
-
a,b,a:hover, b:hover{
|
|
22
|
-
background-color : blue
|
|
23
|
-
}
|
|
24
|
-
a + b,a:hover + b:hover{
|
|
25
|
-
background-color : blue
|
|
26
|
-
}
|
|
27
|
-
a b:hover{
|
|
28
|
-
background-color : blue
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.cc:hover {
|
|
32
|
-
color: red;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
c:hover{
|
|
36
|
-
color : red
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
/*Hover_active:ignore*/
|
|
2
|
+
g,a:hover{
|
|
3
|
+
color : red
|
|
4
|
+
}
|
|
5
|
+
/*Hover:ignore*/
|
|
6
|
+
h:hover{
|
|
7
|
+
background : yellow
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Hover_active:ignore */
|
|
11
|
+
g,d+e:hover{
|
|
12
|
+
color : black
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
g,d e:hover{
|
|
16
|
+
color : black
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media screen and (max-width:61.25em){
|
|
20
|
+
/* Hover_active:ignore */
|
|
21
|
+
a,b,a:hover, b:hover{
|
|
22
|
+
background-color : blue
|
|
23
|
+
}
|
|
24
|
+
a + b,a:hover + b:hover{
|
|
25
|
+
background-color : blue
|
|
26
|
+
}
|
|
27
|
+
a b:hover{
|
|
28
|
+
background-color : blue
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cc:hover {
|
|
32
|
+
color: red;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
c:hover{
|
|
36
|
+
color : red
|
|
37
|
+
}
|
|
38
|
+
|
|
39
39
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/*Hover_active:ignore*/
|
|
2
|
-
g,a:hover{
|
|
3
|
-
color : red
|
|
4
|
-
}
|
|
5
|
-
/*Hover:ignore*/
|
|
6
|
-
h:hover{
|
|
7
|
-
background : yellow
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Hover_active:ignore */
|
|
11
|
-
g,d+e:hover{
|
|
12
|
-
color : black
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
g,d e:hover{
|
|
16
|
-
color : black
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@media screen and (max-width:61.25em){
|
|
20
|
-
/* Hover_active:ignore */
|
|
21
|
-
a,b,a:hover, b:hover{
|
|
22
|
-
background-color : blue
|
|
23
|
-
}
|
|
24
|
-
a + b,a:hover + b:hover{
|
|
25
|
-
background-color : blue
|
|
26
|
-
}
|
|
27
|
-
a b:hover{
|
|
28
|
-
background-color : blue
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.cc:hover {
|
|
32
|
-
color: red;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
c:hover{
|
|
36
|
-
color : red
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
/*Hover_active:ignore*/
|
|
2
|
+
g,a:hover{
|
|
3
|
+
color : red
|
|
4
|
+
}
|
|
5
|
+
/*Hover:ignore*/
|
|
6
|
+
h:hover{
|
|
7
|
+
background : yellow
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Hover_active:ignore */
|
|
11
|
+
g,d+e:hover{
|
|
12
|
+
color : black
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
g,d e:hover{
|
|
16
|
+
color : black
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media screen and (max-width:61.25em){
|
|
20
|
+
/* Hover_active:ignore */
|
|
21
|
+
a,b,a:hover, b:hover{
|
|
22
|
+
background-color : blue
|
|
23
|
+
}
|
|
24
|
+
a + b,a:hover + b:hover{
|
|
25
|
+
background-color : blue
|
|
26
|
+
}
|
|
27
|
+
a b:hover{
|
|
28
|
+
background-color : blue
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cc:hover {
|
|
32
|
+
color: red;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
c:hover{
|
|
36
|
+
color : red
|
|
37
|
+
}
|
|
38
|
+
|
|
39
39
|
}
|
|
@@ -4,9 +4,9 @@ var _postcss = _interopRequireDefault(require("postcss"));
|
|
|
4
4
|
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* we have give support for ignore(exclude) comments
|
|
9
|
-
* These are the comments' keyword
|
|
7
|
+
/**
|
|
8
|
+
* we have give support for ignore(exclude) comments
|
|
9
|
+
* These are the comments' keyword
|
|
10
10
|
*/
|
|
11
11
|
const hoverIgnoreQuery = 'Hover:ignore',
|
|
12
12
|
activeIgnoreQuery = 'Active:ignore',
|
|
@@ -158,7 +158,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
158
158
|
|
|
159
159
|
function mediaCommaQuery(rule, index) {
|
|
160
160
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
|
161
|
-
//console.log(hovMed, actMed);
|
|
162
161
|
let newSelector = '';
|
|
163
162
|
const {
|
|
164
163
|
hovMed,
|
|
@@ -232,7 +231,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
function commaQuery(rule, index) {
|
|
235
|
-
//console.log("comma" , rule.selector.split('\n'));
|
|
236
234
|
let newSelector = '';
|
|
237
235
|
const hovQueries = [];
|
|
238
236
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
|
@@ -288,13 +286,10 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
288
286
|
});
|
|
289
287
|
rootOriginal.walkRules(/:hover/i, (rule, index) => {
|
|
290
288
|
// media hover query with ',' ' ' '+'
|
|
291
|
-
// console.log("media query" , rule.selector)
|
|
292
289
|
if (rule.parent.type === 'atrule' && rule.selector.includes(',')) {
|
|
293
|
-
//console.log("media comma", rule.selector)
|
|
294
290
|
mediaCommaQuery(rule, index);
|
|
295
291
|
} else {
|
|
296
292
|
// plus, space and other media queries
|
|
297
|
-
//console.log("media", rule.selector)
|
|
298
293
|
mediaQuery(rule, index);
|
|
299
294
|
} // usual hover query
|
|
300
295
|
|
|
@@ -311,7 +306,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
311
306
|
if (rule.selector.includes(',')) {
|
|
312
307
|
commaQuery(rule, index);
|
|
313
308
|
} else if (rule.selector.match(/ +|\++/g)) {
|
|
314
|
-
//console.log("plus or space" , rule.selector);
|
|
315
309
|
if (rule.selector.includes('hover')) {
|
|
316
310
|
hoverRules.push({
|
|
317
311
|
rule,
|
|
@@ -127,25 +127,7 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
|
127
127
|
path: path
|
|
128
128
|
};
|
|
129
129
|
errHandler.errorTable.push(errObj);
|
|
130
|
-
errHandler.errorFunction(errObj);
|
|
131
|
-
// {
|
|
132
|
-
// decl,
|
|
133
|
-
// type: 'RANGE_ERROR',
|
|
134
|
-
// filename,
|
|
135
|
-
// message: `value (${value}) (${typeof value}) not within range (${
|
|
136
|
-
// range.start
|
|
137
|
-
// },${range.end})\r`,
|
|
138
|
-
// path: path
|
|
139
|
-
// },
|
|
140
|
-
// 'RANGE_ERROR'
|
|
141
|
-
// );
|
|
142
|
-
// }
|
|
143
|
-
// addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n message : value (${value}) not within range (${range.start},${range.end})\r`)
|
|
144
|
-
// return value;
|
|
145
|
-
// } else {
|
|
146
|
-
// console.log('++++++++++++++++++++++rect val!', value);
|
|
147
|
-
// }
|
|
148
|
-
|
|
130
|
+
errHandler.errorFunction(errObj);
|
|
149
131
|
return;
|
|
150
132
|
};
|
|
151
133
|
|
|
@@ -206,8 +188,7 @@ module.exports = {
|
|
|
206
188
|
}
|
|
207
189
|
|
|
208
190
|
if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
|
|
209
|
-
const settings = settingsObject[decl.prop];
|
|
210
|
-
|
|
191
|
+
const settings = settingsObject[decl.prop];
|
|
211
192
|
const {
|
|
212
193
|
allowed,
|
|
213
194
|
range
|
package/lib/schemas/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var _default = {
|
|
|
92
92
|
},
|
|
93
93
|
app: {
|
|
94
94
|
moduleResolvePath: {
|
|
95
|
-
value: '',
|
|
95
|
+
value: '@zohodesk/client_packages_group',
|
|
96
96
|
cli: 'module_resolve_path'
|
|
97
97
|
},
|
|
98
98
|
// this option only for impact testing
|
|
@@ -124,6 +124,13 @@ var _default = {
|
|
|
124
124
|
filenames: [],
|
|
125
125
|
packages: []
|
|
126
126
|
},
|
|
127
|
+
customAttributes: {
|
|
128
|
+
enable: false,
|
|
129
|
+
attributes: null,
|
|
130
|
+
jsAttributes: null,
|
|
131
|
+
cssAttributes: null,
|
|
132
|
+
i18nAttributes: null
|
|
133
|
+
},
|
|
127
134
|
server: {
|
|
128
135
|
host: {
|
|
129
136
|
value: (0, _os.hostname)(),
|
|
@@ -222,12 +229,28 @@ var _default = {
|
|
|
222
229
|
cli: 'enable_smaphook'
|
|
223
230
|
},
|
|
224
231
|
plugins: {
|
|
232
|
+
valueReplacer: false,
|
|
233
|
+
selectorReplace: false,
|
|
225
234
|
hasRTL: false,
|
|
226
235
|
hoverActive: false,
|
|
227
236
|
combinerMediaQuery: false,
|
|
228
237
|
cssVariableReplacement: false,
|
|
229
|
-
selectorWeight: false
|
|
238
|
+
selectorWeight: false,
|
|
239
|
+
minifier: false,
|
|
240
|
+
composeMinification: false
|
|
241
|
+
},
|
|
242
|
+
patterns: {
|
|
243
|
+
valueReplacer: [],
|
|
244
|
+
selectorReplace: [],
|
|
245
|
+
hoverActive: [],
|
|
246
|
+
combinerMediaQuery: [],
|
|
247
|
+
hasRTL: [],
|
|
248
|
+
cssVariableReplacement: [],
|
|
249
|
+
selectorWeight: [],
|
|
250
|
+
cssUniqueness: [],
|
|
251
|
+
composeMinification: []
|
|
230
252
|
},
|
|
253
|
+
patternsRootDir: '',
|
|
231
254
|
exclude: {
|
|
232
255
|
rtl: [],
|
|
233
256
|
hoverActive: [],
|
|
@@ -319,11 +342,23 @@ var _default = {
|
|
|
319
342
|
hasRTL: false,
|
|
320
343
|
rtlExclude: [],
|
|
321
344
|
plugins: {
|
|
322
|
-
|
|
345
|
+
rtl: false,
|
|
323
346
|
hoverActive: false,
|
|
324
347
|
combinerMediaQuery: false,
|
|
325
348
|
cssVariableReplacement: false,
|
|
326
|
-
selectorWeight: false
|
|
349
|
+
selectorWeight: false,
|
|
350
|
+
minifier: false,
|
|
351
|
+
composeMinification: false
|
|
352
|
+
},
|
|
353
|
+
patternsRootDir: '',
|
|
354
|
+
patterns: {
|
|
355
|
+
valueReplacer: [],
|
|
356
|
+
selectorReplace: [],
|
|
357
|
+
hoverActive: [],
|
|
358
|
+
combinerMediaQuery: [],
|
|
359
|
+
hasRTL: [],
|
|
360
|
+
cssVariableReplacement: [],
|
|
361
|
+
selectorWeight: []
|
|
327
362
|
},
|
|
328
363
|
exclude: {
|
|
329
364
|
rtl: [],
|
package/lib/servers/devBuild.js
CHANGED
|
@@ -15,6 +15,8 @@ var _utils = require("../utils");
|
|
|
15
15
|
|
|
16
16
|
var _getCliPath = require("./getCliPath");
|
|
17
17
|
|
|
18
|
+
var _logger = require("../logger");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
22
|
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
|
@@ -35,28 +37,28 @@ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).nam
|
|
|
35
37
|
const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
|
|
36
38
|
|
|
37
39
|
function execSyncDefalut(command) {
|
|
38
|
-
|
|
40
|
+
(0, _logger.messageLogger)(' command running ==>', command);
|
|
39
41
|
return (0, _child_process.execSync)(command, {
|
|
40
42
|
stdio: 'inherit'
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
const isQuiet = 'q';
|
|
45
|
-
const webpack = (0, _getCliPath.getCliPath)('webpack'); //
|
|
47
|
+
const webpack = (0, _getCliPath.getCliPath)('webpack'); // messageLogger('webpack === > ', webpack, fs.existsSync(webpack));
|
|
46
48
|
|
|
47
49
|
if (_fs.default.existsSync(outputFolderLocation)) {
|
|
48
50
|
execSyncDefalut(`rm -rf ${outputFolder}`);
|
|
49
|
-
|
|
51
|
+
(0, _logger.messageLogger)(`previous ${outputFolder} removed`);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
|
|
53
55
|
execSyncDefalut('rm build.zip');
|
|
54
|
-
|
|
56
|
+
(0, _logger.messageLogger)('previous build.zip removed');
|
|
55
57
|
} // execSyncDefalut(`${webpack } --version`);
|
|
56
58
|
// execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
|
57
59
|
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
(0, _logger.messageLogger)('webpack compilation starts...');
|
|
60
62
|
const startTime = Date.now(); // const result = spawnSync(
|
|
61
63
|
// webpack,
|
|
62
64
|
// ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
|
|
@@ -67,31 +69,31 @@ const startTime = Date.now(); // const result = spawnSync(
|
|
|
67
69
|
// --disable_watch=true
|
|
68
70
|
|
|
69
71
|
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
|
70
|
-
result &&
|
|
72
|
+
result && (0, _logger.messageLogger)(result);
|
|
71
73
|
|
|
72
74
|
if (result && result.stderr) {
|
|
73
75
|
throw result.stderr;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
|
77
79
|
|
|
78
80
|
if (zipname) {
|
|
79
81
|
execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
|
|
80
|
-
|
|
82
|
+
(0, _logger.messageLogger)('build.zip file created');
|
|
81
83
|
const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
|
|
82
84
|
execSyncDefalut(`rm -rf ${zipname}`);
|
|
83
85
|
|
|
84
86
|
if (result && result.stderr) {
|
|
85
|
-
|
|
87
|
+
(0, _logger.messageLogger)('zip file not created', cssSelectorZipPath);
|
|
86
88
|
console.error(result.stderr);
|
|
87
89
|
} else {
|
|
88
|
-
|
|
90
|
+
(0, _logger.messageLogger)('zip file created', cssSelectorZipPath);
|
|
89
91
|
}
|
|
90
92
|
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
|
91
93
|
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
|
92
94
|
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
(0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
|
|
95
97
|
|
|
96
98
|
function getPaths() {
|
|
97
99
|
return {
|
|
@@ -6,21 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.httpsOptions = httpsOptions;
|
|
7
7
|
exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
var _logger = require("../logger");
|
|
10
|
+
|
|
11
|
+
var _requireLocalOrGlobal = require("./requireLocalOrGlobal");
|
|
12
|
+
|
|
13
|
+
const globalCertificate = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk-private/client_dev_cert');
|
|
14
|
+
|
|
15
15
|
function httpsOptions(options) {
|
|
16
16
|
const {
|
|
17
17
|
httpsCerts
|
|
18
18
|
} = options.app.server;
|
|
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
|
-
|
|
19
|
+
const certificate = (0, _requireLocalOrGlobal.requireLocalOrGlobal)(httpsCerts); // TODO: in future we may do some version based check. certificate.version
|
|
24
20
|
|
|
25
21
|
return certificate.httpsOptions;
|
|
26
22
|
}
|
|
@@ -36,13 +32,16 @@ function httpsOptionsWithUserFriendlyError(options) {
|
|
|
36
32
|
return certificate;
|
|
37
33
|
} catch (error) {
|
|
38
34
|
if (error.message.indexOf('Cannot find module') !== -1) {
|
|
39
|
-
|
|
35
|
+
(0, _logger.errorLogger)(`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()}"`);
|
|
40
36
|
} else {
|
|
41
|
-
|
|
37
|
+
(0, _logger.errorLogger)(error);
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
process.exit(0);
|
|
45
41
|
}
|
|
42
|
+
} else if (globalCertificate) {
|
|
43
|
+
(0, _logger.messageLogger)('global `@zohodesk-private/client_dev_cert` package taken as https certificate');
|
|
44
|
+
return globalCertificate.httpsOptions;
|
|
46
45
|
} else {
|
|
47
46
|
return null;
|
|
48
47
|
}
|
|
@@ -16,6 +16,8 @@ var _httpsOptions = require("./httpsOptions");
|
|
|
16
16
|
|
|
17
17
|
var _devBuild = require("./devBuild");
|
|
18
18
|
|
|
19
|
+
var _logger = require("../logger");
|
|
20
|
+
|
|
19
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
22
|
|
|
21
23
|
// import webpack from 'webpack';
|
|
@@ -128,7 +130,7 @@ if (zipname) {
|
|
|
128
130
|
throw err;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
(0, _logger.messageLogger)(`${zipname}.zip downloaded`);
|
|
132
134
|
});
|
|
133
135
|
});
|
|
134
136
|
app.use('/zips/build.zip', (req, res) => {
|
|
@@ -137,7 +139,7 @@ if (zipname) {
|
|
|
137
139
|
throw err;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
(0, _logger.messageLogger)('build.zip downloaded');
|
|
141
143
|
});
|
|
142
144
|
});
|
|
143
145
|
}
|
|
@@ -188,7 +190,7 @@ if (httpsOptions) {
|
|
|
188
190
|
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
|
189
191
|
});
|
|
190
192
|
} else {
|
|
191
|
-
(0, _utils.log)(
|
|
193
|
+
(0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.globalNodeModules = void 0;
|
|
7
|
+
exports.requireGlobal = requireGlobal;
|
|
8
|
+
exports.requireLocal = requireLocal;
|
|
9
|
+
exports.requireLocalOrGlobal = requireLocalOrGlobal;
|
|
10
|
+
|
|
11
|
+
var _child_process = require("child_process");
|
|
12
|
+
|
|
13
|
+
var _path = _interopRequireDefault(require("path"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
const globalNodeModules = _path.default.join(`${(0, _child_process.execSync)('npm config get prefix')}`.trim(), 'lib');
|
|
18
|
+
|
|
19
|
+
exports.globalNodeModules = globalNodeModules;
|
|
20
|
+
|
|
21
|
+
function requireLocalOrGlobal(moduleName, opts = {}) {
|
|
22
|
+
let {
|
|
23
|
+
global = true
|
|
24
|
+
} = opts;
|
|
25
|
+
const {
|
|
26
|
+
local = true
|
|
27
|
+
} = opts;
|
|
28
|
+
const isRelativePath = moduleName === '.'; // NOTE: if starts with . then it only mean local
|
|
29
|
+
|
|
30
|
+
if (isRelativePath) {
|
|
31
|
+
global = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const paths = [local && process.cwd(), global && globalNodeModules].filter(Boolean); // x({ paths, globalNodeModules, global, local, opts });
|
|
36
|
+
|
|
37
|
+
const moduleResolvePath = require.resolve(moduleName, {
|
|
38
|
+
paths
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return require(moduleResolvePath);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
// NOTE: since we return null we can check out side
|
|
44
|
+
// console.log('Re validate: ', error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function requireLocal(moduleName) {
|
|
50
|
+
return requireLocalOrGlobal(moduleName, {
|
|
51
|
+
global: false,
|
|
52
|
+
local: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function requireGlobal(moduleName) {
|
|
57
|
+
return requireLocalOrGlobal(moduleName, {
|
|
58
|
+
global: true,
|
|
59
|
+
local: false
|
|
60
|
+
});
|
|
61
|
+
}
|
package/lib/servers/server.js
CHANGED
|
@@ -70,8 +70,7 @@ 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
|
-
}
|
|
74
|
-
|
|
73
|
+
}
|
|
75
74
|
|
|
76
75
|
const compiler = (0, _webpack.default)(config);
|
|
77
76
|
const webpackServerOptions = {
|
|
@@ -101,7 +100,6 @@ app.use((0, _HMRMiddleware.default)(compiler, {
|
|
|
101
100
|
path: '/sockjs-node/info'
|
|
102
101
|
}));
|
|
103
102
|
app.use((req, res, next) => {
|
|
104
|
-
//console.log('origin', req.get('origin'));
|
|
105
103
|
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
|
|
106
104
|
|
|
107
105
|
res.setHeader('Access-Control-Allow-Private-Network', true);
|
|
@@ -204,8 +202,8 @@ if (httpsOptions) {
|
|
|
204
202
|
port: http2Port
|
|
205
203
|
}, 'htt' + 'ps')}${contextURL}/`, 'http2 server');
|
|
206
204
|
});
|
|
207
|
-
} else {
|
|
208
|
-
(0, _utils.log)(
|
|
205
|
+
} else if (httpsOptions) {
|
|
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');
|
|
209
207
|
}
|
|
210
208
|
}
|
|
211
209
|
|
package/lib/sh/pre-commit.sh
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
|
|
4
|
-
|
|
5
|
-
CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
|
|
6
|
-
|
|
7
|
-
echo "Branch Name - $CURRENT_BRANCH"
|
|
8
|
-
|
|
9
|
-
if [[ "$STAGED_FILES" = "" ]]; then
|
|
10
|
-
exit 0
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
IS_FAILED=false
|
|
14
|
-
FILES=""
|
|
15
|
-
|
|
16
|
-
for FILE in $STAGED_FILES # Add files with space separation
|
|
17
|
-
do
|
|
18
|
-
FILES+="$FILE "
|
|
19
|
-
done
|
|
20
|
-
|
|
21
|
-
npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
|
|
22
|
-
|
|
23
|
-
if [[ "$?" != 0 ]]; then
|
|
24
|
-
IS_FAILED=true
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
if $IS_FAILED; then
|
|
28
|
-
echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
|
|
29
|
-
exit 1
|
|
30
|
-
else
|
|
31
|
-
echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
exit $?
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
|
|
4
|
+
|
|
5
|
+
CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
|
|
6
|
+
|
|
7
|
+
echo "Branch Name - $CURRENT_BRANCH"
|
|
8
|
+
|
|
9
|
+
if [[ "$STAGED_FILES" = "" ]]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
IS_FAILED=false
|
|
14
|
+
FILES=""
|
|
15
|
+
|
|
16
|
+
for FILE in $STAGED_FILES # Add files with space separation
|
|
17
|
+
do
|
|
18
|
+
FILES+="$FILE "
|
|
19
|
+
done
|
|
20
|
+
|
|
21
|
+
npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
|
|
22
|
+
|
|
23
|
+
if [[ "$?" != 0 ]]; then
|
|
24
|
+
IS_FAILED=true
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if $IS_FAILED; then
|
|
28
|
+
echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
|
|
29
|
+
exit 1
|
|
30
|
+
else
|
|
31
|
+
echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
exit $?
|