@zohodesk/react-cli 1.1.14-kubernetes → 1.1.15

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 (101) hide show
  1. package/.vscode/settings.json +25 -0
  2. package/README.md +294 -16
  3. package/bin/cli.js +30 -55
  4. package/docs/ComposeMinification.md +13 -0
  5. package/docs/CustomChunks.md +12 -9
  6. package/docs/MarkdownParser.md +18 -0
  7. package/docs/ReactLive.md +14 -0
  8. package/docs/SelectorWeight.md +3 -0
  9. package/docs/ValueReplacer.md +27 -0
  10. package/docs/VariableConversion.md +6 -1
  11. package/docs/patternFiltering.md +57 -0
  12. package/lib/common/buildEs.js +12 -0
  13. package/lib/common/runPreProcess.js +71 -0
  14. package/lib/common/splitChunks.js +65 -45
  15. package/lib/common/testPattern.js +9 -11
  16. package/lib/common/valueReplacer.js +1 -3
  17. package/lib/configs/resolvers.js +16 -5
  18. package/lib/configs/webpack.css.umd.config.js +3 -2
  19. package/lib/configs/webpack.dev.config.js +15 -5
  20. package/lib/configs/webpack.docs.config.js +17 -5
  21. package/lib/configs/webpack.impact.config.js +11 -4
  22. package/lib/configs/webpack.prod.config.js +15 -5
  23. package/lib/constants.js +3 -3
  24. package/lib/deprecationLogger.js +40 -0
  25. package/lib/loaderUtils/getCSSLoaders.js +98 -49
  26. package/lib/loaderUtils/tests/windowsModification.test.js +10 -0
  27. package/lib/loaderUtils/windowsModification.js +6 -1
  28. package/lib/loaders/__test__/markdownLoader.spec.js +145 -0
  29. package/lib/loaders/composeLoader.js +298 -0
  30. package/lib/loaders/docsLoader.js +18 -7
  31. package/lib/loaders/markdownLoader.js +71 -0
  32. package/lib/loaders/reactLiveConvertor.js +105 -0
  33. package/lib/loaders/selectorMappingLoader.js +9 -9
  34. package/lib/logger.js +27 -0
  35. package/lib/pluginUtils/getDevPlugins.js +25 -6
  36. package/lib/pluginUtils/getProdPlugins.js +32 -5
  37. package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
  38. package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
  39. package/lib/plugins/CustomAttributePlugin.js +82 -0
  40. package/lib/plugins/CustomAttributePlugin.md +35 -0
  41. package/lib/plugins/EFCPlugin.js +9 -9
  42. package/lib/plugins/EFCTemplatePlugin.js +10 -12
  43. package/lib/plugins/EfcResourceCleanupPlugin.js +43 -0
  44. package/lib/plugins/I18NInjectIntoIndexPlugin.js +8 -9
  45. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
  46. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +2 -7
  47. package/lib/plugins/I18nSplitPlugin/index.js +1 -1
  48. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
  49. package/lib/plugins/{UglifyCSSPlugin.js → MinifyPlugin.js} +3 -3
  50. package/lib/plugins/ReportGeneratePlugin.js +8 -6
  51. package/lib/plugins/ResourceHintsPlugin.js +13 -3
  52. package/lib/plugins/SelectorPlugin.js +77 -37
  53. package/lib/plugins/StatsPlugin.js +82 -0
  54. package/lib/plugins/UnusedFilesFindPlugin.js +7 -5
  55. package/lib/plugins/VariableConversionCollector.js +40 -101
  56. package/lib/plugins/index.js +7 -7
  57. package/lib/plugins/utils/classHandling.js +35 -0
  58. package/lib/plugins/utils/fileHandling.js +92 -0
  59. package/lib/plugins/utils/tests/fileHandling.test.js +30 -0
  60. package/lib/plugins/variableConvertorUtils.js +133 -0
  61. package/lib/postcss-plugins/EmptyPlugin.js +8 -0
  62. package/lib/postcss-plugins/ExcludePlugin.js +1 -1
  63. package/lib/postcss-plugins/IncludePlugin.js +23 -0
  64. package/lib/postcss-plugins/RTLSplitPlugin.js +4 -10
  65. package/lib/postcss-plugins/SelectorReplace.js +80 -0
  66. package/lib/postcss-plugins/ValueReplacer.js +8 -29
  67. package/lib/postcss-plugins/__test__/selectorReplace.test.js +28 -0
  68. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +43 -0
  69. package/lib/postcss-plugins/hoverActivePlugin.js +0 -6
  70. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -1
  71. package/lib/postcss-plugins/variableModificationPlugin/index.js +94 -38
  72. package/lib/schemas/index.js +95 -18
  73. package/lib/servers/devBuild.js +13 -11
  74. package/lib/servers/getCliPath.js +3 -5
  75. package/lib/servers/httpsOptions.js +12 -13
  76. package/lib/servers/nowatchserver.js +62 -55
  77. package/lib/servers/requireLocalOrGlobal.js +61 -0
  78. package/lib/servers/server.js +53 -52
  79. package/lib/utils/cssClassNameGenerate.js +70 -13
  80. package/lib/utils/deprecationSupport.js +134 -0
  81. package/lib/utils/getOptions.js +35 -28
  82. package/lib/utils/getServerURL.js +1 -9
  83. package/lib/utils/index.js +14 -12
  84. package/lib/utils/initPreCommitHook.js +5 -5
  85. package/lib/utils/log.js +11 -0
  86. package/lib/utils/object-manipulation.js +88 -0
  87. package/lib/utils/pullOrigin.js +3 -3
  88. package/lib/utils/reinstallDependencies.js +3 -3
  89. package/lib/utils/selectorReplacer.js +47 -0
  90. package/lib/utils/switchBranch.js +4 -2
  91. package/lib/utils/variableConverter.js +104 -0
  92. package/npm-shrinkwrap.json +33485 -0
  93. package/package.json +5 -3
  94. package/templates/docs/all.html +1 -0
  95. package/templates/docs/component.html +1 -0
  96. package/templates/docs/components.html +1 -0
  97. package/templates/docs/css/markdown.css +202 -0
  98. package/templates/docs/css/style.css +136 -169
  99. package/templates/docs/index.html +796 -632
  100. package/lib/plugins/composeCommonPlugin.js +0 -30
  101. package/lib/postcss-plugins/variableModifier.js +0 -244
