@zohodesk/react-cli 0.0.1-exp.176.1 → 0.0.1-exp.176.11
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/README.md +1023 -1025
- package/bin/cli.js +482 -482
- 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/SelectorWeight.md +6 -6
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +710 -719
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- 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 +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +92 -162
- 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 +3 -3
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +2 -4
- package/lib/postcss-plugins/variableModificationPlugin/index.js +1 -2
- 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/cssURLReplacer.js +30 -43
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package.json +147 -146
- 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 +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
@@ -7,33 +7,24 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _postcss = _interopRequireDefault(require("postcss"));
|
9
9
|
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
10
12
|
var _ErrorHandler = require("../postcss-plugins/variableModificationPlugin/ErrorHandler");
|
11
13
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
15
|
|
14
16
|
// import { RawSource } from 'webpack-sources';
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
// -- is issue IO --
|
27
|
-
|
28
|
-
/*
|
29
|
-
issues eg :
|
30
|
-
issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
31
|
-
input :
|
32
|
-
--zd_size
|
33
|
-
output :
|
34
|
-
true
|
35
|
-
comment :
|
36
|
-
do not execute when --zd_size comes as prop
|
17
|
+
const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_']; // -- is issue IO --
|
18
|
+
|
19
|
+
/*
|
20
|
+
issues eg :
|
21
|
+
issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
22
|
+
input :
|
23
|
+
--zd_size
|
24
|
+
output :
|
25
|
+
true
|
26
|
+
comment :
|
27
|
+
do not execute when --zd_size comes as prop
|
37
28
|
*/
|
38
29
|
|
39
30
|
function isIgnoreValuePresent(ignoreVals, prop) {
|
@@ -44,16 +35,16 @@ function isIgnoreValuePresent(ignoreVals, prop) {
|
|
44
35
|
}
|
45
36
|
});
|
46
37
|
return present;
|
47
|
-
} // -- to convert the hyphen values to values --
|
48
|
-
|
49
|
-
/*
|
50
|
-
input :
|
51
|
-
var(--zdt_uploadlist_default_width)
|
52
|
-
output :
|
53
|
-
--zdt_uploadlist_default_width
|
54
|
-
|
55
|
-
comment :
|
56
|
-
to make the variable object using the output as key and decl.prop such as font-size as value
|
38
|
+
} // -- to convert the hyphen values to values --
|
39
|
+
|
40
|
+
/*
|
41
|
+
input :
|
42
|
+
var(--zdt_uploadlist_default_width)
|
43
|
+
output :
|
44
|
+
--zdt_uploadlist_default_width
|
45
|
+
|
46
|
+
comment :
|
47
|
+
to make the variable object using the output as key and decl.prop such as font-size as value
|
57
48
|
*/
|
58
49
|
|
59
50
|
|
@@ -78,7 +69,7 @@ function rootConvertor(rootOriginal, variables, settingsObject) {
|
|
78
69
|
|
79
70
|
if (settingsObject[variables[decl.prop]]) {
|
80
71
|
/* if there is no value for property, set it to default so that undefined doesn't get called as key */
|
81
|
-
if (!variables[decl.prop]) {
|
72
|
+
if (!variables[decl.prop] || !settingsObject[variables[decl.prop]]) {
|
82
73
|
variables[decl.prop] = 'default';
|
83
74
|
}
|
84
75
|
|
@@ -106,15 +97,15 @@ class VariableConversionCollector {
|
|
106
97
|
}
|
107
98
|
|
108
99
|
apply(compiler) {
|
109
|
-
|
110
|
-
|
111
|
-
const rawdata =
|
100
|
+
let variables = {};
|
101
|
+
|
102
|
+
const rawdata = _fs.default.readFileSync(this.filename);
|
103
|
+
|
112
104
|
const data = JSON.parse(rawdata);
|
113
105
|
const {
|
114
106
|
settings: settingsObject,
|
115
107
|
errorLog: errorLogStatus,
|
116
|
-
errorInConsole: errorConsoleStatus
|
117
|
-
errorsAllowed
|
108
|
+
errorInConsole: errorConsoleStatus
|
118
109
|
} = data; // If theres is no setting for default prop in settingsObject, set one.
|
119
110
|
|
120
111
|
if (!settingsObject.default) {
|
@@ -129,23 +120,16 @@ class VariableConversionCollector {
|
|
129
120
|
}
|
130
121
|
};
|
131
122
|
}
|
132
|
-
/*
|
133
|
-
purpose of tap : to create a variable object such as:
|
134
|
-
{
|
135
|
-
--zdt_uploadlist_default_width : width,
|
136
|
-
--zdt_uploadlist_default_height : height,
|
137
|
-
}
|
138
|
-
which will help in the conversion further
|
123
|
+
/*
|
124
|
+
purpose of tap : to create a variable object such as:
|
125
|
+
{
|
126
|
+
--zdt_uploadlist_default_width : width,
|
127
|
+
--zdt_uploadlist_default_height : height,
|
128
|
+
}
|
129
|
+
which will help in the conversion further
|
139
130
|
*/
|
140
131
|
|
141
132
|
|
142
|
-
if (fs.existsSync('./variableMapping.json')) {
|
143
|
-
const data = JSON.parse(fs.readFileSync('./variableMapping.json', 'utf-8'));
|
144
|
-
Object.keys(data).forEach(key => {
|
145
|
-
variables[key] = data[key];
|
146
|
-
});
|
147
|
-
}
|
148
|
-
|
149
133
|
compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
|
150
134
|
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
|
151
135
|
const mods = modules.filter(x => x.type.includes('css'));
|
@@ -153,80 +137,49 @@ class VariableConversionCollector {
|
|
153
137
|
const rootOriginal = _postcss.default.parse(module.content);
|
154
138
|
|
155
139
|
const filename = module.issuer.resource;
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
const extractedValue = extractVariableName(val);
|
163
|
-
|
164
|
-
if (!variables[extractedValue]) {
|
165
|
-
variables[extractedValue] = decl.prop;
|
166
|
-
} else {
|
167
|
-
if (new RegExp(supportedProps.join('|'), 'gi').test(decl.prop)) {
|
168
|
-
// console.log(
|
169
|
-
// `${extractedValue} : ${variables[extractedValue]} already exists please check!`
|
170
|
-
// );
|
171
|
-
if (errorsAllowed.MULTIPLE_OCCURANCES) {
|
172
|
-
let errObj = {
|
173
|
-
decl,
|
174
|
-
type: 'MULTIPLE_OCCURANCES',
|
175
|
-
filename,
|
176
|
-
message: `${extractedValue} : ${variables[extractedValue]} already exists please check!`
|
177
|
-
};
|
178
|
-
errHandler.errorTable.push(errObj);
|
179
|
-
errHandler.errorFunction(errObj);
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
} else {
|
184
|
-
// console.log(decl.prop);
|
185
|
-
if (/^--/gi.test(decl.prop) && new RegExp(supportedProps.join('|'), 'gi').test(decl.prop) && val.trim() !== '' && !variables[decl.prop]) {
|
186
|
-
// console.log(
|
187
|
-
// `${decl.prop} : ${variables[decl.prop]},`
|
188
|
-
// );
|
189
|
-
unassigned[decl.prop] = variables[decl.prop];
|
190
|
-
}
|
191
|
-
}
|
192
|
-
});
|
140
|
+
rootOriginal.walkRules(rule => {
|
141
|
+
rule.walkDecls(decl => {
|
142
|
+
decl.value.split(' ').forEach(val => {
|
143
|
+
if (val && val.includes('--') && !new RegExp(ignoreVals.join('|'), 'gi').test(val)) {
|
144
|
+
variables[extractVariableName(val)] = decl.prop;
|
145
|
+
}
|
193
146
|
});
|
194
147
|
});
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
215
|
-
}
|
148
|
+
});
|
149
|
+
/*
|
150
|
+
current value example:
|
151
|
+
{
|
152
|
+
--zdt_uploadlist_default_width : --zd_upload_width,
|
153
|
+
--zd_upload_width : width
|
154
|
+
}
|
155
|
+
expected value :
|
156
|
+
{
|
157
|
+
--zdt_uploadlist_default_width : width,
|
158
|
+
--zd_upload_width : width
|
159
|
+
}
|
160
|
+
|
161
|
+
conversion is done in the while loop below
|
162
|
+
*/
|
163
|
+
|
164
|
+
Object.keys(variables).forEach(key => {
|
165
|
+
while (variables[variables[key]]) {
|
166
|
+
variables[key] = variables[variables[key]];
|
167
|
+
}
|
168
|
+
});
|
216
169
|
});
|
217
|
-
}); // -- conversion for the root using rootConvertor --
|
218
|
-
|
219
|
-
/*
|
220
|
-
input :
|
221
|
-
.a{
|
222
|
-
padding : 20px
|
223
|
-
}
|
224
|
-
output :
|
225
|
-
// on settingObject file :
|
226
|
-
{ padding : { replacements : { px : 'zd_size$$' }}}
|
227
|
-
.a{
|
228
|
-
padding : zd_size20;
|
229
|
-
}
|
170
|
+
}); // -- conversion for the root using rootConvertor --
|
171
|
+
|
172
|
+
/*
|
173
|
+
input :
|
174
|
+
.a{
|
175
|
+
padding : 20px
|
176
|
+
}
|
177
|
+
output :
|
178
|
+
// on settingObject file :
|
179
|
+
{ padding : { replacements : { px : 'zd_size$$' }}}
|
180
|
+
.a{
|
181
|
+
padding : zd_size20;
|
182
|
+
}
|
230
183
|
*/
|
231
184
|
|
232
185
|
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
|
@@ -238,21 +191,19 @@ class VariableConversionCollector {
|
|
238
191
|
});
|
239
192
|
});
|
240
193
|
});
|
241
|
-
/*
|
242
|
-
purpose of tap : to display the errors encountered so far
|
243
|
-
input :
|
244
|
-
all css files
|
245
|
-
output :
|
246
|
-
all errors that are present in the errTable arr
|
194
|
+
/*
|
195
|
+
purpose of tap : to display the errors encountered so far
|
196
|
+
input :
|
197
|
+
all css files
|
198
|
+
output :
|
199
|
+
all errors that are present in the errTable arr
|
247
200
|
*/
|
248
201
|
|
249
202
|
compiler.hooks.afterEmit.tap('error-display', () => {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
throw new Error('^^^ Variables above have not been assigned! ^^^');
|
255
|
-
}
|
203
|
+
const {
|
204
|
+
errors,
|
205
|
+
errTable
|
206
|
+
} = require('../postcss-plugins/variableModificationPlugin/index');
|
256
207
|
|
257
208
|
let avlTypes = new Set([]);
|
258
209
|
let srtArr = errTable.sort((a, b) => {
|
@@ -262,39 +213,17 @@ class VariableConversionCollector {
|
|
262
213
|
if (a.type < b.type) {
|
263
214
|
return -1;
|
264
215
|
}
|
265
|
-
});
|
266
|
-
// const newVars = Object.keys(variables)
|
267
|
-
// //Filter Object with key contanis "NAME"
|
268
|
-
// .filter(key => variables[key].includes('--'))
|
269
|
-
// .reduce(
|
270
|
-
// (obj, key) =>
|
271
|
-
// Object.assign(obj, {
|
272
|
-
// [key]: variables[key]
|
273
|
-
// }),
|
274
|
-
// {}
|
275
|
-
// );
|
276
|
-
// console.log('new variables: ', newVars);
|
277
|
-
// try {
|
278
|
-
// fs.writeFileSync('./variableMapping.json', JSON.stringify(variables));
|
279
|
-
// } catch (err) {
|
280
|
-
// console.log(err);
|
281
|
-
// }
|
282
|
-
// fs.writeFile('./variableMapping.json', JSON.stringify(variables), err => {
|
283
|
-
// if (err) {
|
284
|
-
// throw err;
|
285
|
-
// }
|
286
|
-
// console.log('variable mapping file generated.');
|
287
|
-
// });
|
216
|
+
});
|
288
217
|
|
289
218
|
if (errorConsoleStatus) {
|
290
|
-
const
|
219
|
+
const errHandler = new _ErrorHandler.ErrorHandler();
|
291
220
|
avlTypes.forEach(type => {
|
292
221
|
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
293
222
|
console.log(`Error Type : ${type}`);
|
294
223
|
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
295
224
|
srtArr.forEach(err => {
|
296
225
|
if (err.decl.prop && err.decl.value && err.type === type) {
|
297
|
-
|
226
|
+
errHandler.printError(err);
|
298
227
|
}
|
299
228
|
});
|
300
229
|
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
@@ -302,13 +231,14 @@ class VariableConversionCollector {
|
|
302
231
|
}
|
303
232
|
|
304
233
|
if (errorLogStatus) {
|
305
|
-
|
234
|
+
_fs.default.writeFileSync('./css_error.log', '');
|
235
|
+
|
306
236
|
console.log('writing to logFile...');
|
307
237
|
|
308
238
|
if (errors.length > 0) {
|
309
239
|
errors.forEach((err, index) => {
|
310
240
|
if (errTable[index].decl.prop && errTable[index].decl.value) {
|
311
|
-
|
241
|
+
_fs.default.appendFileSync('./css_error.log', err);
|
312
242
|
}
|
313
243
|
});
|
314
244
|
}
|
@@ -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',
|
@@ -16,14 +16,13 @@ class ErrorHandler {
|
|
16
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
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
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
|
-
MULTIPLE_OCCURANCES: 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}`)
|
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}`)
|
21
20
|
});
|
22
21
|
}
|
23
22
|
|
24
23
|
setAllowedErrs(allErrs) {
|
25
24
|
this.allowedErrs = allErrs;
|
26
|
-
['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT'
|
25
|
+
['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT'].forEach(err => {
|
27
26
|
if (!this.allowedErrs[err]) {
|
28
27
|
this[err] = () => null;
|
29
28
|
}
|
@@ -36,7 +35,6 @@ class ErrorHandler {
|
|
36
35
|
|
37
36
|
errorFunction(errObj) {
|
38
37
|
if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
|
39
|
-
console.log(this.allowedErrs[errObj.type]);
|
40
38
|
this[errObj.type](errObj);
|
41
39
|
}
|
42
40
|
}
|
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 $?
|