@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -183
  3. package/.prettierrc +6 -0
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1152 -678
  7. package/bin/cli.js +483 -392
  8. package/docs/CustomChunks.md +26 -0
  9. package/docs/DevServerPort.md +39 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -0
  15. package/docs/ValueReplacer.md +60 -0
  16. package/docs/VariableConversion.md +724 -0
  17. package/docs/warnings_while_install.txt +35 -0
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/common/index.js +6 -6
  21. package/lib/common/splitChunks.js +60 -12
  22. package/lib/common/sslcertUpdater.js +59 -0
  23. package/lib/common/testPattern.js +69 -0
  24. package/lib/common/valueReplacer.js +55 -0
  25. package/lib/configs/jest.config.js +18 -8
  26. package/lib/configs/libAlias.js +38 -0
  27. package/lib/configs/resolvers.js +40 -0
  28. package/lib/configs/webpack.css.umd.config.js +4 -4
  29. package/lib/configs/webpack.dev.config.js +59 -54
  30. package/lib/configs/webpack.docs.config.js +56 -53
  31. package/lib/configs/webpack.impact.config.js +54 -50
  32. package/lib/configs/webpack.prod.config.js +72 -47
  33. package/lib/constants.js +31 -0
  34. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  35. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  36. package/lib/loaderUtils/getCSSLoaders.js +89 -21
  37. package/lib/loaderUtils/index.js +4 -4
  38. package/lib/loaderUtils/windowsModification.js +11 -0
  39. package/lib/loaders/fileBountryLoader.js +17 -0
  40. package/lib/loaders/scriptInstrumentLoader.js +2 -2
  41. package/lib/loaders/selectorMappingLoader.js +75 -0
  42. package/lib/loaders/workerLoader.js +9 -9
  43. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  44. package/lib/pluginUtils/getDevPlugins.js +69 -45
  45. package/lib/pluginUtils/getDocsPlugins.js +6 -8
  46. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  47. package/lib/pluginUtils/getProdPlugins.js +73 -58
  48. package/lib/pluginUtils/index.js +12 -12
  49. package/lib/plugins/CdnChangePlugin.js +16 -2
  50. package/lib/plugins/EFCPlugin.js +52 -20
  51. package/lib/plugins/EFCPlugin.md +6 -0
  52. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  53. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  54. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  55. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  56. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  57. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  58. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  59. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  60. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  61. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  62. package/lib/plugins/ManifestPlugin.js +8 -0
  63. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  64. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  65. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +11 -7
  66. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  67. package/lib/plugins/SelectorPlugin.js +97 -0
  68. package/lib/plugins/ServiceWorkerPlugin.js +13 -9
  69. package/lib/plugins/SourceMapHookPlugin.js +9 -3
  70. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  71. package/lib/plugins/VariableConversionCollector.js +352 -0
  72. package/lib/plugins/composeCommonPlugin.js +30 -0
  73. package/lib/plugins/index.js +36 -36
  74. package/lib/plugins/libraryImpactPlugin.js +14 -2
  75. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  76. package/lib/postcss-plugins/RTLSplitPlugin.js +36 -32
  77. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  78. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  79. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  80. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  81. package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
  82. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
  83. package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
  84. package/lib/postcss-plugins/variableModifier.js +244 -0
  85. package/lib/schemas/index.js +166 -11
  86. package/lib/servers/devBuild.js +102 -0
  87. package/lib/servers/docsServerCore.js +16 -18
  88. package/lib/servers/getCliPath.js +28 -0
  89. package/lib/servers/httpsOptions.js +49 -0
  90. package/lib/servers/nowatchserver.js +206 -0
  91. package/lib/servers/server.js +114 -82
  92. package/lib/sh/pre-commit.sh +34 -34
  93. package/lib/sh/reportPublish.sh +45 -45
  94. package/lib/templates/linterConstant.js +1 -1
  95. package/lib/utils/buildstats.html +148 -148
  96. package/lib/utils/cssClassNameGenerate.js +9 -2
  97. package/lib/utils/cssURLReplacer.js +30 -43
  98. package/lib/utils/getCurrentBranch.js +1 -1
  99. package/lib/utils/getDependenciesImpactList.js +14 -12
  100. package/lib/utils/getFileType.js +49 -0
  101. package/lib/utils/getOptions.js +118 -10
  102. package/lib/utils/index.js +44 -20
  103. package/lib/utils/jsonHelper.js +12 -3
  104. package/lib/utils/reinstallDependencies.js +1 -1
  105. package/lib/utils/repoClone.js +16 -4
  106. package/lib/utils/resultSchema.json +73 -73
  107. package/lib/utils/rtl.js +19 -2
  108. package/lib/utils/useExitCleanup.js +55 -0
  109. package/npm8.md +9 -0
  110. package/package.json +121 -142
  111. package/postpublish.js +8 -0
  112. package/result.json +1 -0
  113. package/templates/app/.eslintrc.js +140 -140
  114. package/templates/app/README.md +12 -12
  115. package/templates/app/app/index.html +24 -24
  116. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  117. package/templates/app/app/properties/i18nkeys.json +3 -3
  118. package/templates/app/docs/all.html +69 -69
  119. package/templates/app/mockapi/index.js +18 -18
  120. package/templates/app/package.json +37 -37
  121. package/templates/app/src/actions/SampleActions/index.js +37 -37
  122. package/templates/app/src/actions/index.js +65 -65
  123. package/templates/app/src/appUrls.js +19 -19
  124. package/templates/app/src/components/Alert/Alert.js +134 -134
  125. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  126. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  127. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  128. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  129. package/templates/app/src/components/Sample/SampleList.js +61 -61
  130. package/templates/app/src/components/Slider/Slider.css +41 -41
  131. package/templates/app/src/components/Slider/Slider.js +55 -55
  132. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  133. package/templates/app/src/containers/AppContainer/index.js +96 -96
  134. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  135. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  136. package/templates/app/src/containers/DevTools/index.js +10 -10
  137. package/templates/app/src/containers/Header/index.js +67 -67
  138. package/templates/app/src/containers/Header/index.module.css +43 -43
  139. package/templates/app/src/containers/Redirect/index.js +63 -63
  140. package/templates/app/src/containers/Redirector/index.js +47 -47
  141. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  142. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  143. package/templates/app/src/historyChange.js +5 -5
  144. package/templates/app/src/index.html +10 -10
  145. package/templates/app/src/index.js +24 -24
  146. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  147. package/templates/app/src/reducers/alertData.js +11 -11
  148. package/templates/app/src/reducers/index.js +6 -6
  149. package/templates/app/src/reducers/samples.js +19 -19
  150. package/templates/app/src/store/configureStore.dev.js +51 -51
  151. package/templates/app/src/store/configureStore.js +5 -5
  152. package/templates/app/src/store/configureStore.prod.js +26 -26
  153. package/templates/app/src/util/Common.js +5 -5
  154. package/templates/app/src/util/RequestAPI.js +132 -132
  155. package/templates/docs/all.html +249 -249
  156. package/templates/docs/component.html +178 -178
  157. package/templates/docs/components.html +221 -221
  158. package/templates/docs/css/b.min.css +6 -6
  159. package/templates/docs/css/component.css +42 -42
  160. package/templates/docs/css/componentTest.css +6 -6
  161. package/templates/docs/css/hopscotch.css +585 -585
  162. package/templates/docs/css/style.css +1022 -1022
  163. package/templates/docs/impactReportTemplate.html +154 -154
  164. package/templates/docs/index.html +1501 -1493
  165. package/templates/docs/js/active-line.js +72 -72
  166. package/templates/docs/js/b.min.js +7 -7
  167. package/templates/docs/js/codemirror.js +9680 -9680
  168. package/templates/docs/js/designTokens.js +334 -334
  169. package/templates/docs/js/j.min.js +4 -4
  170. package/templates/docs/js/javascript.js +874 -874
  171. package/templates/docs/js/matchbrackets.js +145 -145
  172. package/unittest/index.html +37 -0
  173. package/cert/cert.pem +0 -105
  174. package/cert/key.pem +0 -30
