@zohodesk/react-cli 0.0.1-exp.176.4 → 0.0.1-exp.178.2

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.
@@ -7,14 +7,24 @@ exports.default = void 0;
7
7
 
8
8
  var _postcss = _interopRequireDefault(require("postcss"));
9
9
 
10
- var _fs = _interopRequireDefault(require("fs"));
11
-
12
10
  var _ErrorHandler = require("../postcss-plugins/variableModificationPlugin/ErrorHandler");
13
11
 
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
13
 
16
14
  // import { RawSource } from 'webpack-sources';
17
- const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_']; // -- is issue IO --
15
+ const fs = require('fs');
16
+
17
+ const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
18
+ let variablesRead = {};
19
+
20
+ const {
21
+ errors,
22
+ errTable,
23
+ errHandler
24
+ } = require('../postcss-plugins/variableModificationPlugin/index');
25
+
26
+ const supportedProps = ['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', '^top', '^right', '^bottom', '^left', '^width', 'min-width', 'max-width', '^height', 'min-height', 'max-height', 'text-indent', 'clip', 'flex-basis', 'row-gap', 'gap', 'column-gap', 'flex']; // const avoidProps = [];
27
+ // -- is issue IO --
18
28
 
19
29
  /*
20
30
  issues eg :
@@ -35,7 +45,7 @@ function isIgnoreValuePresent(ignoreVals, prop) {
35
45
  }
36
46
  });
37
47
  return present;
38
- } // -- to convert the hyphen values to values --
48
+ } // -- to convert the hyphen values to values --
39
49
 
40
50
  /*
41
51
  input :
@@ -55,8 +65,8 @@ function extractVariableName(val) {
55
65
  function rootConvertor(rootOriginal, variables, settingsObject) {
56
66
  rootOriginal.walkRules(rule => {
57
67
  rule.nodes.forEach((decl, index) => {
58
- let prevNode = rule.nodes[index - 1];
59
- let currentNode = rule.nodes[index];
68
+ const prevNode = rule.nodes[index - 1];
69
+ const currentNode = rule.nodes[index];
60
70
 
61
71
  if (decl.prop && decl.prop.includes('--')) {
62
72
  if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase() === 'variable:ignore') {
@@ -69,16 +79,16 @@ function rootConvertor(rootOriginal, variables, settingsObject) {
69
79
 
70
80
  if (settingsObject[variables[decl.prop]]) {
71
81
  /* if there is no value for property, set it to default so that undefined doesn't get called as key */
