@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1

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 (245) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/README.md +1028 -951
  5. package/bin/cli.js +483 -483
  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/TODOS.md +10 -10
  13. package/docs/ValueReplacer.md +60 -60
  14. package/docs/VariableConversion.md +678 -0
  15. package/docs/warnings_while_install.txt +35 -35
  16. package/files/eslintrc.js +62 -62
  17. package/files/prettierrc.js +3 -3
  18. package/lib/babel/cmjs-plugins-presets.js +0 -4
  19. package/lib/babel/es-plugins-presets.js +0 -4
  20. package/lib/common/getEntries.js +0 -10
  21. package/lib/common/getPublicPathConfig.js +0 -6
  22. package/lib/common/index.js +0 -5
  23. package/lib/common/splitChunks.js +2 -13
  24. package/lib/common/sslcertUpdater.js +6 -17
  25. package/lib/common/templateParameters.js +0 -2
  26. package/lib/common/testPattern.js +10 -21
  27. package/lib/common/valueReplacer.js +0 -15
  28. package/lib/configs/jest.config.js +8 -21
  29. package/lib/configs/libAlias.js +11 -2
  30. package/lib/configs/webpack.component.umd.config.js +0 -5
  31. package/lib/configs/webpack.css.umd.config.js +5 -13
  32. package/lib/configs/webpack.dev.config.js +13 -24
  33. package/lib/configs/webpack.docs.config.js +6 -12
  34. package/lib/configs/webpack.impact.config.js +6 -10
  35. package/lib/configs/webpack.prod.config.js +15 -26
  36. package/lib/hooks/docsProptypeHook.js +3 -7
  37. package/lib/jest/commitedFilesResult.js +3 -45
  38. package/lib/jest/coverageCollector.js +0 -11
  39. package/lib/jest/jsonMaker.js +0 -6
  40. package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
  41. package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
  43. package/lib/jest/result.js +0 -22
  44. package/lib/jest/run.js +6 -17
  45. package/lib/jest/setup.js +5 -57
  46. package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
  47. package/lib/loaderUtils/getCSSLoaders.js +41 -28
  48. package/lib/loaderUtils/getDevJsLoaders.js +0 -8
  49. package/lib/loaderUtils/index.js +0 -3
  50. package/lib/loaders/docsLoader.js +0 -7
  51. package/lib/loaders/docsPropsLoader.js +3 -7
  52. package/lib/loaders/fileBountryLoader.js +0 -2
  53. package/lib/loaders/fileLoader.js +11 -22
  54. package/lib/loaders/scriptInstrumentLoader.js +5 -13
  55. package/lib/loaders/selectorMappingLoader.js +7 -25
  56. package/lib/loaders/workerLoader.js +13 -29
  57. package/lib/middlewares/HMRMiddleware.js +13 -26
  58. package/lib/middlewares/SSTMiddleware.js +0 -3
  59. package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
  60. package/lib/pluginUtils/getDevPlugins.js +20 -64
  61. package/lib/pluginUtils/getDocsPlugins.js +1 -10
  62. package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
  63. package/lib/pluginUtils/getLibraryPlugins.js +0 -5
  64. package/lib/pluginUtils/getProdPlugins.js +32 -78
  65. package/lib/pluginUtils/getServerPlugins.js +0 -5
  66. package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
  67. package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
  68. package/lib/pluginUtils/index.js +0 -8
  69. package/lib/plugins/CdnChangePlugin.js +0 -14
  70. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  71. package/lib/plugins/EFCPlugin.js +23 -34
  72. package/lib/plugins/EFCPlugin.md +6 -6
  73. package/lib/plugins/EFCTemplatePlugin.js +23 -32
  74. package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
  75. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
  76. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  77. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
  78. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
  79. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
  80. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  81. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  82. package/lib/plugins/I18nSplitPlugin/index.js +70 -80
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
  89. package/lib/plugins/ManifestPlugin.js +0 -17
  90. package/lib/plugins/ModuleStatsPlugin.js +0 -23
  91. package/lib/plugins/OptimizeJSPlugin.js +0 -7
  92. package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
  93. package/lib/plugins/PublicPathChangePlugin.js +4 -36
  94. package/lib/plugins/ReportGeneratePlugin.js +4 -30
  95. package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
  96. package/lib/plugins/ResourceHintsPlugin.js +20 -27
  97. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  98. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
  99. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  100. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  101. package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
  102. package/lib/plugins/ServiceWorkerPlugin.js +13 -29
  103. package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
  104. package/lib/plugins/SourceMapHookPlugin.js +0 -9
  105. package/lib/plugins/TPHashMappingPlugin.js +5 -19
  106. package/lib/plugins/UglifyCSSPlugin.js +0 -9
  107. package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
  108. package/lib/plugins/index.js +0 -19
  109. package/lib/plugins/libraryImpactPlugin.js +0 -32
  110. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  111. package/lib/postcss-plugins/ExcludePlugin.js +0 -4
  112. package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
  113. package/lib/postcss-plugins/ValueReplacer.js +9 -6
  114. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  115. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  116. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  117. package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
  118. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
  119. package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
  120. package/lib/postcss-plugins/variableModifier.js +14 -20
  121. package/lib/schemas/index.js +28 -13
  122. package/lib/servers/clusterHubServer.js +0 -10
  123. package/lib/servers/devBuild.js +13 -24
  124. package/lib/servers/docsServer.js +0 -2
  125. package/lib/servers/docsServerCore.js +0 -21
  126. package/lib/servers/getCliPath.js +1 -10
  127. package/lib/servers/helpServer.js +0 -5
  128. package/lib/servers/httpsOptions.js +0 -4
  129. package/lib/servers/impactServer.js +2 -34
  130. package/lib/servers/mockserver.js +0 -9
  131. package/lib/servers/nowatchserver.js +12 -34
  132. package/lib/servers/scrServer.js +13 -20
  133. package/lib/servers/server.js +7 -35
  134. package/lib/servers/ssServer.js +0 -16
  135. package/lib/sh/pre-commit.sh +34 -34
  136. package/lib/sh/reportPublish.sh +45 -45
  137. package/lib/templates/CoverageScriptTemplate.js +0 -14
  138. package/lib/templates/WMSTemplate.js +6 -12
  139. package/lib/utils/babelPresets.js +0 -2
  140. package/lib/utils/buildstats.html +148 -148
  141. package/lib/utils/clean.js +2 -8
  142. package/lib/utils/copy.js +0 -6
  143. package/lib/utils/copyTimezones.js +0 -8
  144. package/lib/utils/createEventStream.js +0 -4
  145. package/lib/utils/cssClassNameGenerate.js +3 -19
  146. package/lib/utils/cssURLReplacer.js +0 -25
  147. package/lib/utils/dependencyPostPublish.js +0 -9
  148. package/lib/utils/fileUtils.js +0 -26
  149. package/lib/utils/folderIterator.js +0 -10
  150. package/lib/utils/getComponents.js +0 -21
  151. package/lib/utils/getCurrentBranch.js +0 -5
  152. package/lib/utils/getDependenciesImpactList.js +0 -21
  153. package/lib/utils/getHash.js +0 -7
  154. package/lib/utils/getIp.js +0 -2
  155. package/lib/utils/getOptions.js +38 -35
  156. package/lib/utils/getServerURL.js +0 -7
  157. package/lib/utils/index.js +2 -47
  158. package/lib/utils/init.js +0 -1
  159. package/lib/utils/initPreCommitHook.js +6 -29
  160. package/lib/utils/jsonHelper.js +2 -19
  161. package/lib/utils/libraryImpactConfig.js +0 -2
  162. package/lib/utils/lint/addScripts.js +2 -5
  163. package/lib/utils/lint/checkExistingConfig.js +3 -12
  164. package/lib/utils/lint/copyConfigs.js +0 -3
  165. package/lib/utils/lint/index.js +0 -9
  166. package/lib/utils/lint/lintScripts.js +0 -1
  167. package/lib/utils/lint/lintSetup.js +3 -4
  168. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  169. package/lib/utils/lint/question.js +0 -7
  170. package/lib/utils/lintReporter.js +0 -20
  171. package/lib/utils/mailSender.js +0 -7
  172. package/lib/utils/pullOrigin.js +0 -4
  173. package/lib/utils/reinstallDependencies.js +0 -28
  174. package/lib/utils/removeAttributes.js +0 -7
  175. package/lib/utils/repoClone.js +2 -27
  176. package/lib/utils/request.js +0 -12
  177. package/lib/utils/resultSchema.json +73 -73
  178. package/lib/utils/rtl.js +4 -16
  179. package/lib/utils/setEnvVariables.js +0 -2
  180. package/lib/utils/ssTestHack.js +0 -10
  181. package/lib/utils/switchBranch.js +0 -4
  182. package/lib/utils/urlConcat.js +0 -4
  183. package/lib/utils/useExitCleanup.js +9 -10
  184. package/npm8.md +9 -9
  185. package/package.json +146 -148
  186. package/postpublish.js +6 -6
  187. package/templates/app/.eslintrc.js +140 -140
  188. package/templates/app/README.md +12 -12
  189. package/templates/app/app/index.html +24 -24
  190. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  191. package/templates/app/app/properties/i18nkeys.json +3 -3
  192. package/templates/app/docs/all.html +69 -69
  193. package/templates/app/mockapi/index.js +18 -18
  194. package/templates/app/package.json +37 -37
  195. package/templates/app/src/actions/SampleActions/index.js +37 -37
  196. package/templates/app/src/actions/index.js +65 -65
  197. package/templates/app/src/appUrls.js +19 -19
  198. package/templates/app/src/components/Alert/Alert.js +134 -134
  199. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  200. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  201. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  202. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  203. package/templates/app/src/components/Sample/SampleList.js +61 -61
  204. package/templates/app/src/components/Slider/Slider.css +41 -41
  205. package/templates/app/src/components/Slider/Slider.js +55 -55
  206. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  207. package/templates/app/src/containers/AppContainer/index.js +96 -96
  208. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  209. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  210. package/templates/app/src/containers/DevTools/index.js +10 -10
  211. package/templates/app/src/containers/Header/index.js +67 -67
  212. package/templates/app/src/containers/Header/index.module.css +43 -43
  213. package/templates/app/src/containers/Redirect/index.js +63 -63
  214. package/templates/app/src/containers/Redirector/index.js +47 -47
  215. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  216. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  217. package/templates/app/src/historyChange.js +5 -5
  218. package/templates/app/src/index.html +10 -10
  219. package/templates/app/src/index.js +24 -24
  220. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  221. package/templates/app/src/reducers/alertData.js +11 -11
  222. package/templates/app/src/reducers/index.js +6 -6
  223. package/templates/app/src/reducers/samples.js +19 -19
  224. package/templates/app/src/store/configureStore.dev.js +51 -51
  225. package/templates/app/src/store/configureStore.js +5 -5
  226. package/templates/app/src/store/configureStore.prod.js +26 -26
  227. package/templates/app/src/util/Common.js +5 -5
  228. package/templates/app/src/util/RequestAPI.js +132 -132
  229. package/templates/docs/all.html +249 -249
  230. package/templates/docs/component.html +178 -178
  231. package/templates/docs/components.html +221 -221
  232. package/templates/docs/css/b.min.css +6 -6
  233. package/templates/docs/css/component.css +42 -42
  234. package/templates/docs/css/componentTest.css +6 -6
  235. package/templates/docs/css/hopscotch.css +585 -585
  236. package/templates/docs/css/style.css +1022 -1022
  237. package/templates/docs/impactReportTemplate.html +154 -154
  238. package/templates/docs/index.html +1501 -1493
  239. package/templates/docs/js/active-line.js +72 -72
  240. package/templates/docs/js/b.min.js +7 -7
  241. package/templates/docs/js/codemirror.js +9680 -9680
  242. package/templates/docs/js/designTokens.js +334 -334
  243. package/templates/docs/js/j.min.js +4 -4
  244. package/templates/docs/js/javascript.js +874 -874
  245. package/templates/docs/js/matchbrackets.js +145 -145
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ const postcss = require('postcss');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const errors = [];
7
+ let allowedErrs = {};
8
+ const convertableProps = {
9
+ 'font-size': true,
10
+ margin: true,
11
+ 'margin-left': true,
12
+ 'margin-right': true,
13
+ 'margin-top': true,
14
+ 'margin-bottom': true,
15
+ padding: true,
16
+ 'padding-top': true,
17
+ 'padding-bottom': true,
18
+ 'padding-left': true,
19
+ 'padding-right': true,
20
+ width: true,
21
+ 'min-width': true,
22
+ 'max-width': true,
23
+ height: true,
24
+ 'min-height': true,
25
+ 'max-height': true,
26
+ top: true,
27
+ bottom: true,
28
+ left: true,
29
+ right: true
30
+ };
31
+ const constantValues = {
32
+ inherit: true,
33
+ initial: true,
34
+ auto: true,
35
+ 'fit-content': true,
36
+ unset: true
37
+ };
38
+ function getNumericValue(value) {
39
+ if (value.includes('var')) {
40
+ return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
41
+ }
42
+
43
+ // Not need for this dum loop
44
+ // allowed.forEach(alwdUnit => {
45
+ // if (value.includes(alwdUnit)) {
46
+ // return parseInt(value);
47
+ // }
48
+ // });
49
+
50
+ if (constantValues[value.toLowerCase()]) {
51
+ return 1;
52
+ }
53
+ return parseInt(value);
54
+ }
55
+ function pxToCalc(value) {
56
+ const arr = value.split(' ');
57
+ arr.forEach((val, index) => {
58
+ ['px'].forEach(unit => {
59
+ const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
60
+ if (valWithUnit.test(val)) {
61
+ arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
62
+ }
63
+ });
64
+ });
65
+ return arr.join(' ');
66
+ }
67
+ const addError = errstr => {
68
+ errors.push(`{\n${errstr}\n}\n`);
69
+ };
70
+ const errorFunction = (errStr, type) => {
71
+ if (type === 'DECLARATION_IGNORED' && allowedErrs.DECLARATION_IGNORED) {
72
+ addError(errStr);
73
+ } else if (type === 'UNIT_ERROR' && allowedErrs.UNIT_ERROR) {
74
+ addError(errStr);
75
+ } else if (type === 'RANGE_ERROR' && allowedErrs.RANGE_ERROR) {
76
+ addError(errStr);
77
+ } else if (type === 'VARIABLE_PRESENT' && allowedErrs.VARIABLE_PRESENT) {
78
+ addError(errStr);
79
+ }
80
+ };
81
+ const singleConvertor = (value, changeVal, details, range) => {
82
+ const {
83
+ path,
84
+ filename,
85
+ decl
86
+ } = details;
87
+ if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
88
+ let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
89
+ if (/^-var/.test(retVal)) {
90
+ retVal = `calc( ${retVal.substring(1)} * -1 )`;
91
+ }
92
+ return retVal;
93
+ }
94
+ // if(unitErrorVal && unitErrorVal != '0' ){
95
+ // console.log(value, 'not within range')
96
+ 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');
97
+ // }
98
+ // 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`)
99
+ return value;
100
+ };
101
+ module.exports = postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
102
+ const rawdata = fs.readFileSync(cssVariableReplacementConfig);
103
+ const data = JSON.parse(rawdata);
104
+ const {
105
+ errorsAllowed,
106
+ settings: settingsObject,
107
+ errorLog: errorLogStatus,
108
+ errorInConsole: errorConsoleStatus
109
+ } = data;
110
+ // const keys = Object.keys(settingsObject);
111
+ allowedErrs = errorsAllowed;
112
+ const replacementArray = [];
113
+ Object.keys(settingsObject).forEach(key => {
114
+ Object.values(settingsObject[key].replacements).forEach(val => {
115
+ if (!replacementArray.includes(val)) {
116
+ replacementArray.push(val);
117
+ }
118
+ });
119
+ });
120
+ let regValStr = '';
121
+ replacementArray.forEach((val, index) => {
122
+ if (index !== replacementArray.length - 1) {
123
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
124
+ } else {
125
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
126
+ }
127
+ });
128
+ const valRegex = new RegExp(regValStr, 'gi');
129
+ return rootOriginal => {
130
+ rootOriginal.walkRules(rule => {
131
+ // rule.nodes[-1] = {}
132
+ // need map, forEach fine less memory
133
+ rule.nodes.forEach((decl, position) => {
134
+ // case font-size
135
+ const commentStr = 'variable:ignore';
136
+ const prevNode = rule.nodes[position - 1];
137
+ const fromPath = rootOriginal.source.input.from;
138
+ // this will be problem for linux and mac use require('path').sep
139
+ // split not need use slice and lastIndexOf less memory
140
+ const filename = fromPath.split(path.sep).pop();
141
+ if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
142
+ 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`;
143
+ errorFunction(errStr, 'DECLARATION_IGNORED');
144
+ return;
145
+ }
146
+ if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
147
+ const settings = settingsObject[decl.prop];
148
+ // console.log(settings)
149
+ const {
150
+ allowed,
151
+ range
152
+ } = settings;
153
+ // suggestion filter !decl.value.includes('calc')
154
+ // Reason below some of logic happen based on this
155
+ const unit = decl.value.toString()
156
+ // no need round braket since you do not need group for less memory
157
+ .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').split(' ').filter(x => x !== '');
158
+ // unit = unit.replace(unit, unit.replace('-',''))
159
+ // console.log('unit : ');
160
+ // console.log(unit);
161
+ unit.forEach((val, index) => {
162
+ allowed.forEach(alwdVal => {
163
+ if (val.includes(alwdVal)) {
164
+ // ## for what purpose
165
+ unit[index] = val.replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`);
166
+ }
167
+ });
168
+ });
169
+ let unitError = false;
170
+ let unitErrorVal = '';
171
+ unit.forEach(val => {
172
+ if (!val.includes('calc')) {
173
+ if (!allowed.includes(val.toString())) {
174
+ unitError = true;
175
+ unitErrorVal = val;
176
+ }
177
+ }
178
+ });
179
+ // console.log(allowed, replacements, range)
180
+ if (!unitError) {
181
+ // use variable decl.value.split(' ')
182
+ if (range) {
183
+ // console.log('multiple :', decl.value)
184
+ let newVal = '';
185
+ decl.value.split(' ').forEach(singleVal => {
186
+ newVal += `${singleConvertor(singleVal, settings.replacements.px, {
187
+ decl,
188
+ filename,
189
+ path: fromPath
190
+ }, range)} `;
191
+ });
192
+ decl.value = newVal;
193
+ }
194
+ } else {
195
+ if (!decl.value.includes('calc')) {
196
+ // 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`);
197
+ 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');
198
+ } else {
199
+ decl.value = pxToCalc(decl.value);
200
+ }
201
+ }
202
+ } else {
203
+ 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')) {
204
+ 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');
205
+ }
206
+ }
207
+ });
208
+ });
209
+ // console.log(filename)
210
+ // console.log('Done!')
211
+ // console.log('----------------------------------------------------------------------------------------------------------------------')
212
+ if (errorLogStatus) {
213
+ fs.writeFileSync('./css_error.log', '');
214
+ if (errors.length > 0) {
215
+ errors.forEach(err => {
216
+ fs.appendFileSync('./css_error.log', err);
217
+ });
218
+ // console.log('----------------------------------------------------------------------------------------------------------------------')
219
+ }
220
+ }
221
+
222
+ if (errorConsoleStatus) {
223
+ if (errors.length > 0) {
224
+ errors.forEach(err => {
225
+ // fs.appendFileSync('./css_error.log', err);
226
+ console.log(err);
227
+ });
228
+ console.log('----------------------------------------------------------------------------------------------------------------------');
229
+ }
230
+ }
231
+ };
232
+ });
@@ -1,21 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  const postcss = require('postcss');
4
-
5
4
  const path = require('path');
