@zohodesk/react-cli 0.0.1-exp.167.1 → 0.0.1-exp.167.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.prettierrc +6 -0
  3. package/README.md +98 -3
  4. package/bin/cli.js +10 -20
  5. package/docs/HoverActive.md +12 -0
  6. package/docs/InstallNode.md +28 -0
  7. package/docs/VariableConversion.md +678 -0
  8. package/lib/common/splitChunks.js +133 -7
  9. package/lib/configs/jest.config.js +8 -12
  10. package/lib/configs/libAlias.js +10 -3
  11. package/lib/configs/webpack.dev.config.js +21 -26
  12. package/lib/configs/webpack.docs.config.js +13 -19
  13. package/lib/configs/webpack.impact.config.js +13 -19
  14. package/lib/configs/webpack.prod.config.js +19 -15
  15. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  16. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  17. package/lib/loaderUtils/getCSSLoaders.js +51 -7
  18. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +63 -54
  19. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  20. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  21. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  22. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  23. package/lib/postcss-plugins/hoverActivePlugin.js +385 -0
  24. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
  25. package/lib/postcss-plugins/variableModificationPlugin/index.js +247 -0
  26. package/lib/postcss-plugins/variableModifier.js +244 -0
  27. package/lib/schemas/index.js +57 -6
  28. package/lib/servers/getCliPath.js +7 -3
  29. package/lib/utils/getOptions.js +29 -1
  30. package/package.json +4 -3
  31. package/cert/cert.pem +0 -37
  32. package/cert/key.pem +0 -27
  33. package/cert/passphrase.pem +0 -1
  34. package/eslint/NOTES.md +0 -3
  35. package/eslint/React_CDN.zip +0 -0
  36. package/eslint/a.sh +0 -14
  37. package/eslint/a23.c +0 -16
  38. package/eslint/a28.c +0 -25
  39. package/eslint/a29.c +0 -25
  40. package/eslint/a30.c +0 -29
  41. package/eslint/a31.c +0 -23
  42. package/eslint/a35.c +0 -23
  43. package/eslint/a36.c +0 -18
  44. package/eslint/a37.c +0 -25
  45. package/eslint/a38.c +0 -28
  46. package/eslint/a39.c +0 -17
  47. package/eslint/a40.c +0 -32
  48. package/eslint/mockapi.html +0 -18
  49. package/eslint/mockapi.md +0 -5
  50. package/eslint/testa/build.sh +0 -7
  51. package/eslint/testa/build1/index.html +0 -12
  52. package/eslint/testa/build1/js/2_.js +0 -15
  53. package/eslint/testa/build1/js/2_.js.map +0 -1
  54. package/eslint/testa/build1/js/main_.js +0 -40
  55. package/eslint/testa/build1/js/main_.js.map +0 -1
  56. package/eslint/testa/build1/js/runtime~main_.js +0 -251
  57. package/eslint/testa/build1/js/runtime~main_.js.map +0 -1
  58. package/eslint/testa/build2/index.html +0 -12
  59. package/eslint/testa/build2/js/2_.js +0 -15
  60. package/eslint/testa/build2/js/2_.js.map +0 -1
  61. package/eslint/testa/build2/js/3_.js +0 -15
  62. package/eslint/testa/build2/js/3_.js.map +0 -1
  63. package/eslint/testa/build2/js/main_.js +0 -46
  64. package/eslint/testa/build2/js/main_.js.map +0 -1
  65. package/eslint/testa/build2/js/runtime~main_.js +0 -251
  66. package/eslint/testa/build2/js/runtime~main_.js.map +0 -1
  67. package/eslint/testa/build3/index.710b00fba04c6c594ad3.html +0 -12
  68. package/eslint/testa/build3/js/2.321b867f0966f9c9cdfd_.js +0 -1
  69. package/eslint/testa/build3/js/main.eb2aec4c9f1c16a385e0_.js +0 -1
  70. package/eslint/testa/build3/js/runtime~main.fafbbe7484e9c126f4f7_.js +0 -1
  71. package/eslint/testa/build3/manifest.json +0 -1
  72. package/eslint/testa/build4/index.9ff03a2ccdc9b904f1fe.html +0 -12
  73. package/eslint/testa/build4/js/2.8b63ce57af6dd2bac274_.js +0 -1
  74. package/eslint/testa/build4/js/3.5208acbe37a44362090e_.js +0 -1
  75. package/eslint/testa/build4/js/main.a934d6c2e2329d97269e_.js +0 -1
  76. package/eslint/testa/build4/js/runtime~main.5b85dd9ab73069c1455a_.js +0 -1
  77. package/eslint/testa/build4/manifest.json +0 -1
  78. package/eslint/testa/package.json +0 -24
  79. package/eslint/testa/scr/chunk1.js +0 -3
  80. package/eslint/testa/scr/chunk2.js +0 -3
  81. package/eslint/testa/scr/index.html +0 -12
  82. package/eslint/testa/scr/index.js +0 -4
  83. package/eslint/testa/scr/utlis.js +0 -12
  84. package/eslint/testa/src/chunk1.js +0 -3
  85. package/eslint/testa/src/index.html +0 -12
  86. package/eslint/testa/src/index.js +0 -3
  87. package/eslint/testa/src/utlis.js +0 -7