72
- if (!variables[decl.prop] || !settingsObject[variables[decl.prop]]) {
82
+ if (!variables[decl.prop]) {
73
83
  variables[decl.prop] = 'default';
74
84
  }
75
85
 
76
86
  const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
77
- let valArr = decl.value.split(' '); // single values are considered in the above array and converted below
87
+ const valArr = decl.value.split(' '); // single values are considered in the above array and converted below
78
88
 
79
89
  valArr.forEach((value, index) => {
80
90
  if (value.includes('px')) {
81
- let num = value.replace('px', '');
91
+ const num = value.replace('px', '');
82
92
  valArr[index] = pxReplacement.replace('$$', num);
83
93
  }
84
94
  });
@@ -90,22 +100,46 @@ function rootConvertor(rootOriginal, variables, settingsObject) {
90
100
  return rootOriginal;
91
101
  }
92
102
 
103
+ function createFolderIfNonExistant(path) {
104
+ if (!fs.existsSync(path)) {
105
+ fs.mkdirSync(path, {
106
+ recursive: true
107
+ });
108
+ }
109
+ }
110
+
111
+ function createFileIfNonExistant(path, content) {
112
+ if (fs.existsSync(path)) {
113
+ fs.writeFileSync(path, content, 'utf-8');
114
+ }
115
+ }
116
+
93
117
  class VariableConversionCollector {
94
118
  constructor(options = {}) {
95
119
  this.optimize = options.optimize;
96
120
  this.filename = options.cssVariableReplacementConfig;
121
+ this.fileHandler();
97
122
  }
98
123
 
99
- apply(compiler) {
100
- let variables = {};
101
-
102
- const rawdata = _fs.default.readFileSync(this.filename);
124
+ fileHandler() {
125
+ createFolderIfNonExistant('./.cli/logs/');
126
+ createFolderIfNonExistant('./.cli/config/variables/');
127
+ createFolderIfNonExistant('./.cli/config/selectorWeight/');
128
+ createFileIfNonExistant('./.cli/logs/unassignedVariables.log', '{}');
129
+ createFileIfNonExistant('./.cli/logs/css_error.log', '{}');
130
+ }
103
131
 
132
+ apply(compiler) {
133
+ const variables = {};
134
+ const unassigned = {};
135
+ const rawdata = fs.readFileSync(this.filename);
104
136
  const data = JSON.parse(rawdata);
105
137
  const {
106
138
  settings: settingsObject,
107
139
  errorLog: errorLogStatus,
108
- errorInConsole: errorConsoleStatus
140
+ errorInConsole: errorConsoleStatus,
141
+ errorsAllowed,
142
+ strictMode
109
143
  } = data; // If theres is no setting for default prop in settingsObject, set one.
110
144
 
111
145
  if (!settingsObject.default) {
@@ -130,6 +164,13 @@ class VariableConversionCollector {
130
164
  */
131
165
 
132
166
 
167
+ if (fs.existsSync('./.cli/config/variables/variableMapping.json')) {
168
+ variablesRead = JSON.parse(fs.readFileSync('./.cli/config/variables/variableMapping.json', 'utf-8'));
169
+ Object.keys(variablesRead.changes).forEach(key => {
170
+ variables[key] = variablesRead.changes[key];
171
+ });
172
+ }
173
+
133
174
  compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
134
175
  compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
135
176
  const mods = modules.filter(x => x.type.includes('css'));
@@ -137,37 +178,67 @@ class VariableConversionCollector {
137
178
  const rootOriginal = _postcss.default.parse(module.content);
138
179
 
139
180
  const filename = module.issuer.resource;
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
- }
181
+
182
+ if (!filename.includes('node_modules')) {
183
+ rootOriginal.walkRules(rule => {
184
+ rule.walkDecls(decl => {
185
+ decl.value.split(' ').forEach(val => {
186
+ if (val && val.includes('--') && !new RegExp(ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
187
+ const extractedValue = extractVariableName(val);
188
+
189
+ if (!variables[extractedValue]) {
190
+ variables[extractedValue] = decl.prop;
191
+ } else {
192
+ if (new RegExp(supportedProps.join('|'), 'gi').test(decl.prop)) {
193
+ // console.log(
194
+ // `${extractedValue} : ${variables[extractedValue]} already exists please check!`
195
+ // );
196
+ if (errorsAllowed.MULTIPLE_OCCURANCES) {
197
+ const errObj = {
198
+ decl,
199
+ type: 'MULTIPLE_OCCURANCES',
200
+ filename,
201
+ message: `${extractedValue} : ${variables[extractedValue]} already exists please check!`
202
+ };
203
+ errHandler.errorTable.push(errObj);
204
+ errHandler.errorFunction(errObj);
205
+ }
206
+ }
207
+ }
208
+ } else {
209
+ // console.log(decl.prop);
210
+ if (/^--/gi.test(decl.prop) && val.trim() !== '' && !variables[decl.prop]) {
211
+ if (!Object.keys(variablesRead.ignore).includes(decl.prop)) {
212
+ unassigned[decl.prop] = variables[decl.prop];
213
+ }
214
+ }
215
+ }
216
+ });
146
217
  });
147
218
  });
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
- });
219
+ /*
220
+ current value example:
221
+ {
222
+ --zdt_uploadlist_default_width : --zd_upload_width,
223
+ --zd_upload_width : width
224
+ }
225
+ expected value :
226
+ {
227
+ --zdt_uploadlist_default_width : width,
228
+ --zd_upload_width : width
229
+ }
230
+
231
+ conversion is done in the while loop below
232
+ */
233
+
234
+ Object.keys(variables).forEach(key => {
235
+ while (variables[variables[key]]) {
236
+ variables[key] = variables[variables[key]];
237
+ }
238
+ });
239
+ }
169
240
  });
170
- }); // -- conversion for the root using rootConvertor --
241
+ }); // -- conversion for the root using rootConvertor --
171
242
 
172
243
  /*
173
244
  input :
@@ -200,30 +271,60 @@ class VariableConversionCollector {
200
271
  */
201
272
 
