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

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 (128) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +27 -951
  7. package/bin/cli.js +483 -483
  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/configs/jest.config.js +8 -12
  19. package/lib/configs/libAlias.js +10 -3
  20. package/lib/configs/resolvers.js +38 -0
  21. package/lib/configs/webpack.css.umd.config.js +4 -4
  22. package/lib/configs/webpack.dev.config.js +17 -22
  23. package/lib/configs/webpack.docs.config.js +10 -15
  24. package/lib/configs/webpack.impact.config.js +11 -11
  25. package/lib/configs/webpack.prod.config.js +22 -24
  26. package/lib/constants.js +31 -0
  27. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  28. package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
  29. package/lib/loaderUtils/getCSSLoaders.js +42 -22
  30. package/lib/loaders/workerLoader.js +9 -9
  31. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  32. package/lib/pluginUtils/getDevPlugins.js +19 -39
  33. package/lib/pluginUtils/getProdPlugins.js +29 -47
  34. package/lib/plugins/EFCPlugin.md +6 -6
  35. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  36. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  37. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  38. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  39. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  40. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  41. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  42. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  43. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -24
  44. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  45. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  46. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  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 +54 -30
  51. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
  52. package/lib/postcss-plugins/variableModificationPlugin/index.js +248 -0
  53. package/lib/postcss-plugins/variableModifier.js +1 -0
  54. package/lib/schemas/index.js +36 -8
  55. package/lib/servers/docsServerCore.js +13 -12
  56. package/lib/servers/getCliPath.js +1 -1
  57. package/lib/servers/httpsOptions.js +40 -9
  58. package/lib/servers/nowatchserver.js +12 -11
  59. package/lib/servers/server.js +14 -13
  60. package/lib/sh/pre-commit.sh +34 -34
  61. package/lib/sh/reportPublish.sh +45 -45
  62. package/lib/utils/buildstats.html +148 -148
  63. package/lib/utils/getOptions.js +42 -14
  64. package/lib/utils/resultSchema.json +73 -73
  65. package/npm8.md +9 -9
  66. package/package.json +119 -148
  67. package/postpublish.js +8 -6
  68. package/templates/app/.eslintrc.js +140 -140
  69. package/templates/app/README.md +12 -12
  70. package/templates/app/app/index.html +24 -24
  71. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  72. package/templates/app/app/properties/i18nkeys.json +3 -3
  73. package/templates/app/docs/all.html +69 -69
  74. package/templates/app/mockapi/index.js +18 -18
  75. package/templates/app/package.json +37 -37
  76. package/templates/app/src/actions/SampleActions/index.js +37 -37
  77. package/templates/app/src/actions/index.js +65 -65
  78. package/templates/app/src/appUrls.js +19 -19
  79. package/templates/app/src/components/Alert/Alert.js +134 -134
  80. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  81. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  82. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  83. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  84. package/templates/app/src/components/Sample/SampleList.js +61 -61
  85. package/templates/app/src/components/Slider/Slider.css +41 -41
  86. package/templates/app/src/components/Slider/Slider.js +55 -55
  87. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  88. package/templates/app/src/containers/AppContainer/index.js +96 -96
  89. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  90. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  91. package/templates/app/src/containers/DevTools/index.js +10 -10
  92. package/templates/app/src/containers/Header/index.js +67 -67
  93. package/templates/app/src/containers/Header/index.module.css +43 -43
  94. package/templates/app/src/containers/Redirect/index.js +63 -63
  95. package/templates/app/src/containers/Redirector/index.js +47 -47
  96. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  97. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  98. package/templates/app/src/historyChange.js +5 -5
  99. package/templates/app/src/index.html +10 -10
  100. package/templates/app/src/index.js +24 -24
  101. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  102. package/templates/app/src/reducers/alertData.js +11 -11
  103. package/templates/app/src/reducers/index.js +6 -6
  104. package/templates/app/src/reducers/samples.js +19 -19
  105. package/templates/app/src/store/configureStore.dev.js +51 -51
  106. package/templates/app/src/store/configureStore.js +5 -5
  107. package/templates/app/src/store/configureStore.prod.js +26 -26
  108. package/templates/app/src/util/Common.js +5 -5
  109. package/templates/app/src/util/RequestAPI.js +132 -132
  110. package/templates/docs/all.html +249 -249
  111. package/templates/docs/component.html +178 -178
  112. package/templates/docs/components.html +221 -221
  113. package/templates/docs/css/b.min.css +6 -6
  114. package/templates/docs/css/component.css +42 -42
  115. package/templates/docs/css/componentTest.css +6 -6
  116. package/templates/docs/css/hopscotch.css +585 -585
  117. package/templates/docs/css/style.css +1022 -1022
  118. package/templates/docs/impactReportTemplate.html +154 -154
  119. package/templates/docs/index.html +1501 -1493
  120. package/templates/docs/js/active-line.js +72 -72
  121. package/templates/docs/js/b.min.js +7 -7
  122. package/templates/docs/js/codemirror.js +9680 -9680
  123. package/templates/docs/js/designTokens.js +334 -334
  124. package/templates/docs/js/j.min.js +4 -4
  125. package/templates/docs/js/javascript.js +874 -874
  126. package/templates/docs/js/matchbrackets.js +145 -145
  127. package/cert/Tsicsezwild-22-23.crt +0 -37
  128. package/cert/Tsicsezwild-22-23.key +0 -27
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+
3
+ const postcss = require('postcss');
4
+
5
+ const fs = require('fs');
6
+
7
+ const path = require('path');
8
+
9
+ const errors = [];
10
+ let allowedErrs = {};
11
+ const convertableProps = {
12
+ 'font-size': true,
13
+ margin: true,
14
+ 'margin-left': true,
15
+ 'margin-right': true,
16
+ 'margin-top': true,
17
+ 'margin-bottom': true,
18
+ padding: true,
19
+ 'padding-top': true,
20
+ 'padding-bottom': true,
21
+ 'padding-left': true,
22
+ 'padding-right': true,
23
+ width: true,
24
+ 'min-width': true,
25
+ 'max-width': true,
26
+ height: true,
27
+ 'min-height': true,
28
+ 'max-height': true,
29
+ top: true,
30
+ bottom: true,
31
+ left: true,
32
+ right: true
33
+ };
34
+ const constantValues = {
35
+ inherit: true,
36
+ initial: true,
37
+ auto: true,
38
+ 'fit-content': true,
39
+ unset: true
40
+ };
41
+
42
+ function getNumericValue(value) {
43
+ if (value.includes('var')) {
44
+ return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
45
+ } // Not need for this dum loop
46
+ // allowed.forEach(alwdUnit => {
47
+ // if (value.includes(alwdUnit)) {
48
+ // return parseInt(value);
49
+ // }
50
+ // });
51
+
52
+
53
+ if (constantValues[value.toLowerCase()]) {
54
+ return 1;
55
+ }
56
+
57
+ return parseInt(value);
58
+ }
59
+
60
+ function pxToCalc(value) {
61
+ const arr = value.split(' ');
62
+ arr.forEach((val, index) => {
63
+ ['px'].forEach(unit => {
64
+ const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
65
+
66
+ if (valWithUnit.test(val)) {
67
+ arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
68
+ }
69
+ });
70
+ });
71
+ return arr.join(' ');
72
+ }
73
+
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
+ const singleConvertor = (value, changeVal, details, range) => {
91
+ const {
92
+ path,
93
+ filename,
94
+ decl
95
+ } = details;
96
+
97
+ if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
98
+ let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
99
+
100
+ if (/^-var/.test(retVal)) {
101
+ retVal = `calc( ${retVal.substring(1)} * -1 )`;
102
+ }
103
+
104
+ return retVal;
105
+ } // if(unitErrorVal && unitErrorVal != '0' ){
106
+ // console.log(value, 'not within range')
107
+
108
+
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'); // }
110
+ // 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;
113
+ };
114
+
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
+ fs.writeFileSync('./css_error.log', '');
126
+ allowedErrs = errorsAllowed;
127
+ const replacementArray = [];
128
+ Object.keys(settingsObject).forEach(key => {
129
+ Object.values(settingsObject[key].replacements).forEach(val => {
130
+ if (!replacementArray.includes(val)) {
131
+ replacementArray.push(val);
132
+ }
133
+ });
134
+ });
135
+ let regValStr = '';
136
+ replacementArray.forEach((val, index) => {
137
+ if (index !== replacementArray.length - 1) {
138
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
139
+ } else {
140
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
141
+ }
142
+ });
143
+ const valRegex = new RegExp(regValStr, 'gi');
144
+ return rootOriginal => {
145
+ rootOriginal.walkRules(rule => {
146
+ // rule.nodes[-1] = {}
147
+ // need map, forEach fine less memory
148
+ rule.nodes.forEach((decl, position) => {
149
+ // case font-size
150
+ const commentStr = 'variable:ignore';
151
+ const prevNode = rule.nodes[position - 1];
152
+ const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
153
+ // split not need use slice and lastIndexOf less memory
154
+
155
+ const filename = fromPath.split(path.sep).pop();
156
+
157
+ if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
158
+ 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`;
159
+ errorFunction(errStr, 'DECLARATION_IGNORED');
160
+ return;
161
+ }
162
+
163
+ if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
164
+ const settings = settingsObject[decl.prop]; // console.log(settings)
165
+
166
+ const {
167
+ allowed,
168
+ range
169
+ } = settings; // suggestion filter !decl.value.includes('calc')
170
+ // Reason below some of logic happen based on this
171
+
172
+ const unit = decl.value.toString() // no need round braket since you do not need group for less memory
173
+ .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
174
+ // console.log('unit : ');
175
+ // console.log(unit);
176
+
177
+ unit.forEach((val, index) => {
178
+ allowed.forEach(alwdVal => {
179
+ if (val.includes(alwdVal)) {
180
+ // ## for what purpose
181
+ unit[index] = val.replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`);
182
+ }
183
+ });
184
+ });
185
+ let unitError = false;
186
+ let unitErrorVal = '';
187
+ unit.forEach(val => {
188
+ if (!val.includes('calc')) {
189
+ if (!allowed.includes(val.toString())) {
190
+ unitError = true;
191
+ unitErrorVal = val;
192
+ }
193
+ }
194
+ }); // console.log(allowed, replacements, range)
195
+
196
+ if (!unitError) {
197
+ // use variable decl.value.split(' ')
198
+ if (range) {
199
+ // console.log('multiple :', decl.value)
200
+ let newVal = '';
201
+ decl.value.split(' ').forEach(singleVal => {
202
+ newVal += `${singleConvertor(singleVal, settings.replacements.px, {
203
+ decl,
204
+ filename,
205
+ path: fromPath
206
+ }, range)} `;
207
+ });
208
+ decl.value = newVal;
209
+ }
210
+ } else {
211
+ if (!decl.value.includes('calc')) {
212
+ // 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`);
213
+ 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');
214
+ } else {
215
+ decl.value = pxToCalc(decl.value);
216
+ }
217
+ }
218
+ } else {
219
+ 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')) {
220
+ 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');
221
+ }
222
+ }
223
+ });
224
+ }); // console.log(filename)
225
+ // console.log('Done!')
226
+ // console.log('----------------------------------------------------------------------------------------------------------------------')
227
+
228
+ if (errorLogStatus) {
229
+ fs.writeFileSync('./css_error.log', '');
230
+
231
+ if (errors.length > 0) {
232
+ errors.forEach(err => {
233
+ fs.appendFileSync('./css_error.log', err);
234
+ }); // console.log('----------------------------------------------------------------------------------------------------------------------')
235
+ }
236
+ }
237
+
238
+ if (errorConsoleStatus) {
239
+ if (errors.length > 0) {
240
+ errors.forEach(err => {
241
+ // fs.appendFileSync('./css_error.log', err);
242
+ console.log(err);
243
+ });
244
+ console.log('----------------------------------------------------------------------------------------------------------------------');
245
+ }
246
+ }
247
+ };
248
+ });
@@ -101,6 +101,7 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
101
101
  rule.walkDecls((decl, position) => {
102
102
  // case font-size
103
103
  if (!hasIgnoreComment(rule.nodes[position - 1])) {
104
+ console.log(settings);
104
105
  let unit = decl.value.replace(/[0-9]/g, '');
105
106
  let settings = numberObject[decl.prop];
106
107
  let path = rootOriginal.source.input.from;
@@ -13,6 +13,7 @@ var _getCurrentBranch = _interopRequireDefault(require("../utils/getCurrentBranc
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
+ // TODO move deprecated options to separate file and manage seperately
16
17
  var _default = {
17
18
  cliRootPath: null,
18
19
  unstableDepsInverse: {
@@ -90,6 +91,10 @@ var _default = {
90
91
  cssDirStatement: null
91
92
  },
92
93
  app: {
94
+ moduleResolvePath: {
95
+ value: '',
96
+ cli: 'module_resolve_path'
97
+ },
93
98
  // this option only for impact testing
94
99
  devCssFileBountry: {
95
100
  value: '',
@@ -136,6 +141,10 @@ var _default = {
136
141
  value: 'dev',
137
142
  cli: 'app_mode'
138
143
  },
144
+ httpsCerts: {
145
+ value: '',
146
+ cli: 'https_certs'
147
+ },
139
148
  branch: {
140
149
  value: 'master',
141
150
  cli: 'app_branch'
@@ -159,6 +168,10 @@ var _default = {
159
168
  cli: 'mock_port'
160
169
  }
161
170
  },
171
+ mediaQueryHoverActiveString: {
172
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
173
+ none: '(hover: none)'
174
+ },
162
175
  disableES5Transpile: false,
163
176
  isReactMig: false,
164
177
  hasWidget: false,
@@ -193,6 +206,9 @@ var _default = {
193
206
  cli: 'attr_name'
194
207
  },
195
208
  publicPaths: false,
209
+ // TODO: Deprecated
210
+ hasRTL: false,
211
+ rtlExclude: [],
196
212
  instrumentScript: {
197
213
  value: false,
198
214
  cli: 'instru_script'
@@ -208,13 +224,16 @@ var _default = {
208
224
  plugins: {
209
225
  hasRTL: false,
210
226
  hoverActive: false,
211
- combinerMediaQuery: false
227
+ combinerMediaQuery: false,
228
+ cssVariableReplacement: false
212
229
  },
213
230
  exclude: {
214
231
  rtl: [],
215
232
  hoverActive: [],
216
- combinerMediaQuery: []
233
+ combinerMediaQuery: [],
234
+ cssVariableReplacement: []
217
235
  },
236
+ cssVariableReplacementConfig: '',
218
237
  seperateCssModules: {
219
238
  value: false,
220
239
  cli: 'sep_cssmodules'
@@ -242,6 +261,7 @@ var _default = {
242
261
  replaceText: '//<!--AssetsFromBuild -->'
243
262
  },
244
263
  htmlTemplate: {
264
+ minify: null,
245
265
  inject: true
246
266
  },
247
267
  removePropTypes: false,
@@ -276,6 +296,10 @@ var _default = {
276
296
  },
277
297
  branch: false
278
298
  },
299
+ mediaQueryHoverActiveString: {
300
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
301
+ none: '(hover: none)'
302
+ },
279
303
  componentFolder: 'src',
280
304
  cssUniqueness: {
281
305
  value: true,
@@ -284,16 +308,22 @@ var _default = {
284
308
  enableChunkHash: false,
285
309
  folder: 'src',
286
310
  disableES5Transpile: false,
311
+ // TODO: Deprecated
312
+ hasRTL: false,
313
+ rtlExclude: [],
287
314
  plugins: {
288
315
  hasRTL: false,
289
316
  hoverActive: false,
290
- combinerMediaQuery: false
317
+ combinerMediaQuery: false,
318
+ cssVariableReplacement: false
291
319
  },
292
320
  exclude: {
293
321
  rtl: [],
294
322
  hoverActive: [],
295
- combinerMediaQuery: []
323
+ combinerMediaQuery: [],
324
+ cssVariableReplacement: []
296
325
  },
326
+ cssVariableReplacementConfig: '',
297
327
  cssHashSelectors: {
298
328
  filenames: [],
299
329
  packages: []
@@ -304,6 +334,7 @@ var _default = {
304
334
  }
305
335
  },
306
336
  test: {
337
+ classnameFormat: '[classname]',
307
338
  srcBranch: {
308
339
  value: 'master',
309
340
  cli: 'src_branch'
@@ -321,7 +352,6 @@ var _default = {
321
352
  cli: 'branch_name'
322
353
  },
323
354
  impactServerDomain: {
324
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
325
355
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
326
356
  cli: 'impact_server_domain'
327
357
  },
@@ -344,7 +374,6 @@ var _default = {
344
374
  cli: 'service_name'
345
375
  },
346
376
  impactServerDomain: {
347
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
348
377
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
349
378
  cli: 'impact_server_domain'
350
379
  },
@@ -382,7 +411,7 @@ var _default = {
382
411
  cli: 'path_to_sub_projs'
383
412
  },
384
413
  tokenGit: {
385
- value: 'YbByNJ3yURAm92Lhx4vW',
414
+ value: '',
386
415
  cli: 'git_token'
387
416
  },
388
417
  changesOnly: {
@@ -563,7 +592,6 @@ var _default = {
563
592
  },
564
593
  impactServerDomain: {
565
594
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
566
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
567
595
  cli: 'impact_server_domain'
568
596
  },
569
597
  impactRun: {
@@ -29,28 +29,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
29
29
 
30
30
  // import fs from 'fs';
31
31
  var _default = isSSTest => {
32
- let options = (0, _utils.getOptions)();
33
- let {
32
+ const options = (0, _utils.getOptions)();
33
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
34
+ const {
34
35
  docs: {
35
36
  server
36
37
  }
37
38
  } = options;
38
- let {
39
+ const {
39
40
  port,
40
41
  branch,
41
42
  host,
42
43
  domain,
43
44
  iphost
44
45
  } = server;
45
- let appPath = process.cwd();
46
+ const appPath = process.cwd();
46
47
  const app = (0, _express.default)();
47
48
  app.use(_express.default.json());
48
49
  app.use(_express.default.urlencoded({
49
50
  extended: true
50
51
  }));
51
- let docsConfig = (0, _webpackDocs.default)(isSSTest);
52
- let compiler = (0, _webpack.default)(docsConfig);
53
- let wdm = (0, _webpackDevMiddleware.default)(compiler, {
52
+ const docsConfig = (0, _webpackDocs.default)(isSSTest);
53
+ const compiler = (0, _webpack.default)(docsConfig);
54
+ const wdm = (0, _webpackDevMiddleware.default)(compiler, {
54
55
  logLevel: 'error',
55
56
  publicPath: docsConfig.output.publicPath,
56
57
  headers: {
@@ -67,7 +68,7 @@ var _default = isSSTest => {
67
68
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
68
69
  });
69
70
  app.use('/author/get', (req, res) => {
70
- let {
71
+ const {
71
72
  query: {
72
73
  componentName = ''
73
74
  }
@@ -84,7 +85,7 @@ var _default = isSSTest => {
84
85
 
85
86
  if (branch) {
86
87
  app.post('/repo/merge', (req, res) => {
87
- let {
88
+ const {
88
89
  ref
89
90
  } = req.body;
90
91
 
@@ -98,7 +99,7 @@ var _default = isSSTest => {
98
99
  });
99
100
  }
100
101
 
101
- const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
102
+ const httpsServer = _https.default.createServer(httpsOptions, app);
102
103
 
103
104
  if (!isSSTest) {
104
105
  httpsServer.listen(port, err => {
@@ -110,8 +111,8 @@ var _default = isSSTest => {
110
111
  });
111
112
  }
112
113
 
113
- let httpPort = Number(port) + 1;
114
- let http = app.listen(httpPort, err => {
114
+ const httpPort = Number(port) + 1;
115
+ const http = app.listen(httpPort, err => {
115
116
  if (err) {
116
117
  throw err;
117
118
  }
@@ -24,5 +24,5 @@ const suffixExt = isWindows ? '.cmd' : '';
24
24
  function getCliPath(libName) {
25
25
  const cliPath = _getCliPath(libName + suffixExt);
26
26
 
27
- return (0, _fs.existsSync)(cliPath) ? cliPath : libName;
27
+ return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
28
28
  }
@@ -3,16 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.httpsOptions = void 0;
6
+ exports.httpsOptions = httpsOptions;
7
+ exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
7
8
 
8
- var _fs = _interopRequireDefault(require("fs"));
9
+ // import fs from 'fs';
10
+ // import path from 'path';
11
+ // export const httpsOptions = {
12
+ // key: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.key')),
13
+ // cert: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.crt'))
14
+ // };
15
+ function httpsOptions(options) {
16
+ const {
17
+ httpsCerts
18
+ } = options.app.server;
9
19
 
10
- var _path = _interopRequireDefault(require("path"));
20
+ const certificate = require(require.resolve(httpsCerts, {
21
+ paths: [process.cwd()]
22
+ })); // TODO: in future we may do some version based check. certificate.version
11
23
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
24
 
14
- const httpsOptions = {
15
- key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
16
- cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
17
- };
18
- exports.httpsOptions = httpsOptions;
25
+ return certificate.httpsOptions;
26
+ }
27
+
28
+ function httpsOptionsWithUserFriendlyError(options) {
29
+ const {
30
+ httpsCerts
31
+ } = options.app.server;
32
+
33
+ if (typeof httpsCerts === 'string') {
34
+ try {
35
+ const certificate = httpsOptions(options);
36
+ return certificate;
37
+ } catch (error) {
38
+ if (error.message.indexOf('Cannot find module') !== -1) {
39
+ console.error(`You have given react-cli.app.server.httpsCerts as "${httpsCerts}". \n But it seems that file path have some problem.\n we are unable to locate "${httpsCerts}" in "${process.cwd()}"`);
40
+ } else {
41
+ console.error(error);
42
+ }
43
+
44
+ process.exit(0);
45
+ }
46
+ } else {
47
+ return null;
48
+ }
49
+ }
@@ -19,15 +19,16 @@ var _devBuild = require("./devBuild");
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
21
  // import webpack from 'webpack';
22
- let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
22
+ const options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
23
23
 
24
- let {
24
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
25
+ const {
25
26
  app: {
26
27
  context,
27
28
  server
28
29
  }
29
30
  } = options;
30
- let {
31
+ const {
31
32
  host,
32
33
  port,
33
34
  domain,
@@ -35,9 +36,9 @@ let {
35
36
  hasMock,
36
37
  mockPort
37
38
  } = server;
38
- let isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
39
- let contextURL = disableContextURL ? '' : `/${context}`;
40
- let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
39
+ const isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
40
+ const contextURL = disableContextURL ? '' : `/${context}`;
41
+ const serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
41
42
  const {
42
43
  zipname,
43
44
  cssSelectorZipPath,
@@ -83,7 +84,7 @@ app.use('/wms/*', (req, res) => {
83
84
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
84
85
  });
85
86
 
86
- const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
87
+ const httpsServer = _https.default.createServer(httpsOptions, app);
87
88
 
88
89
  const wss = new _ws.default.Server({
89
90
  server: httpsServer
@@ -101,7 +102,7 @@ wss.on('connection', ws => {
101
102
  });
102
103
  app.post('/wmsmockapi', (req, res) => {
103
104
  wsPool.forEach(ws => {
104
- let {
105
+ const {
105
106
  body
106
107
  } = req;
107
108
 
@@ -161,7 +162,7 @@ httpsServer.listen(port, err => {
161
162
  if (isCompatableHttp2) {
162
163
  const http2 = require('http2');
163
164
 
164
- const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
165
+ const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
165
166
 
166
167
  http2Server.on('stream', (stream, headers) => {
167
168
  stream.respond({
@@ -170,7 +171,7 @@ if (isCompatableHttp2) {
170
171
  });
171
172
  stream.end('<h1>Hello World! <br>Working with http2</h1>');
172
173
  });
173
- let http2Port = Number(port) + 1;
174
+ const http2Port = Number(port) + 1;
174
175
  http2Server.listen(http2Port, err => {
175
176
  if (err) {
176
177
  throw err;
@@ -186,7 +187,7 @@ if (isCompatableHttp2) {
186
187
  (0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
187
188
  }
188
189
 
189
- let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
190
+ const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
190
191
  app.listen(httpPort, err => {
191
192
  if (err) {
192
193
  throw err;