@@ -13,7 +13,29 @@ 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 = {
18
+ cliRootPath: null,
19
+ unstableDepsInverse: {
20
+ value: false,
21
+ cli: 'unstable_deps_inverse'
22
+ },
23
+ sslCertURL: {
24
+ value: null,
25
+ cli: 'ssl_cert_url'
26
+ },
27
+ preprocess: {
28
+ // This option is for tell the react-cli which in preprocessor js file path
29
+ runner: {
30
+ value: '',
31
+ cli: 'preprocessor'
32
+ },
33
+ // usally preprocessor run in nodemon for, start and docs , preprocessor
34
+ stopNodemon: {
35
+ value: false,
36
+ cli: 'stop_nodemon'
37
+ }
38
+ },
17
39
  i18n: {
18
40
  chunkSplitEnable: {
19
41
  value: false,
@@ -28,18 +50,68 @@ var _default = {
28
50
  },
29
51
  css: {
30
52
  enableRTLSplit: false,
53
+ valueReplacer: null,
54
+ //valueReplacer: [
55
+ // {
56
+ // props: ['font', 'font-family'],
57
+ // values: {
58
+ // 'zdfonts-rCallBar': 'zdfonts-rCallBar01',
59
+ // 'zdfonts-rCall': 'zdfonts-rCallBar02'
60
+ // }
61
+ // // ,suffix: '0'
62
+ // }
63
+ // ],
31
64
  templateLabel: '{{--dir}}',
65
+ disableMiniFiySelector: false,
32
66
  dirVarName: 'document.dir'
33
67
  },
34
68
  efc: {
35
- hasEFC: false,
69
+ hasEFC: {
70
+ value: false,
71
+ cli: 'enable_efc'
72
+ },
36
73
  createSDkFile: false,
37
74
  nameScope: 'ZOHODESK',
38
- version: 'default',
39
- outputFile: 'zohodesk-efc-sdk-[version].js',
40
- localeAttr: 'data-efc-locale'
75
+ version: {
76
+ value: 'stable',
77
+ cli: 'efc_version'
78
+ },
79
+ outputFile: {
80
+ value: 'efc-sdk-[version].js',
81
+ cli: 'efc_output_file'
82
+ },
83
+ templateFilePath: '',
84
+ localeAttr: 'data-efc-locale',
85
+ localeDefaultValue: 'en_US',
86
+ localeStatement: null,
87
+ cssDirAttr: 'data-efc-dir',
88
+ cssDirDefaultValue: 'ltr',
89
+ cdnStatement: '',
90
+ // cdnStatement: "new URL(document.querySelector(\"script[src*='zohodesk-efc-sdk']\").src).origin",
91
+ cssDirStatement: null
41
92
  },
42
93
  app: {
94
+ moduleResolvePath: {
95
+ value: '',
96
+ cli: 'module_resolve_path'
97
+ },
98
+ // this option only for impact testing
99
+ devCssFileBountry: {
100
+ value: '',
101
+ cli: 'impact_cssbountry'
102
+ },
103
+ disableWatch: {
104
+ value: false,
105
+ cli: 'disable_watch'
106
+ },
107
+ enableDevCache: {
108
+ value: false,
109
+ cli: 'dev_cache'
110
+ },
111
+ crossorigin: {
112
+ value: false,
113
+ cli: 'enable_crossorigin'
114
+ },
43
115
  context: {
44
116
  value: 'app',
45
117
  cli: 'app_context'
@@ -47,6 +119,7 @@ var _default = {
47
119
  tpFolder: null,
48
120
  folder: 'src',
49
121
  vendorExclude: [],
122
+ vendorInclude: [],
50
123
  cssHashSelectors: {
51
124
  filenames: [],
52
125
  packages: []
@@ -68,6 +141,10 @@ var _default = {
68
141
  value: 'dev',
69
142
  cli: 'app_mode'
70
143
  },
144
+ httpsCerts: {
145
+ value: null,
146
+ cli: 'https_certs'
147
+ },
71
148
  branch: {
72
149
  value: 'master',
73
150
  cli: 'app_branch'
@@ -82,15 +159,26 @@ var _default = {
82
159
  },
83
160
  disableContextURL: false,
84
161
  hasMock: false,
162
+ mockPrefix: {
163
+ value: '/api',
164
+ cli: 'mock_prefix'
165
+ },
85
166
  mockPort: {
86
167
  value: 5000,
87
168
  cli: 'mock_port'
88
169
  }
89
170
  },
171
+ mediaQueryHoverActiveString: {
172
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
173
+ none: '(hover: none)'
174
+ },
90
175
  disableES5Transpile: false,
91
176
  isReactMig: false,
92
177
  hasWidget: false,
93
- hasEFC: false,
178
+ hasEFC: {
179
+ value: false,
180
+ cli: 'enable_efc'
181
+ },
94
182
  enableChunkHash: {
95
183
  value: false,
96
184
  cli: 'hash_enable'
@@ -118,6 +206,9 @@ var _default = {
118
206
  cli: 'attr_name'
119
207
  },
120
208
  publicPaths: false,
209
+ // TODO: Deprecated
210
+ hasRTL: false,
211
+ rtlExclude: [],
121
212
  instrumentScript: {
122
213
  value: false,
123
214
  cli: 'instru_script'
@@ -130,8 +221,26 @@ var _default = {
130
221
  value: true,
131
222
  cli: 'enable_smaphook'
132
223
  },
133
- hasRTL: false,
134
- rtlExclude: [],
224
+ plugins: {
225
+ hasRTL: false,
226
+ hoverActive: false,
227
+ combinerMediaQuery: false,
228
+ cssVariableReplacement: false,
229
+ selectorWeight: false
230
+ },
231
+ exclude: {
232
+ rtl: [],
233
+ hoverActive: [],
234
+ combinerMediaQuery: [],
235
+ cssVariableReplacement: [],
236
+ selectorWeight: []
237
+ },
238
+ cssVariableReplacementConfig: '',
239
+ selectorWeightConfig: {
240
+ defaultSelector: '',
241
+ customFileDetails: '',
242
+ excludeStrings: []
243
+ },
135
244
  seperateCssModules: {
136
245
  value: false,
137
246
  cli: 'sep_cssmodules'
@@ -159,6 +268,7 @@ var _default = {
159
268
  replaceText: '//<!--AssetsFromBuild -->'
160
269
  },
161
270
  htmlTemplate: {
271
+ minify: null,
162
272
  inject: true
163
273
  },
164
274
  removePropTypes: false,
@@ -173,6 +283,10 @@ var _default = {
173
283
  cssTemplate: '',
174
284
  jsTemplate: '',
175
285
  i18nTemplate: ''
286
+ },
287
+ sourcemap: {
288
+ cli: 'source_map',
289
+ value: 'cheap-eval-source-map'
176
290
  }
177
291
  },
178
292
  docs: {
@@ -189,14 +303,41 @@ var _default = {
189
303
  },
190
304
  branch: false
191
305
  },
306
+ mediaQueryHoverActiveString: {
307
+ hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
308
+ none: '(hover: none)'
309
+ },
192
310
  componentFolder: 'src',
193
311
  cssUniqueness: {
194
312
  value: true,
195
313
  cli: 'css_unique'
196
314
  },
315
+ enableChunkHash: false,
197
316
  folder: 'src',
317
+ disableES5Transpile: false,
318
+ // TODO: Deprecated
198
319
  hasRTL: false,
199
320
  rtlExclude: [],
321
+ plugins: {
322
+ hasRTL: false,
323
+ hoverActive: false,
324
+ combinerMediaQuery: false,
325
+ cssVariableReplacement: false,
326
+ selectorWeight: false
327
+ },
328
+ exclude: {
329
+ rtl: [],
330
+ hoverActive: [],
331
+ combinerMediaQuery: [],
332
+ cssVariableReplacement: [],
333
+ selectorWeight: []
334
+ },
335
+ cssVariableReplacementConfig: '',
336
+ selectorWeightConfig: {
337
+ defaultSelector: '',
338
+ customFileDetails: '',
339
+ excludeStrings: []
340
+ },
200
341
  cssHashSelectors: {
201
342
  filenames: [],
202
343
  packages: []
@@ -207,6 +348,7 @@ var _default = {
207
348
  }
208
349
  },
209
350
  test: {
351
+ classnameFormat: '[classname]',
210
352
  srcBranch: {
211
353
  value: 'master',
212
354
  cli: 'src_branch'
@@ -224,7 +366,6 @@ var _default = {
224
366
  cli: 'branch_name'
225
367
  },
226
368
  impactServerDomain: {
227
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
228
369
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
229
370
  cli: 'impact_server_domain'
230
371
  },
@@ -247,7 +388,6 @@ var _default = {
247
388
  cli: 'service_name'
248
389
  },
249
390
  impactServerDomain: {
250
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
251
391
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
252
392
  cli: 'impact_server_domain'
253
393
  },
@@ -285,11 +425,23 @@ var _default = {
285
425
  cli: 'path_to_sub_projs'
286
426
  },
287
427
  tokenGit: {
288
- value: 'YbByNJ3yURAm92Lhx4vW',
428
+ value: '',
289
429
  cli: 'git_token'
430
+ },
431
+ changesOnly: {
432
+ value: false,
433
+ cli: 'changes_only'
290
434
  }
291
435
  },
292
436
  impactService: {
437
+ cssSelectorZipPath: {
438
+ value: '',
439
+ cli: 'cssselector_zip'
440
+ },
441
+ writeToDisk: {
442
+ value: false,
443
+ cli: 'write_disk'
444
+ },
293
445
  componentServiceName: {
294
446
  value: 'ZohoDeskLibrary',
295
447
  cli: 'impact_component_service'
@@ -454,7 +606,6 @@ var _default = {
454
606
  },
455
607
  impactServerDomain: {
456
608
  value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
457
- //value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
458
609
  cli: 'impact_server_domain'
459
610
  },
460
611
  impactRun: {
@@ -479,6 +630,10 @@ var _default = {
479
630
  value: null,
480
631
  cli: 'clone_revision'
481
632
  },
633
+ shallowClone: {
634
+ value: false,
635
+ cli: 'shallow_clone'
636
+ },
482
637
  projectName: {
483
638
  value: null,
484
639
  cli: 'clone_proj_name'
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPaths = getPaths;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _child_process = require("child_process");
13
+
14
+ var _utils = require("../utils");
15
+
16
+ var _getCliPath = require("./getCliPath");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
21
+ // NOTE: need to discuss about in below codes,
22
+ // when we run webpack the usable options that comes for npm run not working as automatical
23
+ // we are use this option always --disable_watch=true reason for now no need for
24
+
25
+ const {
26
+ app: {
27
+ outputFolder
28
+ }
29
+ } = options;
30
+ const {
31
+ cssSelectorZipPath
32
+ } = options.impactService;
33
+ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
34
+
35
+ const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
36
+
37
+ function execSyncDefalut(command) {
38
+ console.log(' command running ==>', command);
39
+ return (0, _child_process.execSync)(command, {
40
+ stdio: 'inherit'
41
+ });
42
+ }
43
+
44
+ const isQuiet = 'q';
45
+ const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
46
+
47
+ if (_fs.default.existsSync(outputFolderLocation)) {
48
+ execSyncDefalut(`rm -rf ${outputFolder}`);
49
+ console.log(`previous ${outputFolder} removed`);
50
+ }
51
+
52
+ if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
53
+ execSyncDefalut('rm build.zip');
54
+ console.log('previous build.zip removed');
55
+ } // execSyncDefalut(`${webpack } --version`);
56
+ // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
57
+
58
+
59
+ console.log('webpack compilation starts...');
60
+ const startTime = Date.now(); // const result = spawnSync(
61
+ // webpack,
62
+ // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
63
+ // args
64
+ // ),
65
+ // { stdio: 'inherit' }
66
+ // );
67
+ // --disable_watch=true
68
+
69
+ 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);
71
+
72
+ if (result && result.stderr) {
73
+ throw result.stderr;
74
+ }
75
+
76
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
77
+
78
+ if (zipname) {
79
+ execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
80
+ console.log('build.zip file created');
81
+ const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
82
+ execSyncDefalut(`rm -rf ${zipname}`);
83
+
84
+ if (result && result.stderr) {
85
+ console.log('zip file not created', cssSelectorZipPath);
86
+ console.error(result.stderr);
87
+ } else {
88
+ console.log('zip file created', cssSelectorZipPath);
89
+ }
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
92
+
93
+
94
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
95
+
96
+ function getPaths() {
97
+ return {
98
+ zipname,
99
+ cssSelectorZipPath,
100
+ outputFolderLocation
101
+ };
102
+ }
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _fs = _interopRequireDefault(require("fs"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
9
 
12
10
  var _https = _interopRequireDefault(require("https"));
@@ -25,31 +23,35 @@ var _utils = require("../utils");
25
23
 
26
24
  var _webpackDocs = _interopRequireDefault(require("../configs/webpack.docs.config"));
27
25
 
26
+ var _httpsOptions = require("./httpsOptions");
27
+
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
30
+ // import fs from 'fs';
30
31
  var _default = isSSTest => {
31
- let options = (0, _utils.getOptions)();
32
- let {
32
+ const options = (0, _utils.getOptions)();
33
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
34
+ const {
33
35
  docs: {
34
36
  server
35
37
  }
36
38
  } = options;
37
- let {
39
+ const {
38
40
  port,
39
41
  branch,
40
42
  host,
41
43
  domain,
42
44
  iphost
43
45
  } = server;
44
- let appPath = process.cwd();
46
+ const appPath = process.cwd();
45
47
  const app = (0, _express.default)();
46
48
  app.use(_express.default.json());
47
49
  app.use(_express.default.urlencoded({
48
50
  extended: true
49
51
  }));
50
- let docsConfig = (0, _webpackDocs.default)(isSSTest);
51
- let compiler = (0, _webpack.default)(docsConfig);
52
- 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, {
53
55
  logLevel: 'error',
54
56
  publicPath: docsConfig.output.publicPath,
55
57
  headers: {
@@ -66,7 +68,7 @@ var _default = isSSTest => {
66
68
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
67
69
  });
68
70
  app.use('/author/get', (req, res) => {
69
- let {
71
+ const {
70
72
  query: {
71
73
  componentName = ''
72
74
  }
@@ -83,7 +85,7 @@ var _default = isSSTest => {
83
85
 
84
86
  if (branch) {
85
87
  app.post('/repo/merge', (req, res) => {
86
- let {
88
+ const {
87
89
  ref
88
90
  } = req.body;
89
91
 
@@ -97,11 +99,7 @@ var _default = isSSTest => {
97
99
  });
98
100
  }
99
101
 
100
- const httpsServer = _https.default.createServer({
101
- key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/key.pem')),
102
- cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/cert.pem')),
103
- passphrase: '9i1pqink!k11'
104
- }, app);
102
+ const httpsServer = _https.default.createServer(httpsOptions, app);
105
103
 
106
104
  if (!isSSTest) {
107
105
  httpsServer.listen(port, err => {
@@ -113,8 +111,8 @@ var _default = isSSTest => {
113
111
  });
114
112
  }
115
113
 
116
- let httpPort = Number(port) + 1;
117
- let http = app.listen(httpPort, err => {
114
+ const httpPort = Number(port) + 1;
115
+ const http = app.listen(httpPort, err => {
118
116
  if (err) {
119
117
  throw err;
120
118
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCliPath = getCliPath;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = require("os");
11
+
12
+ var _fs = require("fs");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ const appPath = process.cwd();
17
+ const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
18
+ const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
19
+
20
+ const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
21
+
22
+ const suffixExt = isWindows ? '.cmd' : '';
23
+
24
+ function getCliPath(libName) {
25
+ const cliPath = _getCliPath(libName + suffixExt);
26
+
27
+ return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
28
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.httpsOptions = httpsOptions;
7
+ exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
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
+ // };
15
+ function httpsOptions(options) {
16
+ const {
17
+ httpsCerts
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
+
24
+
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
+ }