202
273
  compiler.hooks.afterEmit.tap('error-display', () => {
203
- const {
204
- errors,
205
- errTable
206
- } = require('../postcss-plugins/variableModificationPlugin/index');
274
+ if (Object.keys(unassigned).length > 0 && strictMode) {
275
+ console.log();
276
+ console.log(unassigned);
277
+ console.log();
278
+ let str = '{\n';
279
+ Object.keys(unassigned).forEach(key => {
280
+ str += `"${key}" : "${unassigned[key]}",\n`;
281
+ });
282
+ str += '}';
283
+ fs.writeFileSync('./.cli/logs/unassignedVariables.log', str, 'utf-8');
284
+ throw new Error('^^^ Variables above have not been assigned! ^^^');
285
+ }
207
286
 
208
- let avlTypes = new Set([]);
209
- let srtArr = errTable.sort((a, b) => {
287
+ const avlTypes = new Set([]);
288
+ const srtArr = errTable.sort((a, b) => {
210
289
  avlTypes.add(a.type);
211
290
  avlTypes.add(b.type);
212
291
 
213
292
  if (a.type < b.type) {
214
293
  return -1;
215
294
  }
216
- });
295
+ }); // variable constructed now to be written in a json file
296
+ // const newVars = Object.keys(variables)
297
+ // //Filter Object with key contanis "NAME"
298
+ // .filter(key => variables[key].includes('--'))
299
+ // .reduce(
300
+ // (obj, key) =>
301
+ // Object.assign(obj, {
302
+ // [key]: variables[key]
303
+ // }),
304
+ // {}
305
+ // );
306
+ // console.log('new variables: ', newVars);
307
+ // try {
308
+ // fs.writeFileSync('./variableMapping.json', JSON.stringify(variables));
309
+ // } catch (err) {
310
+ // console.log(err);
311
+ // }
312
+ // fs.writeFile('./variableMapping.json', JSON.stringify(variables), err => {
313
+ // if (err) {
314
+ // throw err;
315
+ // }
316
+ // console.log('variable mapping file generated.');
317
+ // });
217
318
 
218
319
  if (errorConsoleStatus) {
219
- const errHandler = new _ErrorHandler.ErrorHandler();
320
+ const errorHandler = new _ErrorHandler.ErrorHandler();
220
321
  avlTypes.forEach(type => {
221
322
  console.log('---------------------------------------------------------------------------------------------------------------------------');
222
323
  console.log(`Error Type : ${type}`);
223
324
  console.log('---------------------------------------------------------------------------------------------------------------------------');
224
325
  srtArr.forEach(err => {
225
326
  if (err.decl.prop && err.decl.value && err.type === type) {
226
- errHandler.printError(err);
327
+ errorHandler.printError(err);
227
328
  }
228
329
  });
229
330
  console.log('---------------------------------------------------------------------------------------------------------------------------');
@@ -231,14 +332,13 @@ class VariableConversionCollector {
231
332
  }
232
333
 
233
334
  if (errorLogStatus) {
234
- _fs.default.writeFileSync('./css_error.log', '');
235
-
335
+ fs.writeFileSync('./.cli/logs/css_error.log', '');
236
336
  console.log('writing to logFile...');
237
337
 
238
338
  if (errors.length > 0) {
239
339
  errors.forEach((err, index) => {
240
340
  if (errTable[index].decl.prop && errTable[index].decl.value) {
241
- _fs.default.appendFileSync('./css_error.log', err);
341
+ fs.appendFileSync('./.cli/logs/css_error.log', err);
242
342
  }
243
343
  });
244
344
  }
@@ -16,13 +16,14 @@ 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}`)
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}`)
20
21
  });
21
22
  }
22
23
 
23
24
  setAllowedErrs(allErrs) {
24
25
  this.allowedErrs = allErrs;
25
- ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT'].forEach(err => {
26
+ ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT', 'MULTIPLE_OCCURANCES'].forEach(err => {
26
27
  if (!this.allowedErrs[err]) {
27
28
  this[err] = () => null;
28
29
  }
@@ -35,6 +36,7 @@ class ErrorHandler {
35
36
 
36
37
  errorFunction(errObj) {
37
38
  if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
39
+ console.log(this.allowedErrs[errObj.type]);
38
40
  this[errObj.type](errObj);
39
41
  }
40
42
  }
@@ -302,5 +302,6 @@ module.exports = {
302
302
  };
303
303
  }),
304
304
  errors: errHandler.errors,
305
- errTable: errHandler.errorTable
305
+ errTable: errHandler.errorTable,
306
+ errHandler
306
307
  };
@@ -91,6 +91,10 @@ var _default = {
91
91
  cssDirStatement: null
92
92
  },
93
93
  app: {
94
+ moduleResolvePath: {
95
+ value: '',
96
+ cli: 'module_resolve_path'
97
+ },
94
98
  // this option only for impact testing
95
99
  devCssFileBountry: {
96
100
  value: '',
@@ -137,6 +141,10 @@ var _default = {
137
141
  value: 'dev',
138
142
  cli: 'app_mode'
139
143
  },
144
+ httpsCerts: {
145
+ value: null,
146
+ cli: 'https_certs'
147
+ },
140
148
  branch: {
141
149
  value: 'master',
142
150
  cli: 'app_branch'
@@ -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
  }
@@ -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' && httpsCerts) {
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;