6
-
7
5
  const fs = require('fs');
8
-
9
6
  function populateArray(start, end) {
10
7
  let temp = [];
11
-
12
8
  for (var i = start; i < end; i++) {
13
9
  temp.push(i);
14
10
  }
15
-
16
11
  return temp;
17
12
  }
18
-
19
13
  let allwdVars = {
20
14
  'font-size': ['px', 'em']
21
15
  };
@@ -84,11 +78,9 @@ let numberObject = {
84
78
  }
85
79
  }
86
80
  };
87
-
88
81
  function hasIgnoreComment(node) {
89
82
  return node ? node.type == 'comment' ? node.text == 'Variable:Ignore' ? true : false : false : false;
90
83
  }
91
-
92
84
  let errors = [];
93
85
  module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal => {
94
86
  // console.log('inside postcss plugin')
@@ -101,26 +93,26 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
101
93
  rule.walkDecls((decl, position) => {
102
94
  // case font-size
103
95
  if (!hasIgnoreComment(rule.nodes[position - 1])) {
96
+ console.log(settings);
104
97
  let unit = decl.value.replace(/[0-9]/g, '');
105
98
  let settings = numberObject[decl.prop];
106
99
  let path = rootOriginal.source.input.from;
107
100
  let filename = path.split('\\');
108
101
  filename = filename[filename.length - 1];
109
-
110
102
  if (decl.prop === 'font-size' || decl.prop === 'margin-left' || decl.prop === 'margin-right' || decl.prop === 'margin-top' || decl.prop === 'margin-bottom') {
111
103
  let {
112
104
  allowed,
113
105
  replacements,
114
106
  available
115
107
  } = settings;
116
-
117
108
  if (!rootOriginal.source.input.from.includes('node_modules')) {
118
109
  if (unit != 0) {
119
110
  if (allowed.includes(unit)) {
120
111
  // console.log(available, parseInt(decl.value))
121
112
  if (available.includes(parseInt(decl.value))) {
122
113
  // replacementValues[unit].push({[decl.value] : replacements[unit].replace('$$', parseInt(decl.value))})
123
- decl.value = replacements[unit].replace('$$', parseInt(decl.value)); //console.log("replacements:")
114
+ decl.value = replacements[unit].replace('$$', parseInt(decl.value));
115
+ //console.log("replacements:")
124
116
  } else {
125
117
  let err = {
126
118
  prop: decl.prop,
@@ -152,17 +144,16 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
152
144
  allowed,
153
145
  replacements,
154
146
  available
155
- } = settings; //console.log(decl.prop + " " + decl.value)
156
-
157
- let valArr = decl.value.split(' '); //console.log(valArr)
147
+ } = settings;
148
+ //console.log(decl.prop + " " + decl.value)
149
+ let valArr = decl.value.split(' ');
150
+ //console.log(valArr)
158
151
  //console.log(allowed, replacements, available)
159
-
160
152
  let hasError = false;
161
153
  let newVal = '';
162
154
  valArr.forEach(val => {
163
155
  let unit = val.replace(parseInt(val), '');
164
156
  let numVal = parseInt(val);
165
-
166
157
  if (unit != 0) {
167
158
  if (allowed.includes(unit)) {
168
159
  if (available.includes(numVal)) {
@@ -203,29 +194,31 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
203
194
  }
204
195
  }
205
196
  });
206
-
207
197
  if (!hasError) {
208
198
  decl.value = newVal;
209
199
  }
210
200
  }
211
201
  }
212
202
  });
213
- }); //fs.writeFile('./src/trial.json', JSON.stringify(variables) ,(err) =>{
203
+ });
204
+ //fs.writeFile('./src/trial.json', JSON.stringify(variables) ,(err) =>{
214
205
  // if(err)console.log(err);
215
206
  // else{
216
207
  // console.log('updated successfully');
217
208
  // }
218
209
  // })
219
210
  // console.log(errors)
220
-
221
211
  let errorArr = [];
222
212
  errors.forEach(errStr => {
223
213
  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) =>{
214
+ });
215
+
216
+ //fs.writeFile('./css_error.log','', (err) =>{
225
217
  // if(err){
226
218
  // console.log(err);
227
219
  // }
228
220
  //});
221
+
229
222
  // errorArr.forEach(err => {
230
223
  // let data = `\n{\n${err}\n},\n`;
231
224
  // //fs.appendFile('./css_error.log',data,(err)=>{
@@ -235,6 +228,7 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
235
228
  // //})
236
229
  // });
237
230
  // fs.writeFileSync('./css_error.log','');
231
+
238
232
  // errorArr.forEach(err => {
239
233
  // let data = `\n{\n${err}\n},\n`;
240
234
  // fs.appendFileSync('./css_error.log',data);
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _os = require("os");
9
-
10
8
  var _getIp = _interopRequireDefault(require("../utils/getIp"));
11
-
12
9
  var _getCurrentBranch = _interopRequireDefault(require("../utils/getCurrentBranch"));
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
11
+ // TODO move deprecated options to separate file and manage seperately
16
12
  var _default = {
17
13
  cliRootPath: null,
18
14
  unstableDepsInverse: {
@@ -159,6 +155,10 @@ var _default = {
159
155
  cli: 'mock_port'
160
156
  }
161
157
  },
158
+ mediaQueryHoverActiveString: {
159
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
160
+ none: '(hover: none)'
161
+ },
162
162
  disableES5Transpile: false,
163
163
  isReactMig: false,
164
164
  hasWidget: false,
@@ -193,6 +193,9 @@ var _default = {
193
193
  cli: 'attr_name'
194
194
  },
195
195
  publicPaths: false,
196
+ // TODO: Deprecated
197
+ hasRTL: false,
198
+ rtlExclude: [],
196
199
  instrumentScript: {
197
200
  value: false,
198
201
  cli: 'instru_script'
@@ -208,13 +211,16 @@ var _default = {
208
211
  plugins: {
209
212
  hasRTL: false,
210
213
  hoverActive: false,
211
- combinerMediaQuery: false
214
+ combinerMediaQuery: false,
215
+ cssVariableReplacement: false
212
216
  },
213
217
  exclude: {
214
218
  rtl: [],
215
219
  hoverActive: [],
216
- combinerMediaQuery: []
220
+ combinerMediaQuery: [],
221
+ cssVariableReplacement: []
217
222
  },
223
+ cssVariableReplacementConfig: '',
218
224
  seperateCssModules: {
219
225
  value: false,
220
226
  cli: 'sep_cssmodules'
@@ -242,6 +248,7 @@ var _default = {
242
248
  replaceText: '//<!--AssetsFromBuild -->'
243
249
  },
244
250
  htmlTemplate: {
251
+ minify: null,
245
252
  inject: true
246
253
  },
247
254
  removePropTypes: false,
@@ -276,6 +283,10 @@ var _default = {
276
283
  },
277
284
  branch: false
278
285
  },
286
+ mediaQueryHoverActiveString: {
287
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
288
+ none: '(hover: none)'
289
+ },
279
290
  componentFolder: 'src',
280
291
  cssUniqueness: {
281
292
  value: true,
@@ -284,16 +295,22 @@ var _default = {
284
295
  enableChunkHash: false,
285
296
  folder: 'src',
286
297
  disableES5Transpile: false,
298
+ // TODO: Deprecated
299
+ hasRTL: false,
300
+ rtlExclude: [],
287
301
  plugins: {
288
302
  hasRTL: false,
289
303
  hoverActive: false,
290
- combinerMediaQuery: false
304
+ combinerMediaQuery: false,
305
+ cssVariableReplacement: false
291
306
  },
292
307
  exclude: {
293
308
  rtl: [],
294
309
  hoverActive: [],
295
- combinerMediaQuery: []
310
+ combinerMediaQuery: [],
311
+ cssVariableReplacement: []
296
312
  },
313
+ cssVariableReplacementConfig: '',
297
314
  cssHashSelectors: {
298
315
  filenames: [],
299
316
  packages: []
@@ -304,6 +321,7 @@ var _default = {
304
321
  }
305
322
  },
306
323
  test: {
324
+ classnameFormat: '[classname]',
307
325
  srcBranch: {
308
326
  value: 'master',
309
327
  cli: 'src_branch'
@@ -321,7 +339,6 @@ var _default = {
321
339
  cli: 'branch_name'
322
340
  },
323
341
  impactServerDomain: {
324
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
325
342
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
326
343
  cli: 'impact_server_domain'
327
344
  },
@@ -344,7 +361,6 @@ var _default = {
344
361
  cli: 'service_name'
345
362
  },
346
363
  impactServerDomain: {
347
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
348
364
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
349
365
  cli: 'impact_server_domain'
350
366
  },
@@ -382,7 +398,7 @@ var _default = {
382
398
  cli: 'path_to_sub_projs'
383
399
  },
384
400
  tokenGit: {
385
- value: 'YbByNJ3yURAm92Lhx4vW',
401
+ value: '',
386
402
  cli: 'git_token'
387
403
  },
388
404
  changesOnly: {
@@ -563,7 +579,6 @@ var _default = {
563
579
  },
564
580
  impactServerDomain: {
565
581
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
566
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
567
582
  cli: 'impact_server_domain'
568
583
  },
569
584
  impactRun: {
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _fs = _interopRequireDefault(require("fs"));
6
-
7
5
  var _express = _interopRequireDefault(require("express"));
8
-
9
6
  var _utils = require("../utils");
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
8
  let options = (0, _utils.getOptions)();
14
9
  let {
15
10
  cluster: {
@@ -18,17 +13,13 @@ let {
18
13
  } = options;
19
14
  let app = (0, _express.default)();
20
15
  let appPath = process.cwd();
21
-
22
16
  let clusterConfigPath = _path.default.join(appPath, 'clusterConfig.js');
23
-
24
17
  let config;
25
-
26
18
  if (_fs.default.existsSync(clusterConfigPath)) {
27
19
  config = require(clusterConfigPath);
28
20
  } else {
29
21
  throw new Error(`clusterConfig.js doen't exist under following path - ${clusterConfigPath}`);
30
22
  }
31
-
32
23
  app.get('/clusterhub/nodes', (req, res) => {
33
24
  res.send(JSON.stringify(config.cluster));
34
25
  });
@@ -37,6 +28,5 @@ app.listen(server.port, err => {
37
28
  if (err) {
38
29
  throw err;
39
30
  }
40
-
41
31
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'ht' + 'tp')}/clusterhub/`);
42
32
  });
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getPaths = getPaths;
7
-
8
7
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
-
12
9
  var _child_process = require("child_process");
13
-
14
10
  var _utils = require("../utils");
15
-
16
11
  var _getCliPath = require("./getCliPath");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
13
+ const options = (0, _utils.getOptions)();
14
+ // const args = process.argv.slice(3);
21
15
  // NOTE: need to discuss about in below codes,
22
16
  // when we run webpack the usable options that comes for npm run not working as automatical
23
17
  // we are use this option always --disable_watch=true reason for now no need for
@@ -31,68 +25,63 @@ const {
31
25
  cssSelectorZipPath
32
26
  } = options.impactService;
33
27
  const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
34
-
35
28
  const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
36
-
37
29
  function execSyncDefalut(command) {
38
30
  console.log(' command running ==>', command);
39
31
  return (0, _child_process.execSync)(command, {
40
32
  stdio: 'inherit'
41
33
  });
42
34
  }
43
-
44
35
  const isQuiet = 'q';
45
- const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
36
+ const webpack = (0, _getCliPath.getCliPath)('webpack');
37
+ // console.log('webpack === > ', webpack, fs.existsSync(webpack));
46
38
 
47
39
  if (_fs.default.existsSync(outputFolderLocation)) {
48
40
  execSyncDefalut(`rm -rf ${outputFolder}`);
49
41
  console.log(`previous ${outputFolder} removed`);
50
42
  }
51
-
52
43
  if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
53
44
  execSyncDefalut('rm build.zip');
54
45
  console.log('previous build.zip removed');
55
- } // execSyncDefalut(`${webpack } --version`);
46
+ }
47
+ // execSyncDefalut(`${webpack } --version`);
56
48
  // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
57
49
 
58
-
59
50
  console.log('webpack compilation starts...');
60
- const startTime = Date.now(); // const result = spawnSync(
51
+ const startTime = Date.now();
52
+ // const result = spawnSync(
61
53
  // webpack,
62
54
  // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
63
55
  // args
64
56
  // ),
65
57
  // { stdio: 'inherit' }
66
58
  // );
67
- // --disable_watch=true
68
59
 
60
+ // --disable_watch=true
69
61
  const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
70
62
  result && console.log(result);
71
-
72
63
  if (result && result.stderr) {
73
64
  throw result.stderr;
74
65
  }
75
-
76
66
  console.log(`compailation done in ${Date.now() - startTime}ms`);
77
-
78
67
  if (zipname) {
79
68
  execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
80
69
  console.log('build.zip file created');
81
70
  const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
82
71
  execSyncDefalut(`rm -rf ${zipname}`);
83
-
84
72
  if (result && result.stderr) {
85
73
  console.log('zip file not created', cssSelectorZipPath);
86
74
  console.error(result.stderr);
87
75
  } else {
88
76
  console.log('zip file created', cssSelectorZipPath);
89
77
  }
90
- } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
91
- // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
78
+ }
92
79
 
80
+ // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
93
81
 
94
- console.log(`compailation done in ${Date.now() - startTime}ms`);
82
+ // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
95
83
 
84
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
96
85
  function getPaths() {
97
86
  return {
98
87
  zipname,
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
4
-
5
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
7
5
  (0, _docsServerCore.default)();