@@ -10,8 +10,6 @@ const {
10
10
  ErrorHandler
11
11
  } = require('./ErrorHandler');
12
12
 
13
- const errors = [];
14
- const errorTable = [];
15
13
  const errHandler = new ErrorHandler();
16
14
  const convertableProps = {
17
15
  'font-size': true,
@@ -94,7 +92,13 @@ function pxToCalc(value) {
94
92
  return arr.join(' ');
95
93
  }
96
94
 
97
- const singleConvertor = (value, changeVal, details, range) => {
95
+ const singleConvertor = ({
96
+ value,
97
+ changeVal,
98
+ details,
99
+ range,
100
+ allowed
101
+ }) => {
98
102
  const {
99
103
  path,
100
104
  filename,
@@ -108,7 +112,15 @@ const singleConvertor = (value, changeVal, details, range) => {
108
112
  }
109
113
  }
110
114
 
115
+ if (allowed && allowed.includes(decl.value) && decl.value.toString() !== '0') {
116
+ return decl.value;
117
+ }
118
+
111
119
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
120
+ if (value.trim() === '0px') {
121
+ return '0';
122
+ }
123
+
112
124
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
113
125
 
114
126
  if (/^-var/.test(retVal)) {
@@ -121,7 +133,7 @@ const singleConvertor = (value, changeVal, details, range) => {
121
133
  // console.log(value, 'not within range')
122
134
 
123
135
 
124
- let errObj = {
136
+ const errObj = {
125
137
  decl,
126
138
  type: 'RANGE_ERROR',
127
139
  filename,
@@ -129,24 +141,8 @@ const singleConvertor = (value, changeVal, details, range) => {
129
141
  path: path
130
142
  };
131
143
  errHandler.errorTable.push(errObj);
132
- errHandler.errorFunction(errObj); // errorFunction(
133
- // {
134
- // decl,
135
- // type: 'RANGE_ERROR',
136
- // filename,
137
- // message: `value (${value}) (${typeof value}) not within range (${
138
- // range.start
139
- // },${range.end})\r`,
140
- // path: path
141
- // },
142
- // 'RANGE_ERROR'
143
- // );
144
- // }
145
- // 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`)
146
- // return value;
147
- // } else {
148
- // console.log('++++++++++++++++++++++rect val!', value);
149
- // }
144
+ errHandler.errorFunction(errObj);
145
+ return;
150
146
  };
151
147
 
152
148
  module.exports = {
@@ -179,6 +175,7 @@ module.exports = {
179
175
  });
180
176
  const valRegex = new RegExp(regValStr, 'gi');
181
177
  return rootOriginal => {
178
+ // console.log(rootOriginal.source.input.from, 'passed through variable Plugin');
182
179
  rootOriginal.walkRules(rule => {
183
180
  // rule.nodes[-1] = {}
184
181
  // need map, forEach fine less memory
@@ -189,10 +186,11 @@ module.exports = {
189
186
  const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
190
187
  // split not need use slice and lastIndexOf less memory
191
188
 
192
- const filename = fromPath.split(path.sep).pop();
189
+ const filename = fromPath.split(path.sep).pop(); // if(filename.includes('AddFormResponsive.module.css'){
190
+ // }
193
191
 
194
192
  if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
195
- let errObj = {
193
+ const errObj = {
196
194
  decl,
197
195
  type: 'DECLARATION_IGNORED',
198
196
  filename,
@@ -205,8 +203,7 @@ module.exports = {
205
203
  }
206
204
 
207
205
  if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
208
- const settings = settingsObject[decl.prop]; // console.log(settings)
209
-
206
+ const settings = settingsObject[decl.prop];
210
207
  const {
211
208
  allowed,
212
209
  range
@@ -217,6 +214,9 @@ module.exports = {
217
214
  .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
218
215
  // console.log('unit : ');
219
216
  // console.log(unit);
217
+ // if (decl.prop === 'height') {
218
+ // console.log(decl.prop, unit, 'case 1');
219
+ // }
220
220
 
221
221
  unit.forEach((val, index) => {
222
222
  allowed.forEach(alwdVal => {
@@ -236,26 +236,54 @@ module.exports = {
236
236
  unitErrorVal = val;
237
237
  }
238
238
  }
239
- }); // console.log(allowed, replacements, range)
239
+ }); // if (decl.prop === 'height') {
240
+ // console.log(decl.prop, unitErrorVal, unitError, unit, 'case 2');
241
+ // }
242
+ // console.log(allowed, replacements, range)
240
243
 
241
244
  if (!unitError) {
242
- // use variable decl.value.split(' ')
243
- if (range) {
245
+ let calcValue = false;
246
+
247
+ if (decl.value.includes('calc')) {
248
+ decl.value = pxToCalc(decl.value);
249
+ calcValue = true;
250
+ } // use variable decl.value.split(' ')
251
+
252
+
253
+ if (range && !calcValue) {
244
254
  // console.log('multiple :', decl.value)
255
+ const tempVal = decl.value; // if (decl.prop === 'height') {
256
+ // console.log(decl.prop, tempVal, decl.value, allowed, 'case 3');
257
+ // }
258
+ // if (decl.prop === 'height') {
259
+ // console.log('allowed!', decl.prop, decl.value, allowed);
260
+ // }
261
+
245
262
  let newVal = '';
246
- decl.value.split(' ').forEach(singleVal => {
247
- newVal += `${singleConvertor(singleVal, settings.replacements.px, {
248
- decl,
249
- filename,
250
- path: fromPath
251
- }, range)} `;
263
+ let splitValues = decl.value.split(' ');
264
+ splitValues = splitValues.filter(val => val.trim() !== '');
265
+ splitValues = splitValues.map(val => val.replace(/\r|\t|\n/gi, ''));
266
+ splitValues.forEach(singleVal => {
267
+ newVal += `${singleConvertor({
268
+ value: singleVal,
269
+ changeVal: settings.replacements.px,
270
+ details: {
271
+ decl,
272
+ filename,
273
+ path: fromPath
274
+ },
275
+ range,
276
+ allowed
277
+ })} `;
252
278
  });
253
- decl.value = newVal;
279
+ decl.value = newVal; // if (decl.prop === 'height') {
280
+ // console.log(decl.prop, tempVal, newVal, 'case 4');
281
+ // }
254
282
  }
255
283
  } else {
256
284
  if (!decl.value.includes('calc')) {
257
285
  // 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`);
258
- let errObj = {
286
+ const errObj = {
259
287
  decl,
260
288
  filename,
261
289
  unitErrorVal: unitErrorVal,
@@ -285,8 +313,36 @@ module.exports = {
285
313
  }
286
314
  }
287
315
  } else {
316
+ if (settingsObject[decl.prop] && decl.value && decl.value.includes('px') && decl.value.includes('var(--')) {
317
+ const valArr = decl.value.split(' ');
318
+ const settings = settingsObject[decl.prop];
319
+ const {
320
+ range,
321
+ allowed
322
+ } = settings;
323
+ const convertedVals = valArr.map(val => {
324
+ if (val.includes('px')) {
325
+ const convertedVal = singleConvertor({
326
+ value: val,
327
+ changeVal: settings.replacements.px,
328
+ details: {
329
+ decl,
330
+ filename,
331
+ path: fromPath
332
+ },
333
+ range,
334
+ allowed
335
+ });
336
+ return convertedVal ? convertedVal : val;
337
+ }
338
+
339
+ return val;
340
+ });
341
+ decl.value = convertedVals.join(' ');
342
+ }
343
+
288
344
  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')) {
289
- let errObj = {
345
+ const errObj = {
290
346
  decl,
291
347
  type: 'VARIABLE_PRESENT',
292
348
  filename,
@@ -15,7 +15,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
 
16
16
  // TODO move deprecated options to separate file and manage seperately
17
17
  var _default = {
18
- cliRootPath: null,
19
18
  unstableDepsInverse: {
20
19
  value: false,
21
20
  cli: 'unstable_deps_inverse'
@@ -36,6 +35,9 @@ var _default = {
36
35
  cli: 'stop_nodemon'
37
36
  }
38
37
  },
38
+ resourceHints: {
39
+ allowPrefetchingMultipleChunks: false
40
+ },
39
41
  i18n: {
40
42
  chunkSplitEnable: {
41
43
  value: false,
@@ -63,7 +65,39 @@ var _default = {
63
65
  // ],
64
66
  templateLabel: '{{--dir}}',
65
67
  disableMiniFiySelector: false,
66
- dirVarName: 'document.dir'
68
+ dirVarName: 'document.dir',
69
+ selectorReplace: {
70
+ before: [],
71
+ after: []
72
+ },
73
+ plugins: null,
74
+ // @type {Boolean | Array}
75
+ postCssPluginOrder: null,
76
+ patterns: {
77
+ valueReplacer: [],
78
+ selectorReplace: [],
79
+ hoverActive: [],
80
+ combinerMediaQuery: [],
81
+ hasRTL: [],
82
+ cssVariableReplacement: [],
83
+ selectorWeight: [],
84
+ cssUniqueness: [],
85
+ composeMinification: []
86
+ },
87
+ exclude: {
88
+ rtl: [],
89
+ hoverActive: [],
90
+ combinerMediaQuery: [],
91
+ cssVariableReplacement: [],
92
+ selectorWeight: [],
93
+ hasRTL: []
94
+ },
95
+ cssVariableReplacementConfig: '',
96
+ selectorWeightConfig: {
97
+ defaultSelector: '',
98
+ customFileDetails: '',
99
+ excludeStrings: []
100
+ }
67
101
  },
68
102
  efc: {
69
103
  hasEFC: {
@@ -92,9 +126,10 @@ var _default = {
92
126
  },
93
127
  app: {
94
128
  moduleResolvePath: {
95
- value: '',
129
+ value: '@zohodesk/client_packages_group',
96
130
  cli: 'module_resolve_path'
97
131
  },
132
+ customClassNamePrefix: [],
98
133
  // this option only for impact testing
99
134
  devCssFileBountry: {
100
135
  value: '',
@@ -124,6 +159,13 @@ var _default = {
124
159
  filenames: [],
125
160
  packages: []
126
161
  },
162
+ customAttributes: {
163
+ enable: false,
164
+ attributes: null,
165
+ jsAttributes: null,
166
+ cssAttributes: null,
167
+ i18nAttributes: null
168
+ },
127
169
  server: {
128
170
  host: {
129
171
  value: (0, _os.hostname)(),
@@ -221,19 +263,26 @@ var _default = {
221
263
  value: true,
222
264
  cli: 'enable_smaphook'
223
265
  },
224
- plugins: {
225
- hasRTL: false,
226
- hoverActive: false,
227
- combinerMediaQuery: false,
228
- cssVariableReplacement: false,
229
- selectorWeight: false
266
+ plugins: null,
267
+ postCssPluginOrder: null,
268
+ patterns: {
269
+ valueReplacer: [],
270
+ selectorReplace: [],
271
+ hoverActive: [],
272
+ combinerMediaQuery: [],
273
+ hasRTL: [],
274
+ cssVariableReplacement: [],
275
+ selectorWeight: [],
276
+ cssUniqueness: [],
277
+ composeMinification: []
230
278
  },
231
279
  exclude: {
232
280
  rtl: [],
233
281
  hoverActive: [],
234
282
  combinerMediaQuery: [],
235
283
  cssVariableReplacement: [],
236
- selectorWeight: []
284
+ selectorWeight: [],
285
+ hasRTL: []
237
286
  },
238
287
  cssVariableReplacementConfig: '',
239
288
  selectorWeightConfig: {
@@ -272,6 +321,7 @@ var _default = {
272
321
  inject: true
273
322
  },
274
323
  removePropTypes: false,
324
+ customChunksBaseConfig: null,
275
325
  customChunks: [{
276
326
  name: 'styles',
277
327
  pattern: '\\.css$'
@@ -287,9 +337,11 @@ var _default = {
287
337
  sourcemap: {
288
338
  cli: 'source_map',
289
339
  value: 'cheap-eval-source-map'
290
- }
340
+ },
341
+ externals: null
291
342
  },
292
343
  docs: {
344
+ externals: null,
293
345
  server: {
294
346
  iphost: (0, _getIp.default)(),
295
347
  host: (0, _os.hostname)(),
@@ -307,6 +359,7 @@ var _default = {
307
359
  hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
308
360
  none: '(hover: none)'
309
361
  },
362
+ customClassNamePrefix: [],
310
363
  componentFolder: 'src',
311
364
  cssUniqueness: {
312
365
  value: true,
@@ -317,20 +370,35 @@ var _default = {
317
370
  disableES5Transpile: false,
318
371
  // TODO: Deprecated
319
372
  hasRTL: false,
373
+ enableReactLive: {
374
+ value: true,
375
+ cli: 'react_live'
376
+ },
377
+ enableMDParser: {
378
+ value: true,
379
+ cli: 'markdown_parser'
380
+ },
320
381
  rtlExclude: [],
321
- plugins: {
322
- hasRTL: false,
323
- hoverActive: false,
324
- combinerMediaQuery: false,
325
- cssVariableReplacement: false,
326
- selectorWeight: false
382
+ selectorReplace: null,
383
+ plugins: null,
384
+ postCssPluginOrder: null,
385
+ patterns: {
386
+ valueReplacer: [],
387
+ selectorReplace: [],
388
+ hoverActive: [],
389
+ combinerMediaQuery: [],
390
+ hasRTL: [],
391
+ cssVariableReplacement: [],
392
+ selectorWeight: [],
393
+ cssUniqueness: []
327
394
  },
328
395
  exclude: {
329
396
  rtl: [],
330
397
  hoverActive: [],
331
398
  combinerMediaQuery: [],
332
399
  cssVariableReplacement: [],
333
- selectorWeight: []
400
+ selectorWeight: [],
401
+ hasRTL: []
334
402
  },
335
403
  cssVariableReplacementConfig: '',
336
404
  selectorWeightConfig: {
@@ -657,6 +725,15 @@ var _default = {
657
725
  cli: 'module_mode'
658
726
  },
659
727
  disableES5Transpile: true
728
+ },
729
+ stats: {
730
+ enable: {
731
+ value: false,
732
+ cli: 'enable_stats'
733
+ },
734
+ fileName: null,
735
+ options: null,
736
+ excludeKeys: null
660
737
  }
661
738
  };
662
739
  exports.default = _default;
@@ -15,6 +15,8 @@ var _utils = require("../utils");
15
15
 
16
16
  var _getCliPath = require("./getCliPath");
17
17
 
18
+ var _logger = require("../logger");
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
@@ -35,28 +37,28 @@ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).nam
35
37
  const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
36
38
 
37
39
  function execSyncDefalut(command) {
38
- console.log(' command running ==>', command);
40
+ (0, _logger.messageLogger)(' command running ==>', command);
39
41
  return (0, _child_process.execSync)(command, {
40
42
  stdio: 'inherit'
41
43
  });
42
44
  }
43
45
 
44
46
  const isQuiet = 'q';
45
- const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
47
+ const webpack = (0, _getCliPath.getCliPath)('webpack'); // messageLogger('webpack === > ', webpack, fs.existsSync(webpack));
46
48
 
47
49
  if (_fs.default.existsSync(outputFolderLocation)) {
48
50
  execSyncDefalut(`rm -rf ${outputFolder}`);
49
- console.log(`previous ${outputFolder} removed`);
51
+ (0, _logger.messageLogger)(`previous ${outputFolder} removed`);
50
52
  }
51
53
 
52
54
  if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
53
55
  execSyncDefalut('rm build.zip');
54
- console.log('previous build.zip removed');
56
+ (0, _logger.messageLogger)('previous build.zip removed');
55
57
  } // execSyncDefalut(`${webpack } --version`);
56
58
  // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
57
59
 
58
60
 
59
- console.log('webpack compilation starts...');
61
+ (0, _logger.messageLogger)('webpack compilation starts...');
60
62
  const startTime = Date.now(); // const result = spawnSync(
61
63
  // webpack,
62
64
  // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
@@ -67,31 +69,31 @@ const startTime = Date.now(); // const result = spawnSync(
67
69
  // --disable_watch=true
68
70
 
69
71
  const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
70
- result && console.log(result);
72
+ result && (0, _logger.messageLogger)(result);
71
73
 
72
74
  if (result && result.stderr) {
73
75
  throw result.stderr;
74
76
  }
75
77
 
76
- console.log(`compailation done in ${Date.now() - startTime}ms`);
78
+ (0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
77
79
 
78
80
  if (zipname) {
79
81
  execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
80
- console.log('build.zip file created');
82
+ (0, _logger.messageLogger)('build.zip file created');
81
83
  const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
82
84
  execSyncDefalut(`rm -rf ${zipname}`);
83
85
 
84
86
  if (result && result.stderr) {
85
- console.log('zip file not created', cssSelectorZipPath);
87
+ (0, _logger.messageLogger)('zip file not created', cssSelectorZipPath);
86
88
  console.error(result.stderr);
87
89
  } else {
88
- console.log('zip file created', cssSelectorZipPath);
90
+ (0, _logger.messageLogger)('zip file created', cssSelectorZipPath);
89
91
  }
90
92
  } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
91
93
  // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
92
94
 
93
95
 
94
- console.log(`compailation done in ${Date.now() - startTime}ms`);
96
+ (0, _logger.messageLogger)(`compailation done in ${Date.now() - startTime}ms`);
95
97
 
96
98
  function getPaths() {
97
99
  return {
@@ -5,19 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getCliPath = getCliPath;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
8
+ var _path = require("path");
9
9
 
10
10
  var _os = require("os");
11
11
 
12
12
  var _fs = require("fs");
13
13
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ var _constants = require("../constants");
15
15
 
16
- const appPath = process.cwd();
17
- const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
18
16
  const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
19
17
 
20
- const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
18
+ const _getCliPath = libName => (0, _path.join)(_constants.cliNodeModulesPath, '.bin', libName);
21
19
 
22
20
  const suffixExt = isWindows ? '.cmd' : '';
23
21
 
@@ -6,21 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.httpsOptions = httpsOptions;
7
7
  exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
8
8
 
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
- // };
9
+ var _logger = require("../logger");
10
+
11
+ var _requireLocalOrGlobal = require("./requireLocalOrGlobal");
12
+
13
+ const globalCertificate = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk-private/client_dev_cert');
14
+
15
15
  function httpsOptions(options) {
16
16
  const {
17
17
  httpsCerts
18
18
  } = options.app.server;
19
-
20
- const certificate = require(require.resolve(httpsCerts, {
21
- paths: [process.cwd()]
22
- })); // TODO: in future we may do some version based check. certificate.version
23
-
19
+ const certificate = (0, _requireLocalOrGlobal.requireLocalOrGlobal)(httpsCerts); // TODO: in future we may do some version based check. certificate.version
24
20
 
25
21
  return certificate.httpsOptions;
26
22
  }
@@ -36,13 +32,16 @@ function httpsOptionsWithUserFriendlyError(options) {
36
32
  return certificate;
37
33
  } catch (error) {
38
34
  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()}"`);
35
+ (0, _logger.errorLogger)(`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
36
  } else {
41
- console.error(error);
37
+ (0, _logger.errorLogger)(error);
42
38
  }
43
39
 
44
40
  process.exit(0);
45
41
  }
42
+ } else if (globalCertificate) {
43
+ (0, _logger.messageLogger)('global `@zohodesk-private/client_dev_cert` package taken as https certificate');
44
+ return globalCertificate.httpsOptions;
46
45
  } else {
47
46
  return null;
48
47
  }