@zohodesk/react-cli 0.0.1-beta.174 → 0.0.1-beta.176

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.
Files changed (119) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -180
  3. package/.prettierrc +6 -6
  4. package/README.md +1018 -1003
  5. package/bin/cli.js +482 -482
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -12
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/SelectorWeight.md +6 -0
  13. package/docs/TODOS.md +10 -10
  14. package/docs/ValueReplacer.md +60 -60
  15. package/docs/VariableConversion.md +710 -678
  16. package/docs/warnings_while_install.txt +35 -35
  17. package/files/eslintrc.js +62 -62
  18. package/files/prettierrc.js +3 -3
  19. package/lib/configs/webpack.css.umd.config.js +4 -4
  20. package/lib/configs/webpack.dev.config.js +23 -2
  21. package/lib/configs/webpack.docs.config.js +13 -1
  22. package/lib/configs/webpack.impact.config.js +13 -1
  23. package/lib/configs/webpack.prod.config.js +23 -2
  24. package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
  25. package/lib/loaderUtils/getCSSLoaders.js +24 -21
  26. package/lib/loaderUtils/windowsModification.js +11 -0
  27. package/lib/loaders/workerLoader.js +9 -9
  28. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  29. package/lib/pluginUtils/getDevPlugins.js +54 -52
  30. package/lib/pluginUtils/getProdPlugins.js +66 -63
  31. package/lib/plugins/EFCPlugin.md +6 -6
  32. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  33. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  34. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  35. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  36. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  37. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  38. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  39. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  40. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  41. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  42. package/lib/plugins/SelectorPlugin.js +97 -0
  43. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  44. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  45. package/lib/plugins/VariableConversionCollector.js +252 -0
  46. package/lib/plugins/composeCommonPlugin.js +30 -0
  47. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  48. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  49. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  50. package/lib/postcss-plugins/hoverActivePlugin.js +13 -9
  51. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +35 -14
  52. package/lib/postcss-plugins/variableModificationPlugin/index.js +202 -143
  53. package/lib/schemas/index.js +20 -8
  54. package/lib/sh/pre-commit.sh +34 -34
  55. package/lib/sh/reportPublish.sh +45 -45
  56. package/lib/utils/buildstats.html +148 -148
  57. package/lib/utils/resultSchema.json +73 -73
  58. package/npm8.md +9 -9
  59. package/package.json +146 -146
  60. package/postpublish.js +6 -6
  61. package/templates/app/.eslintrc.js +140 -140
  62. package/templates/app/README.md +12 -12
  63. package/templates/app/app/index.html +24 -24
  64. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  65. package/templates/app/app/properties/i18nkeys.json +3 -3
  66. package/templates/app/docs/all.html +69 -69
  67. package/templates/app/mockapi/index.js +18 -18
  68. package/templates/app/package.json +37 -37
  69. package/templates/app/src/actions/SampleActions/index.js +37 -37
  70. package/templates/app/src/actions/index.js +65 -65
  71. package/templates/app/src/appUrls.js +19 -19
  72. package/templates/app/src/components/Alert/Alert.js +134 -134
  73. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  74. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  75. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  76. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  77. package/templates/app/src/components/Sample/SampleList.js +61 -61
  78. package/templates/app/src/components/Slider/Slider.css +41 -41
  79. package/templates/app/src/components/Slider/Slider.js +55 -55
  80. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  81. package/templates/app/src/containers/AppContainer/index.js +96 -96
  82. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  83. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  84. package/templates/app/src/containers/DevTools/index.js +10 -10
  85. package/templates/app/src/containers/Header/index.js +67 -67
  86. package/templates/app/src/containers/Header/index.module.css +43 -43
  87. package/templates/app/src/containers/Redirect/index.js +63 -63
  88. package/templates/app/src/containers/Redirector/index.js +47 -47
  89. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  90. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  91. package/templates/app/src/historyChange.js +5 -5
  92. package/templates/app/src/index.html +10 -10
  93. package/templates/app/src/index.js +24 -24
  94. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  95. package/templates/app/src/reducers/alertData.js +11 -11
  96. package/templates/app/src/reducers/index.js +6 -6
  97. package/templates/app/src/reducers/samples.js +19 -19
  98. package/templates/app/src/store/configureStore.dev.js +51 -51
  99. package/templates/app/src/store/configureStore.js +5 -5
  100. package/templates/app/src/store/configureStore.prod.js +26 -26
  101. package/templates/app/src/util/Common.js +5 -5
  102. package/templates/app/src/util/RequestAPI.js +132 -132
  103. package/templates/docs/all.html +249 -249
  104. package/templates/docs/component.html +178 -178
  105. package/templates/docs/components.html +221 -221
  106. package/templates/docs/css/b.min.css +6 -6
  107. package/templates/docs/css/component.css +42 -42
  108. package/templates/docs/css/componentTest.css +6 -6
  109. package/templates/docs/css/hopscotch.css +585 -585
  110. package/templates/docs/css/style.css +1022 -1022
  111. package/templates/docs/impactReportTemplate.html +154 -154
  112. package/templates/docs/index.html +1501 -1501
  113. package/templates/docs/js/active-line.js +72 -72
  114. package/templates/docs/js/b.min.js +7 -7
  115. package/templates/docs/js/codemirror.js +9680 -9680
  116. package/templates/docs/js/designTokens.js +334 -334
  117. package/templates/docs/js/j.min.js +4 -4
  118. package/templates/docs/js/javascript.js +874 -874
  119. package/templates/docs/js/matchbrackets.js +145 -145
