@zohodesk/react-cli 0.0.1-exp.169.1 → 0.0.1-exp.169.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +179 -179
- package/.prettierrc +6 -6
- package/README.md +951 -946
- package/bin/cli.js +483 -483
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/configs/jest.config.js +3 -1
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +4 -6
- package/lib/configs/webpack.docs.config.js +3 -5
- package/lib/configs/webpack.impact.config.js +3 -5
- package/lib/configs/webpack.prod.config.js +4 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +0 -2
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- package/lib/loaderUtils/getCSSLoaders.js +22 -5
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/getDevPlugins.js +5 -5
- package/lib/pluginUtils/getProdPlugins.js +5 -5
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- 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/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +24 -16
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +4 -4
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +20 -8
- 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/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package.json +148 -148
- package/postpublish.js +6 -6
- 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 +1493 -1493
- 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
@@ -51,11 +51,11 @@ class ServiceWorkerPlugin {
|
|
51
51
|
if (err) {
|
52
52
|
throw new Error(err);
|
53
53
|
} else {
|
54
|
-
/* const extractedChunks = compilation.chunks.filter(chunk => {
|
55
|
-
if ('canBeInitial' in chunk) {
|
56
|
-
return chunk.canBeInitial();
|
57
|
-
}
|
58
|
-
return chunk.isInitial();
|
54
|
+
/* const extractedChunks = compilation.chunks.filter(chunk => {
|
55
|
+
if ('canBeInitial' in chunk) {
|
56
|
+
return chunk.canBeInitial();
|
57
|
+
}
|
58
|
+
return chunk.isInitial();
|
59
59
|
}); */
|
60
60
|
// let [js, css, , , i18nPublicPath] = this.publicPaths;
|
61
61
|
// let initialChunkUrls = [];
|
@@ -64,10 +64,10 @@ class ServiceWorkerPlugin {
|
|
64
64
|
let entrypoint = compilation.entrypoints.get('main');
|
65
65
|
let initialChunkUrls = entrypoint.getFiles();
|
66
66
|
const cssDirTemplate = '@dir@';
|
67
|
-
/**
|
68
|
-
* NOTE:
|
69
|
-
* if chunkSplitEnable is false means,
|
70
|
-
* serviceWorker will get i18n files path for html
|
67
|
+
/**
|
68
|
+
* NOTE:
|
69
|
+
* if chunkSplitEnable is false means,
|
70
|
+
* serviceWorker will get i18n files path for html
|
71
71
|
*/
|
72
72
|
|
73
73
|
let initalI18nAssets = chunkSplitEnable ? entrypoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@')) : [];
|
@@ -15,10 +15,10 @@ var _crypto = _interopRequireDefault(require("crypto"));
|
|
15
15
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
|
18
|
-
/**
|
19
|
-
* Plugin that generates hash for the provided list of third party files
|
20
|
-
* Map the provided key with the file hash and add it to the list of exisiting global constants.
|
21
|
-
* Plugin in turn uses the defineplugin to generate global constants.
|
18
|
+
/**
|
19
|
+
* Plugin that generates hash for the provided list of third party files
|
20
|
+
* Map the provided key with the file hash and add it to the list of exisiting global constants.
|
21
|
+
* Plugin in turn uses the defineplugin to generate global constants.
|
22
22
|
*/
|
23
23
|
class TPHashMappingPlugin {
|
24
24
|
constructor(options) {
|
@@ -4,7 +4,7 @@ var _postcss = _interopRequireDefault(require("postcss"));
|
|
4
4
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
6
|
|
7
|
-
module.exports = _postcss.default.plugin('postcss-exclude-
|
7
|
+
module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
|
8
8
|
const {
|
9
9
|
plugins
|
10
10
|
} = opts;
|
@@ -38,11 +38,11 @@ function selectorMinifySameDir(selector, direction) {
|
|
38
38
|
const regex = getRegex(direction);
|
39
39
|
return selector.replace(regex, '').trim();
|
40
40
|
}
|
41
|
-
/**
|
42
|
-
* this funtion will remove given rule,
|
43
|
-
* if given selector and it's previous sibiling rule selector are same
|
44
|
-
* current rule properties will move to previous sibiling rule.
|
45
|
-
* @param {Rule} rule current rule
|
41
|
+
/**
|
42
|
+
* this funtion will remove given rule,
|
43
|
+
* if given selector and it's previous sibiling rule selector are same
|
44
|
+
* current rule properties will move to previous sibiling rule.
|
45
|
+
* @param {Rule} rule current rule
|
46
46
|
*/
|
47
47
|
|
48
48
|
|
@@ -57,11 +57,11 @@ function mergeIfSameSelector(rule) {
|
|
57
57
|
rule.remove();
|
58
58
|
}
|
59
59
|
}
|
60
|
-
/**
|
61
|
-
* this funtion will remove given rule,
|
62
|
-
* if given selector and it's previous sibiling rule selector are same
|
63
|
-
* current rule properties will move to previous sibiling rule.
|
64
|
-
* @param {Rule} rule current rule
|
60
|
+
/**
|
61
|
+
* this funtion will remove given rule,
|
62
|
+
* if given selector and it's previous sibiling rule selector are same
|
63
|
+
* current rule properties will move to previous sibiling rule.
|
64
|
+
* @param {Rule} rule current rule
|
65
65
|
*/
|
66
66
|
|
67
67
|
|
@@ -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',
|
@@ -32,7 +32,7 @@ function isHoverPresent(atrule) {
|
|
32
32
|
return hoverPresent;
|
33
33
|
}
|
34
34
|
|
35
|
-
module.exports = _postcss.default.plugin('postcss-mobile-hover',
|
35
|
+
module.exports = _postcss.default.plugin('postcss-mobile-hover', opts => rootOriginal => {
|
36
36
|
const hoverRules = [];
|
37
37
|
let positionsObj = {};
|
38
38
|
|
@@ -0,0 +1,243 @@
|
|
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
|
+
let unit = decl.value.replace(/[0-9]/g, '');
|
105
|
+
let settings = numberObject[decl.prop];
|
106
|
+
let path = rootOriginal.source.input.from;
|
107
|
+
let filename = path.split('\\');
|
108
|
+
filename = filename[filename.length - 1];
|
109
|
+
|
110
|
+
if (decl.prop === 'font-size' || decl.prop === 'margin-left' || decl.prop === 'margin-right' || decl.prop === 'margin-top' || decl.prop === 'margin-bottom') {
|
111
|
+
let {
|
112
|
+
allowed,
|
113
|
+
replacements,
|
114
|
+
available
|
115
|
+
} = settings;
|
116
|
+
|
117
|
+
if (!rootOriginal.source.input.from.includes('node_modules')) {
|
118
|
+
if (unit != 0) {
|
119
|
+
if (allowed.includes(unit)) {
|
120
|
+
// console.log(available, parseInt(decl.value))
|
121
|
+
if (available.includes(parseInt(decl.value))) {
|
122
|
+
// replacementValues[unit].push({[decl.value] : replacements[unit].replace('$$', parseInt(decl.value))})
|
123
|
+
decl.value = replacements[unit].replace('$$', parseInt(decl.value)); //console.log("replacements:")
|
124
|
+
} else {
|
125
|
+
let err = {
|
126
|
+
prop: decl.prop,
|
127
|
+
value: decl.value,
|
128
|
+
filename,
|
129
|
+
filepath: rootOriginal.source.input.from,
|
130
|
+
line: decl.source.start.line,
|
131
|
+
unit,
|
132
|
+
message: 'value not available consider others'
|
133
|
+
};
|
134
|
+
errors.push(err);
|
135
|
+
}
|
136
|
+
} else {
|
137
|
+
let err = {
|
138
|
+
prop: decl.prop,
|
139
|
+
value: decl.value,
|
140
|
+
filename,
|
141
|
+
filepath: rootOriginal.source.input.from,
|
142
|
+
line: decl.source.start.line,
|
143
|
+
unit,
|
144
|
+
message: 'Unit not supported'
|
145
|
+
};
|
146
|
+
errors.push(err);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
} else if (decl.prop === 'margin') {
|
151
|
+
let {
|
152
|
+
allowed,
|
153
|
+
replacements,
|
154
|
+
available
|
155
|
+
} = settings; //console.log(decl.prop + " " + decl.value)
|
156
|
+
|
157
|
+
let valArr = decl.value.split(' '); //console.log(valArr)
|
158
|
+
//console.log(allowed, replacements, available)
|
159
|
+
|
160
|
+
let hasError = false;
|
161
|
+
let newVal = '';
|
162
|
+
valArr.forEach(val => {
|
163
|
+
let unit = val.replace(parseInt(val), '');
|
164
|
+
let numVal = parseInt(val);
|
165
|
+
|
166
|
+
if (unit != 0) {
|
167
|
+
if (allowed.includes(unit)) {
|
168
|
+
if (available.includes(numVal)) {
|
169
|
+
if (numVal >= 0) {
|
170
|
+
if (!hasError) {
|
171
|
+
newVal += replacements[unit].replace('$$', numVal) + " ";
|
172
|
+
}
|
173
|
+
} else {
|
174
|
+
if (!hasError) {
|
175
|
+
newVal += `calc(${replacements[unit].replace('$$', numVal * -1)} * -1)` + " ";
|
176
|
+
}
|
177
|
+
}
|
178
|
+
} else {
|
179
|
+
hasError = true;
|
180
|
+
let err = {
|
181
|
+
prop: decl.prop,
|
182
|
+
value: numVal,
|
183
|
+
filename,
|
184
|
+
filepath: rootOriginal.source.input.from,
|
185
|
+
line: decl.source.start.line,
|
186
|
+
unit,
|
187
|
+
message: 'value not available consider others'
|
188
|
+
};
|
189
|
+
errors.push(err);
|
190
|
+
}
|
191
|
+
} else {
|
192
|
+
hasError = true;
|
193
|
+
let err = {
|
194
|
+
prop: decl.prop,
|
195
|
+
value: decl.value,
|
196
|
+
filename,
|
197
|
+
filepath: rootOriginal.source.input.from,
|
198
|
+
line: decl.source.start.line,
|
199
|
+
unit,
|
200
|
+
message: 'Unit not supported'
|
201
|
+
};
|
202
|
+
errors.push(err);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
});
|
206
|
+
|
207
|
+
if (!hasError) {
|
208
|
+
decl.value = newVal;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
});
|
213
|
+
}); //fs.writeFile('./src/trial.json', JSON.stringify(variables) ,(err) =>{
|
214
|
+
// if(err)console.log(err);
|
215
|
+
// else{
|
216
|
+
// console.log('updated successfully');
|
217
|
+
// }
|
218
|
+
// })
|
219
|
+
// console.log(errors)
|
220
|
+
|
221
|
+
let errorArr = [];
|
222
|
+
errors.forEach(errStr => {
|
223
|
+
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`);
|
224
|
+
}); //fs.writeFile('./css_error.log','', (err) =>{
|
225
|
+
// if(err){
|
226
|
+
// console.log(err);
|
227
|
+
// }
|
228
|
+
//});
|
229
|
+
// errorArr.forEach(err => {
|
230
|
+
// let data = `\n{\n${err}\n},\n`;
|
231
|
+
// //fs.appendFile('./css_error.log',data,(err)=>{
|
232
|
+
// // if(err){
|
233
|
+
// // console.log(err);
|
234
|
+
// // }
|
235
|
+
// //})
|
236
|
+
// });
|
237
|
+
// fs.writeFileSync('./css_error.log','');
|
238
|
+
// errorArr.forEach(err => {
|
239
|
+
// let data = `\n{\n${err}\n},\n`;
|
240
|
+
// fs.appendFileSync('./css_error.log',data);
|
241
|
+
// });
|
242
|
+
}
|
243
|
+
});
|
package/lib/schemas/index.js
CHANGED
@@ -205,8 +205,16 @@ var _default = {
|
|
205
205
|
value: true,
|
206
206
|
cli: 'enable_smaphook'
|
207
207
|
},
|
208
|
-
|
209
|
-
|
208
|
+
plugins: {
|
209
|
+
hasRTL: false,
|
210
|
+
hoverActive: false,
|
211
|
+
combinerMediaQuery: false
|
212
|
+
},
|
213
|
+
exclude: {
|
214
|
+
rtl: [],
|
215
|
+
hoverActive: [],
|
216
|
+
combinerMediaQuery: []
|
217
|
+
},
|
210
218
|
seperateCssModules: {
|
211
219
|
value: false,
|
212
220
|
cli: 'sep_cssmodules'
|
@@ -221,8 +229,6 @@ var _default = {
|
|
221
229
|
value: 'zd',
|
222
230
|
cli: 'class_prefix'
|
223
231
|
},
|
224
|
-
combinerMq: false,
|
225
|
-
hoverActive: false,
|
226
232
|
selectorReplace: null,
|
227
233
|
devConsoleExculde: {
|
228
234
|
value: false,
|
@@ -276,12 +282,18 @@ var _default = {
|
|
276
282
|
cli: 'css_unique'
|
277
283
|
},
|
278
284
|
enableChunkHash: false,
|
279
|
-
combinerMq: false,
|
280
|
-
hoverActive: false,
|
281
285
|
folder: 'src',
|
282
286
|
disableES5Transpile: false,
|
283
|
-
|
284
|
-
|
287
|
+
plugins: {
|
288
|
+
hasRTL: false,
|
289
|
+
hoverActive: false,
|
290
|
+
combinerMediaQuery: false
|
291
|
+
},
|
292
|
+
exclude: {
|
293
|
+
rtl: [],
|
294
|
+
hoverActive: [],
|
295
|
+
combinerMediaQuery: []
|
296
|
+
},
|
285
297
|
cssHashSelectors: {
|
286
298
|
filenames: [],
|
287
299
|
packages: []
|
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 $?
|