@@ -0,0 +1,678 @@
1
+ # Variable Conversion
2
+
3
+ <!-- file paths :
4
+
5
+ # react - cli :
6
+ src\postcss-plugins\variableModificationPlugin\index.js
7
+
8
+ # source folder :
9
+ jsapps\supportapp\cssVariableReplacementOptions.json ( options json file )
10
+ jsapps\supportapp\plugins\pxParserPostcss.js ( px parsing as a process before plugin conversion to custom css variables in react -cli )
11
+ jsapps\supportapp\plugins\variableIgnore.js ( adding variable:ignore comment to ignore the line for any conversion beforehand to preserve the declaration )
12
+
13
+ -->
14
+
15
+ # Added support for Properties ( Cut 1 ) :
16
+
17
+ * font-size
18
+ * margin
19
+ * margin-top
20
+ * margin-bottom
21
+ * margin-left
22
+ * margin-right
23
+ * padding
24
+ * padding-top
25
+ * padding-bottom
26
+ * padding-left
27
+ * padding-right
28
+ * top
29
+ * right
30
+ * bottom
31
+ * left
32
+ * width
33
+ * min-width
34
+ * max-width
35
+ * height
36
+ * min-height
37
+ * max-height
38
+
39
+ # Css variable conversion consists of three steps :
40
+
41
+ . addition of comment variable:ignore for the seperation of values to be considered for the conversion and the ones that are not to be considered for conversion. ( `variableIgnore.js` )
42
+ . conversion of the variable from current css variables to corresponding px value manually. ( `pxParserPostcss.js` )
43
+ . conversion of the resultant px values to custom variables present in settings ( `cssVariableReplacementOptions.json` )
44
+
45
+ `cssVariableReplacementOptions.json example` :
46
+
47
+ ```json
48
+ {
49
+ "errorLog": false,
50
+ "errorInConsole": false,
51
+ "errorsAllowed":{
52
+ "DECLARATION_IGNORED" : true,
53
+ "UNIT_ERROR" : true,
54
+ "RANGE_ERROR" : true,
55
+ "VARIABLE_PRESENT" : true
56
+ },
57
+ "settings": {
58
+ "font-size": {
59
+ "allowed": [
60
+ "px",
61
+ "em",
62
+ "%",
63
+ "0",
64
+ "vh",
65
+ "initial"
66
+ ],
67
+ "replacements": {
68
+ "px": "var(--zd_font_size$$)",
69
+ "em": "var(--zd_font_size$$em)"
70
+ },
71
+ "range": {
72
+ "start": 0,
73
+ "end": 1650
74
+ }
75
+ },
76
+ "margin": {
77
+ "allowed": [
78
+ "px",
79
+ "em",
80
+ "fit-content",
81
+ "auto",
82
+ "%",
83
+ "inherit",
84
+ "-moz-fit-content",
85
+ "vh",
86
+ "0",
87
+ "initial",
88
+ "vw"
89
+ ],
90
+ "replacements": {
91
+ "px": "var(--zd_size$$)"
92
+ },
93
+ "range": {
94
+ "start": -1650,
95
+ "end": 1650
96
+ }
97
+ },
98
+ "margin-left": {
99
+ "allowed": [
100
+ "px",
101
+ "em",
102
+ "fit-content",
103
+ "auto",
104
+ "%",
105
+ "inherit",
106
+ "-moz-fit-content",
107
+ "vh",
108
+ "0",
109
+ "initial",
110
+ "vw"
111
+ ],
112
+ "replacements": {
113
+ "px": "var(--zd_size$$)"
114
+ },
115
+ "range": {
116
+ "start": -1650,
117
+ "end": 1650
118
+ }
119
+ },
120
+ "margin-right": {
121
+ "allowed": [
122
+ "px",
123
+ "em",
124
+ "fit-content",
125
+ "auto",
126
+ "%",
127
+ "inherit",
128
+ "-moz-fit-content",
129
+ "vh",
130
+ "0",
131
+ "initial",
132
+ "vw"
133
+ ],
134
+ "replacements": {
135
+ "px": "var(--zd_size$$)"
136
+ },
137
+ "range": {
138
+ "start": -1650,
139
+ "end": 1650
140
+ }
141
+ },
142
+ "margin-top": {
143
+ "allowed": [
144
+ "px",
145
+ "em",
146
+ "fit-content",
147
+ "auto",
148
+ "%",
149
+ "inherit",
150
+ "-moz-fit-content",
151
+ "vh",
152
+ "0",
153
+ "initial",
154
+ "vw"
155
+ ],
156
+ "replacements": {
157
+ "px": "var(--zd_size$$)"
158
+ },
159
+ "range": {
160
+ "start": -1650,
161
+ "end": 1650
162
+ }
163
+ },
164
+ "margin-bottom": {
165
+ "allowed": [
166
+ "px",
167
+ "em",
168
+ "fit-content",
169
+ "auto",
170
+ "%",
171
+ "inherit",
172
+ "-moz-fit-content",
173
+ "vh",
174
+ "0",
175
+ "initial",
176
+ "vw"
177
+ ],
178
+ "replacements": {
179
+ "px": "var(--zd_size$$)"
180
+ },
181
+ "range": {
182
+ "start": -1650,
183
+ "end": 1650
184
+ }
185
+ },
186
+ "padding": {
187
+ "allowed": [
188
+ "px",
189
+ "em",
190
+ "fit-content",
191
+ "auto",
192
+ "%",
193
+ "inherit",
194
+ "-moz-fit-content",
195
+ "vh",
196
+ "0",
197
+ "initial",
198
+ "vw"
199
+ ],
200
+ "replacements": {
201
+ "px": "var(--zd_size$$)"
202
+ },
203
+ "range": {
204
+ "start": -1650,
205
+ "end": 1650
206
+ }
207
+ },
208
+ "padding-left": {
209
+ "allowed": [
210
+ "px",
211
+ "em",
212
+ "fit-content",
213
+ "auto",
214
+ "%",
215
+ "inherit",
216
+ "-moz-fit-content",
217
+ "vh",
218
+ "0",
219
+ "initial",
220
+ "vw"
221
+ ],
222
+ "replacements": {
223
+ "px": "var(--zd_size$$)"
224
+ },
225
+ "range": {
226
+ "start": -1650,
227
+ "end": 1650
228
+ }
229
+ },
230
+ "padding-right": {
231
+ "allowed": [
232
+ "px",
233
+ "em",
234
+ "fit-content",
235
+ "auto",
236
+ "%",
237
+ "inherit",
238
+ "-moz-fit-content",
239
+ "vh",
240
+ "0",
241
+ "initial",
242
+ "vw"
243
+ ],
244
+ "replacements": {
245
+ "px": "var(--zd_size$$)"
246
+ },
247
+ "range": {
248
+ "start": -1650,
249
+ "end": 1650
250
+ }
251
+ },
252
+ "padding-top": {
253
+ "allowed": [
254
+ "px",
255
+ "em",
256
+ "fit-content",
257
+ "auto",
258
+ "%",
259
+ "inherit",
260
+ "-moz-fit-content",
261
+ "vh",
262
+ "0",
263
+ "initial",
264
+ "vw"
265
+ ],
266
+ "replacements": {
267
+ "px": "var(--zd_size$$)"
268
+ },
269
+ "range": {
270
+ "start": -1650,
271
+ "end": 1650
272
+ }
273
+ },
274
+ "padding-bottom": {
275
+ "allowed": [
276
+ "px",
277
+ "em",
278
+ "fit-content",
279
+ "auto",
280
+ "%",
281
+ "inherit",
282
+ "-moz-fit-content",
283
+ "vh",
284
+ "0",
285
+ "initial",
286
+ "vw"
287
+ ],
288
+ "replacements": {
289
+ "px": "var(--zd_size$$)"
290
+ },
291
+ "range": {
292
+ "start": -1650,
293
+ "end": 1650
294
+ }
295
+ },
296
+ "height": {
297
+ "allowed": [
298
+ "px",
299
+ "em",
300
+ "fit-content",
301
+ "auto",
302
+ "%",
303
+ "inherit",
304
+ "-moz-fit-content",
305
+ "vh",
306
+ "0",
307
+ "initial",
308
+ "vw"
309
+ ],
310
+ "replacements": {
311
+ "px": "var(--zd_size$$)"
312
+ },
313
+ "range": {
314
+ "start": -1650,
315
+ "end": 1650
316
+ }
317
+ },
318
+ "width": {
319
+ "allowed": [
320
+ "px",
321
+ "em",
322
+ "fit-content",
323
+ "auto",
324
+ "%",
325
+ "inherit",
326
+ "-moz-fit-content",
327
+ "vh",
328
+ "0",
329
+ "initial",
330
+ "vw"
331
+ ],
332
+ "replacements": {
333
+ "px": "var(--zd_size$$)"
334
+ },
335
+ "range": {
336
+ "start": -1650,
337
+ "end": 1650
338
+ }
339
+ },
340
+ "min-width": {
341
+ "allowed": [
342
+ "px",
343
+ "em",
344
+ "fit-content",
345
+ "auto",
346
+ "%",
347
+ "inherit",
348
+ "-moz-fit-content",
349
+ "vh",
350
+ "0",
351
+ "initial",
352
+ "vw"
353
+ ],
354
+ "replacements": {
355
+ "px": "var(--zd_size$$)"
356
+ },
357
+ "range": {
358
+ "start": -1650,
359
+ "end": 1650
360
+ }
361
+ },
362
+ "max-width": {
363
+ "allowed": [
364
+ "px",
365
+ "em",
366
+ "fit-content",
367
+ "auto",
368
+ "%",
369
+ "inherit",
370
+ "-moz-fit-content",
371
+ "vh",
372
+ "0",
373
+ "initial",
374
+ "vw"
375
+ ],
376
+ "replacements": {
377
+ "px": "var(--zd_size$$)"
378
+ },
379
+ "range": {
380
+ "start": -1650,
381
+ "end": 1650
382
+ }
383
+ },
384
+ "min-height": {
385
+ "allowed": [
386
+ "px",
387
+ "em",
388
+ "fit-content",
389
+ "auto",
390
+ "%",
391
+ "inherit",
392
+ "-moz-fit-content",
393
+ "vh",
394
+ "0",
395
+ "initial",
396
+ "vw"
397
+ ],
398
+ "replacements": {
399
+ "px": "var(--zd_size$$)"
400
+ },
401
+ "range": {
402
+ "start": -1650,
403
+ "end": 1650
404
+ }
405
+ },
406
+ "max-height": {
407
+ "allowed": [
408
+ "px",
409
+ "em",
410
+ "fit-content",
411
+ "auto",
412
+ "%",
413
+ "inherit",
414
+ "-moz-fit-content",
415
+ "vh",
416
+ "0",
417
+ "initial",
418
+ "vw"
419
+ ],
420
+ "replacements": {
421
+ "px": "var(--zd_size$$)"
422
+ },
423
+ "range": {
424
+ "start": -1650,
425
+ "end": 1650
426
+ }
427
+ },
428
+ "top": {
429
+ "allowed": [
430
+ "px",
431
+ "em",
432
+ "fit-content",
433
+ "auto",
434
+ "%",
435
+ "inherit",
436
+ "-moz-fit-content",
437
+ "vh",
438
+ "0",
439
+ "initial",
440
+ "vw"
441
+ ],
442
+ "replacements": {
443
+ "px": "var(--zd_size$$)"
444
+ },
445
+ "range": {
446
+ "start": -1650,
447
+ "end": 1650
448
+ }
449
+ },
450
+ "bottom": {
451
+ "allowed": [
452
+ "px",
453
+ "em",
454
+ "fit-content",
455
+ "auto",
456
+ "%",
457
+ "inherit",
458
+ "-moz-fit-content",
459
+ "vh",
460
+ "0",
461
+ "initial",
462
+ "vw"
463
+ ],
464
+ "replacements": {
465
+ "px": "var(--zd_size$$)"
466
+ },
467
+ "range": {
468
+ "start": -1650,
469
+ "end": 1650
470
+ }
471
+ },
472
+ "left": {
473
+ "allowed": [
474
+ "px",
475
+ "em",
476
+ "fit-content",
477
+ "auto",
478
+ "%",
479
+ "inherit",
480
+ "-moz-fit-content",
481
+ "vh",
482
+ "0",
483
+ "initial",
484
+ "vw"
485
+ ],
486
+ "replacements": {
487
+ "px": "var(--zd_size$$)"
488
+ },
489
+ "range": {
490
+ "start": -1650,
491
+ "end": 1650
492
+ }
493
+ },
494
+ "right": {
495
+ "allowed": [
496
+ "px",
497
+ "em",
498
+ "fit-content",
499
+ "auto",
500
+ "%",
501
+ "inherit",
502
+ "-moz-fit-content",
503
+ "vh",
504
+ "0",
505
+ "initial",
506
+ "vw"
507
+ ],
508
+ "replacements": {
509
+ "px": "var(--zd_size$$)"
510
+ },
511
+ "range": {
512
+ "start": -1650,
513
+ "end": 1650
514
+ }
515
+ }
516
+ }
517
+ }
518
+ ```
519
+
520
+ Step 1 : Adding variable:ignore
521
+
522
+ use command `npm run variable:addignore` on source folder
523
+
524
+ before :
525
+ ```css
526
+ .a{
527
+ font-size: var(--zd_size14);
528
+ margin: var(--zd_size12);
529
+ padding: 12px;
530
+ }
531
+ ```
532
+
533
+ after :
534
+
535
+ ```css
536
+ /* explanation : since padding has declaration in px instead of var, it is considered unique and thereby no conversion should take place, hence we add variable:ignore preceding the line */
537
+ .a{
538
+ font-size: var(--zd_size14);
539
+ margin: var(--zd_size12);
540
+ /*Variable:Ignore*/
541
+ padding: 12px;
542
+ }
543
+ ```
544
+
545
+ Step 2 : Converting vars to px
546
+
547
+ use command `npm run variable:convert` on source folder
548
+
549
+ before :
550
+ ```css
551
+ .a{
552
+ font-size: var(--zd_size14);
553
+ margin: var(--zd_size12);
554
+ /*Variable:Ignore*/
555
+ padding: 12px;
556
+ }
557
+ ```
558
+
559
+ after :
560
+ ```css
561
+ /* explanation : conversion from vars to px is done making the declarations convertable to custom variables further by the react-cli plugin*/
562
+ .a{
563
+ font-size: 14px;
564
+ margin: 12px;
565
+ /*Variable:Ignore*/
566
+ padding: 12px;
567
+ }
568
+ ```
569
+
570
+ Step 3 : Conversion from px to custom variables present in settings
571
+
572
+ Things that are considered in the conversion :
573
+ => `allowed` is the allowed units that can be converted through the plugin
574
+ => `replacements` are the conversion strings where `$$` will be converted to respective numbers
575
+ => `range` is the starting and ending value within numbers will be allowed.
576
+
577
+ `variableModificationPlugin` in react-cli folder is where the conversion takes place.
578
+
579
+ and output would be as follows :
580
+
581
+ before :
582
+
583
+ ```css
584
+ /* explanation : conversion from px to variable is allowed since, all the conditions for font-size and margin are satisfied, the numbers are within range and the unit is in the allowed array, replacements are thereby taken from the values in replacements and conversion is done to custom variables */
585
+
586
+ /*
587
+ "font-size": {
588
+ "allowed": [
589
+ "px",
590
+ "em",
591
+ "%",
592
+ "0",
593
+ "vh",
594
+ "initial"
595
+ ],
596
+ "replacements": {
597
+ "px": "var(--zd_font_size$$)",
598
+ "em": "var(--zd_font_size$$em)"
599
+ },
600
+ "range": {
601
+ "start": 0,
602
+ "end": 1650
603
+ }
604
+ },
605
+ */
606
+ /*
607
+
608
+ "margin": {
609
+ "allowed": [
610
+ "px",
611
+ "em",
612
+ "fit-content",
613
+ "auto",
614
+ "%",
615
+ "inherit",
616
+ "-moz-fit-content",
617
+ "vh",
618
+ "0",
619
+ "initial",
620
+ "vw"
621
+ ],
622
+ "replacements": {
623
+ "px": "var(--zd_size$$)"
624
+ },
625
+ "range": {
626
+ "start": -1650,
627
+ "end": 1650
628
+ }
629
+ },
630
+
631
+ */
632
+ .a{
633
+ font-size: 14px;
634
+ margin: 12px;
635
+ /*Variable:Ignore*/
636
+ padding: 12px;
637
+ }
638
+ ```
639
+
640
+ after :
641
+
642
+ ```css
643
+
644
+ .a{
645
+ font-size: var(--zd_size14);
646
+ margin: var(--zd_size12);
647
+ /*Variable:Ignore*/
648
+ padding: 12px;
649
+ }
650
+ ```
651
+
652
+ Output configuration :
653
+
654
+ Consider the below mentioned :
655
+ ```json
656
+ "errorLog": false,
657
+ "errorInConsole": false,
658
+ "errorsAllowed":{
659
+ "DECLARATION_IGNORED" : true,
660
+ "UNIT_ERROR" : true,
661
+ "RANGE_ERROR" : true,
662
+ "VARIABLE_PRESENT" : true
663
+ },
664
+ ```
665
+ . if an error log is necessary, a physical file `css_error.log` will be created in the source directory upon making `errorLog` true. will take generally more than usual time to write in the file, so delay in build is present.
666
+
667
+ . if error is needed to be seen in the console, `errorInConsole` should be enabled, all errors will be printed in the console.
668
+
669
+ . Individual errors can be enabled in `errorsAllowed` to collaboratively produce the error log file / errors in console. Here each of the errors mean the following :
670
+
671
+ => `DECLARATION_IGNORED` : Lines that succeed the /*Variable:Ignore*/ comment.
672
+ => `UNIT_ERROR` : the units that are not present in the corresponding property's `allowed` array are used.
673
+ => `RANGE_ERROR` : numerical values that are not present within the range of the corresponding property's `range` is used.
674
+ => `VARIABLE_PRESENT` : conversion to px (Step 2) wasn't done properly and hence there are residues that contain `var` in it are found.
675
+
676
+
677
+ * First two conversions are to be done manually by the use of the commands, `npm run variable:addignore` and `npm run variable:convert`
678
+ * Final conversion is done by react-cli on compilation of the source folder `npm run start --app:port=**** --app:domain=****`