@@ -8,30 +8,51 @@ exports.ErrorHandler = void 0;
8
8
  class ErrorHandler {
9
9
  constructor(allowedErrs) {
10
10
  this.errors = [];
11
+ this.errorTable = [];
11
12
  this.allowedErrs = allowedErrs;
13
+ Object.assign(this, {
14
+ DECLARATION_IGNORED: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : Declaration Ignored`),
15
+ DECIMAL_CHECK: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
16
+ DECIMAL_REJECT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
17
+ UNIT_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
18
+ RANGE_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}\r`),
19
+ VARIABLE_PRESENT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`)
20
+ });
21
+ }
22
+
23
+ setAllowedErrs(allErrs) {
24
+ this.allowedErrs = allErrs;
25
+ ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT'].forEach(err => {
26
+ if (!this.allowedErrs[err]) {
27
+ this[err] = () => null;
28
+ }
29
+ });
12
30
  }
13
31
 
14
32
  addError(errstr) {
15
33
  this.errors.push(`{\n${errstr}\n}\n`);
16
34
  }
17
35
 
18
- errorFunction(errStr, type) {
19
- const {
20
- addError,
21
- allowedErrs
22
- } = this;
23
-
24
- if (type === 'DECLARATION_IGNORED' && allowedErrs.DECLARATION_IGNORED) {
25
- addError(errStr);
26
- } else if (type === 'UNIT_ERROR' && allowedErrs.UNIT_ERROR) {
27
- addError(errStr);
28
- } else if (type === 'RANGE_ERROR' && allowedErrs.RANGE_ERROR) {
29
- addError(errStr);
30
- } else if (type === 'VARIABLE_PRESENT' && allowedErrs.VARIABLE_PRESENT) {
31
- addError(errStr);
36
+ errorFunction(errObj) {
37
+ if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
38
+ this[errObj.type](errObj);
32
39
  }
33
40
  }
34
41
 
42
+ printError(errObj) {
43
+ console.log('{');
44
+ Object.keys(errObj).sort().forEach(key => {
45
+ if (key !== 'decl') {
46
+ console.log(`${key} : ${errObj[key]}`);
47
+ } else {
48
+ console.log(`prop : ${errObj.decl.prop}`);
49
+ console.log(`value : ${errObj.decl.value}`);
50
+ console.log(`linenum : ${errObj.decl.source.start.line}`);
51
+ }
52
+ });
53
+ console.log('}\n');
54
+ }
55
+
35
56
  }
36
57
 
37
58
  exports.ErrorHandler = ErrorHandler;
@@ -6,8 +6,13 @@ const fs = require('fs');
6
6
 
7
7
  const path = require('path');
8
8
 
9
+ const {
10
+ ErrorHandler
11
+ } = require('./ErrorHandler');
12
+
9
13
  const errors = [];
10
- let allowedErrs = {};
14
+ const errorTable = [];
15
+ const errHandler = new ErrorHandler();
11
16
  const convertableProps = {
12
17
  'font-size': true,
13
18
  margin: true,
@@ -29,19 +34,37 @@ const convertableProps = {
29
34
  top: true,
30
35
  bottom: true,
31
36
  left: true,
32
- right: true
37
+ right: true,
38
+ 'text-indent': true,
39
+ clip: true,
40
+ 'flex-basis': true,
41
+ 'row-gap': true,
42
+ gap: true,
43
+ 'column-gap': true,
44
+ flex: true
33
45
  };
34
46
  const constantValues = {
35
47
  inherit: true,
36
48
  initial: true,
37
49
  auto: true,
38
50
  'fit-content': true,
39
- unset: true
51
+ unset: true,
52
+ cover: true,
53
+ contain: true,
54
+ top: true,
55
+ bottom: true,
56
+ left: true,
57
+ center: true,
58
+ right: true
40
59
  };
41
60
 
42
61
  function getNumericValue(value) {
43
62
  if (value.includes('var')) {
44
63
  return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
64
+ }
65
+
66
+ if (value.includes('rect')) {
67
+ return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
45
68
  } // Not need for this dum loop
46
69
  // allowed.forEach(alwdUnit => {
47
70
  // if (value.includes(alwdUnit)) {
@@ -71,22 +94,6 @@ function pxToCalc(value) {
71
94
  return arr.join(' ');
72
95
  }
73
96
 
74
- const addError = errstr => {
75
- errors.push(`{\n${errstr}\n}\n`);
76
- };
77
-
78
- const errorFunction = (errStr, type) => {
79
- if (type === 'DECLARATION_IGNORED' && allowedErrs.DECLARATION_IGNORED) {
80
- addError(errStr);
81
- } else if (type === 'UNIT_ERROR' && allowedErrs.UNIT_ERROR) {
82
- addError(errStr);
83
- } else if (type === 'RANGE_ERROR' && allowedErrs.RANGE_ERROR) {
84
- addError(errStr);
85
- } else if (type === 'VARIABLE_PRESENT' && allowedErrs.VARIABLE_PRESENT) {
86
- addError(errStr);
87
- }
88
- };
89
-
90
97
  const singleConvertor = (value, changeVal, details, range) => {
91
98
  const {
92
99
  path,
@@ -94,6 +101,13 @@ const singleConvertor = (value, changeVal, details, range) => {
94
101
  decl
95
102
  } = details;
96
103
 
104
+ if (decl.prop === 'background-position') {
105
+ if (isNaN(parseInt(value))) {
106
+ // console.log(`${value} skipped`);
107
+ return;
108
+ }
109
+ }
110
+
97
111
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
98
112
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
99
113
 
@@ -102,146 +116,191 @@ const singleConvertor = (value, changeVal, details, range) => {
102
116
  }
103
117
 
104
118
  return retVal;
105
- } // if(unitErrorVal && unitErrorVal != '0' ){
119
+ } // if (!value.includes('rect')) {
120
+ // if(unitErrorVal && unitErrorVal != '0' ){
106
121
  // console.log(value, 'not within range')
107
122
 
108
123
 
109
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n message : value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`, 'RANGE_ERROR'); // }
124
+ let errObj = {
125
+ decl,
126
+ type: 'RANGE_ERROR',
127
+ filename,
128
+ message: `value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`,
129
+ path: path
130
+ };
131
+ errHandler.errorTable.push(errObj);
132
+ errHandler.errorFunction(errObj); // errorFunction(
133
+ // {
134
+ // decl,
135
+ // type: 'RANGE_ERROR',
136
+ // filename,
137
+ // message: `value (${value}) (${typeof value}) not within range (${
138
+ // range.start
139
+ // },${range.end})\r`,
140
+ // path: path
141
+ // },
142
+ // 'RANGE_ERROR'
143
+ // );
144
+ // }
110
145
  // 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`)
111
-
112
- return value;
146
+ // return value;
147
+ // } else {
148
+ // console.log('++++++++++++++++++++++rect val!', value);
149
+ // }
113
150
  };
114
151
 
115
- module.exports = postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
116
- const rawdata = fs.readFileSync(cssVariableReplacementConfig);
117
- const data = JSON.parse(rawdata);
118
- const {
119
- errorsAllowed,
120
- settings: settingsObject,
121
- errorLog: errorLogStatus,
122
- errorInConsole: errorConsoleStatus
123
- } = data; // const keys = Object.keys(settingsObject);
124
-
125
- allowedErrs = errorsAllowed;
126
- const replacementArray = [];
127
- Object.keys(settingsObject).forEach(key => {
128
- Object.values(settingsObject[key].replacements).forEach(val => {
129
- if (!replacementArray.includes(val)) {
130
- replacementArray.push(val);
152
+ module.exports = {
153
+ plugin: postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
154
+ const rawdata = fs.readFileSync(cssVariableReplacementConfig);
155
+ const data = JSON.parse(rawdata);
156
+ const {
157
+ errorsAllowed,
158
+ settings: settingsObject // errorLog: errorLogStatus,
159
+ // errorInConsole: errorConsoleStatus
160
+
161
+ } = data; // const keys = Object.keys(settingsObject);
162
+
163
+ errHandler.setAllowedErrs(errorsAllowed);
164
+ const replacementArray = [];
165
+ Object.keys(settingsObject).forEach(key => {
166
+ Object.values(settingsObject[key].replacements).forEach(val => {
167
+ if (!replacementArray.includes(val)) {
168
+ replacementArray.push(val);
169
+ }
170
+ });
171
+ });
172
+ let regValStr = '';
173
+ replacementArray.forEach((val, index) => {
174
+ if (index !== replacementArray.length - 1) {
175
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
176
+ } else {
177
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
131
178
  }
132
179
  });
133
- });
134
- let regValStr = '';
135
- replacementArray.forEach((val, index) => {
136
- if (index !== replacementArray.length - 1) {
137
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
138
- } else {
139
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
140
- }
141
- });
142
- const valRegex = new RegExp(regValStr, 'gi');
143
- return rootOriginal => {
144
- rootOriginal.walkRules(rule => {
145
- // rule.nodes[-1] = {}
146
- // need map, forEach fine less memory
147
- rule.nodes.forEach((decl, position) => {
148
- // case font-size
149
- const commentStr = 'variable:ignore';
150
- const prevNode = rule.nodes[position - 1];
151
- const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
152
- // split not need use slice and lastIndexOf less memory
153
-
154
- const filename = fromPath.split(path.sep).pop();
155
-
156
- if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
157
- const errStr = ` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n message : Declaration Ignored \r`;
158
- errorFunction(errStr, 'DECLARATION_IGNORED');
159
- return;
160
- }
180
+ const valRegex = new RegExp(regValStr, 'gi');
181
+ return rootOriginal => {
182
+ rootOriginal.walkRules(rule => {
183
+ // rule.nodes[-1] = {}
184
+ // need map, forEach fine less memory
185
+ rule.nodes.forEach((decl, position) => {
186
+ // case font-size
187
+ const commentStr = 'variable:ignore';
188
+ const prevNode = rule.nodes[position - 1];
189
+ const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
190
+ // split not need use slice and lastIndexOf less memory
161
191
 
162
- if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
163
- const settings = settingsObject[decl.prop]; // console.log(settings)
164
-
165
- const {
166
- allowed,
167
- range
168
- } = settings; // suggestion filter !decl.value.includes('calc')
169
- // Reason below some of logic happen based on this
170
-
171
- const unit = decl.value.toString() // no need round braket since you do not need group for less memory
172
- .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
173
- // console.log('unit : ');
174
- // console.log(unit);
175
-
176
- unit.forEach((val, index) => {
177
- allowed.forEach(alwdVal => {
178
- if (val.includes(alwdVal)) {
179
- // ## for what purpose
180
- unit[index] = val.replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`);
181
- }
192
+ const filename = fromPath.split(path.sep).pop();
193
+
194
+ if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
195
+ let errObj = {
196
+ decl,
197
+ type: 'DECLARATION_IGNORED',
198
+ filename,
199
+ message: 'Declaration Ignored',
200
+ path: fromPath
201
+ };
202
+ errHandler.errorTable.push(errObj);
203
+ errHandler.DECLARATION_IGNORED(errObj);
204
+ return;
205
+ }
206
+
207
+ if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
208
+ const settings = settingsObject[decl.prop]; // console.log(settings)
209
+
210
+ const {
211
+ allowed,
212
+ range
213
+ } = settings; // suggestion filter !decl.value.includes('calc')
214
+ // Reason below some of logic happen based on this
215
+
216
+ const unit = decl.value.toString() // no need round braket since you do not need group for less memory
217
+ .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
218
+ // console.log('unit : ');
219
+ // console.log(unit);
220
+
221
+ unit.forEach((val, index) => {
222
+ allowed.forEach(alwdVal => {
223
+ if (val.includes(alwdVal)) {
224
+ // ## for what purpose
225
+ unit[index] = val // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
226
+ .replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
227
+ }
228
+ });
182
229
  });
183
- });
184
- let unitError = false;
185
- let unitErrorVal = '';
186
- unit.forEach(val => {
187
- if (!val.includes('calc')) {
188
- if (!allowed.includes(val.toString())) {
189
- unitError = true;
190
- unitErrorVal = val;
230
+ let unitError = false;
231
+ let unitErrorVal = '';
232
+ unit.forEach(val => {
233
+ if (!val.includes('calc') && decl.prop !== 'clip') {
234
+ if (!allowed.includes(val.toString())) {
235
+ unitError = true;
236
+ unitErrorVal = val;
237
+ }
191
238
  }
192
- }
193
- }); // console.log(allowed, replacements, range)
194
-
195
- if (!unitError) {
196
- // use variable decl.value.split(' ')
197
- if (range) {
198
- // console.log('multiple :', decl.value)
199
- let newVal = '';
200
- decl.value.split(' ').forEach(singleVal => {
201
- newVal += `${singleConvertor(singleVal, settings.replacements.px, {
239
+ }); // console.log(allowed, replacements, range)
240
+
241
+ if (!unitError) {
242
+ // use variable decl.value.split(' ')
243
+ if (range) {
244
+ // console.log('multiple :', decl.value)
245
+ let newVal = '';
246
+ decl.value.split(' ').forEach(singleVal => {
247
+ newVal += `${singleConvertor(singleVal, settings.replacements.px, {
248
+ decl,
249
+ filename,
250
+ path: fromPath
251
+ }, range)} `;
252
+ });
253
+ decl.value = newVal;
254
+ }
255
+ } else {
256
+ if (!decl.value.includes('calc')) {
257
+ // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`);
258
+ let errObj = {
202
259
  decl,
203
260
  filename,
261
+ unitErrorVal: unitErrorVal,
204
262
  path: fromPath
205
- }, range)} `;
206
- });
207
- decl.value = newVal;
263
+ };
264
+
265
+ if (unitErrorVal.trim() === '.') {
266
+ errObj.type = 'DECIMAL_CHECK';
267
+ errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
268
+ errHandler.errorTable.push(errObj);
269
+ errHandler.DECIMAL_CHECK(errObj);
270
+ } else if (unitErrorVal.includes('.') && !unitErrorVal.includes('%')) {
271
+ errObj.type = 'DECIMAL_REJECT';
272
+ errObj.message = `${unitErrorVal} (Decimal Value) Not Allowed \r`;
273
+ errHandler.errorTable.push(errObj);
274
+ errHandler.DECIMAL_REJECT(errObj);
275
+ } else {
276
+ if (!unitErrorVal.includes('%')) {
277
+ errObj.type = 'UNIT_ERROR';
278
+ errObj.message = `${unitErrorVal} (Unit) Not Allowed`;
279
+ errHandler.errorTable.push(errObj);
280
+ errHandler.UNIT_ERROR(errObj);
281
+ }
282
+ }
283
+ } else {
284
+ decl.value = pxToCalc(decl.value);
285
+ }
208
286
  }
209
287
  } else {
210
- if (!decl.value.includes('calc')) {
211
- // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`);
212
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`, 'UNIT_ERROR');
213
- } else {
214
- decl.value = pxToCalc(decl.value);
288
+ if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
289
+ let errObj = {
290
+ decl,
291
+ type: 'VARIABLE_PRESENT',
292
+ filename,
293
+ message: `value (${decl.value}) has var in it, kindly check`,
294
+ path: fromPath
295
+ };
296
+ errHandler.errorTable.push(errObj);
297
+ errHandler.VARIABLE_PRESENT(errObj);
215
298
  }
216
299
  }
217
- } else {
218
- if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
219
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n message : value (${decl.value}) has var in it, kindly check`, 'VARIABLE_PRESENT');
220
- }
221
- }
222
- });
223
- }); // console.log(filename)
224
- // console.log('Done!')
225
- // console.log('----------------------------------------------------------------------------------------------------------------------')
226
-
227
- if (errorLogStatus) {
228
- fs.writeFileSync('./css_error.log', '');
229
-
230
- if (errors.length > 0) {
231
- errors.forEach(err => {
232
- fs.appendFileSync('./css_error.log', err);
233
- }); // console.log('----------------------------------------------------------------------------------------------------------------------')
234
- }
235
- }
236
-
237
- if (errorConsoleStatus) {
238
- if (errors.length > 0) {
239
- errors.forEach(err => {
240
- // fs.appendFileSync('./css_error.log', err);
241
- console.log(err);
242
300
  });
243
- console.log('----------------------------------------------------------------------------------------------------------------------');
244
- }
245
- }
246
- };
247
- });
301
+ });
302
+ };
303
+ }),
304
+ errors: errHandler.errors,
305
+ errTable: errHandler.errorTable
306
+ };
@@ -217,15 +217,22 @@ var _default = {
217
217
  hasRTL: false,
218
218
  hoverActive: false,
219
219
  combinerMediaQuery: false,
220
- cssVariableReplacement: false
220
+ cssVariableReplacement: false,
221
+ selectorWeight: false
221
222
  },
222
223
  exclude: {
223
224
  rtl: [],
224
225
  hoverActive: [],
225
226
  combinerMediaQuery: [],
226
- cssVariableReplacement: []
227
+ cssVariableReplacement: [],
228
+ selectorWeight: []
227
229
  },
228
230
  cssVariableReplacementConfig: '',
231
+ selectorWeightConfig: {
232
+ defaultSelector: '',
233
+ customFileDetails: '',
234
+ excludeStrings: []
235
+ },
229
236
  seperateCssModules: {
230
237
  value: false,
231
238
  cli: 'sep_cssmodules'
@@ -253,6 +260,7 @@ var _default = {
253
260
  replaceText: '//<!--AssetsFromBuild -->'
254
261
  },
255
262
  htmlTemplate: {
263
+ minify: null,
256
264
  inject: true
257
265
  },
258
266
  removePropTypes: false,
@@ -306,15 +314,22 @@ var _default = {
306
314
  hasRTL: false,
307
315
  hoverActive: false,
308
316
  combinerMediaQuery: false,
309
- cssVariableReplacement: false
317
+ cssVariableReplacement: false,
318
+ selectorWeight: false
310
319
  },
311
320
  exclude: {
312
321
  rtl: [],
313
322
  hoverActive: [],
314
323
  combinerMediaQuery: [],
315
- cssVariableReplacement: []
324
+ cssVariableReplacement: [],
325
+ selectorWeight: []
316
326
  },
317
327
  cssVariableReplacementConfig: '',
328
+ selectorWeightConfig: {
329
+ defaultSelector: '',
330
+ customFileDetails: '',
331
+ excludeStrings: []
332
+ },
318
333
  cssHashSelectors: {
319
334
  filenames: [],
320
335
  packages: []
@@ -343,7 +358,6 @@ var _default = {
343
358
  cli: 'branch_name'
344
359
  },
345
360
  impactServerDomain: {
346
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
347
361
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
348
362
  cli: 'impact_server_domain'
349
363
  },
@@ -366,7 +380,6 @@ var _default = {
366
380
  cli: 'service_name'
367
381
  },
368
382
  impactServerDomain: {
369
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
370
383
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
371
384
  cli: 'impact_server_domain'
372
385
  },
@@ -404,7 +417,7 @@ var _default = {
404
417
  cli: 'path_to_sub_projs'
405
418
  },
406
419
  tokenGit: {
407
- value: 'YbByNJ3yURAm92Lhx4vW',
420
+ value: '',
408
421
  cli: 'git_token'
409
422
  },
410
423
  changesOnly: {
@@ -585,7 +598,6 @@ var _default = {
585
598
  },
586
599
  impactServerDomain: {
587
600
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
588
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
589
601
  cli: 'impact_server_domain'
590
602
  },
591
603
  impactRun: {
@@ -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 $?