@zohodesk/react-cli 0.0.1-test.148.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -183
- package/.prettierrc +6 -0
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +1152 -678
- package/bin/cli.js +483 -392
- package/docs/CustomChunks.md +26 -0
- package/docs/DevServerPort.md +39 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/VariableConversion.md +724 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +60 -12
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +18 -8
- package/lib/configs/libAlias.js +38 -0
- package/lib/configs/resolvers.js +40 -0
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +59 -54
- package/lib/configs/webpack.docs.config.js +56 -53
- package/lib/configs/webpack.impact.config.js +54 -50
- package/lib/configs/webpack.prod.config.js +72 -47
- package/lib/constants.js +31 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +89 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/scriptInstrumentLoader.js +2 -2
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
- package/lib/pluginUtils/getDevPlugins.js +68 -45
- package/lib/pluginUtils/getDocsPlugins.js +6 -8
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getProdPlugins.js +72 -58
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/CdnChangePlugin.js +16 -2
- package/lib/plugins/EFCPlugin.js +52 -20
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
- package/lib/plugins/ManifestPlugin.js +8 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +13 -9
- package/lib/plugins/SourceMapHookPlugin.js +9 -3
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +352 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +36 -36
- package/lib/plugins/libraryImpactPlugin.js +14 -2
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +13 -13
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +165 -11
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServerCore.js +16 -18
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/httpsOptions.js +49 -0
- package/lib/servers/nowatchserver.js +206 -0
- package/lib/servers/server.js +114 -82
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getDependenciesImpactList.js +14 -12
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/getOptions.js +118 -10
- package/lib/utils/index.js +44 -20
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/lib/utils/repoClone.js +16 -4
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +121 -142
- package/postpublish.js +8 -0
- package/result.json +1 -0
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/unittest/index.html +37 -0
- package/cert/cert.pem +0 -105
- package/cert/key.pem +0 -30
package/lib/schemas/index.js
CHANGED
@@ -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,19 +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}}',
|
32
65
|
disableMiniFiySelector: false,
|
33
66
|
dirVarName: 'document.dir'
|
34
67
|
},
|
35
68
|
efc: {
|
36
|
-
hasEFC:
|
69
|
+
hasEFC: {
|
70
|
+
value: false,
|
71
|
+
cli: 'enable_efc'
|
72
|
+
},
|
37
73
|
createSDkFile: false,
|
38
74
|
nameScope: 'ZOHODESK',
|
39
|
-
version:
|
40
|
-
|
41
|
-
|
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
|
42
92
|
},
|
43
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
|
+
},
|
44
115
|
context: {
|
45
116
|
value: 'app',
|
46
117
|
cli: 'app_context'
|
@@ -48,6 +119,7 @@ var _default = {
|
|
48
119
|
tpFolder: null,
|
49
120
|
folder: 'src',
|
50
121
|
vendorExclude: [],
|
122
|
+
vendorInclude: [],
|
51
123
|
cssHashSelectors: {
|
52
124
|
filenames: [],
|
53
125
|
packages: []
|
@@ -69,6 +141,10 @@ var _default = {
|
|
69
141
|
value: 'dev',
|
70
142
|
cli: 'app_mode'
|
71
143
|
},
|
144
|
+
httpsCerts: {
|
145
|
+
value: null,
|
146
|
+
cli: 'https_certs'
|
147
|
+
},
|
72
148
|
branch: {
|
73
149
|
value: 'master',
|
74
150
|
cli: 'app_branch'
|
@@ -83,15 +159,26 @@ var _default = {
|
|
83
159
|
},
|
84
160
|
disableContextURL: false,
|
85
161
|
hasMock: false,
|
162
|
+
mockPrefix: {
|
163
|
+
value: '/api',
|
164
|
+
cli: 'mock_prefix'
|
165
|
+
},
|
86
166
|
mockPort: {
|
87
167
|
value: 5000,
|
88
168
|
cli: 'mock_port'
|
89
169
|
}
|
90
170
|
},
|
171
|
+
mediaQueryHoverActiveString: {
|
172
|
+
hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
|
173
|
+
none: '(hover: none)'
|
174
|
+
},
|
91
175
|
disableES5Transpile: false,
|
92
176
|
isReactMig: false,
|
93
177
|
hasWidget: false,
|
94
|
-
hasEFC:
|
178
|
+
hasEFC: {
|
179
|
+
value: false,
|
180
|
+
cli: 'enable_efc'
|
181
|
+
},
|
95
182
|
enableChunkHash: {
|
96
183
|
value: false,
|
97
184
|
cli: 'hash_enable'
|
@@ -119,6 +206,9 @@ var _default = {
|
|
119
206
|
cli: 'attr_name'
|
120
207
|
},
|
121
208
|
publicPaths: false,
|
209
|
+
// TODO: Deprecated
|
210
|
+
hasRTL: false,
|
211
|
+
rtlExclude: [],
|
122
212
|
instrumentScript: {
|
123
213
|
value: false,
|
124
214
|
cli: 'instru_script'
|
@@ -131,8 +221,26 @@ var _default = {
|
|
131
221
|
value: true,
|
132
222
|
cli: 'enable_smaphook'
|
133
223
|
},
|
134
|
-
|
135
|
-
|
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
|
+
},
|
136
244
|
seperateCssModules: {
|
137
245
|
value: false,
|
138
246
|
cli: 'sep_cssmodules'
|
@@ -160,6 +268,7 @@ var _default = {
|
|
160
268
|
replaceText: '//<!--AssetsFromBuild -->'
|
161
269
|
},
|
162
270
|
htmlTemplate: {
|
271
|
+
minify: null,
|
163
272
|
inject: true
|
164
273
|
},
|
165
274
|
removePropTypes: false,
|
@@ -174,6 +283,10 @@ var _default = {
|
|
174
283
|
cssTemplate: '',
|
175
284
|
jsTemplate: '',
|
176
285
|
i18nTemplate: ''
|
286
|
+
},
|
287
|
+
sourcemap: {
|
288
|
+
cli: 'source_map',
|
289
|
+
value: 'cheap-eval-source-map'
|
177
290
|
}
|
178
291
|
},
|
179
292
|
docs: {
|
@@ -190,14 +303,41 @@ var _default = {
|
|
190
303
|
},
|
191
304
|
branch: false
|
192
305
|
},
|
306
|
+
mediaQueryHoverActiveString: {
|
307
|
+
hover: 'all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)',
|
308
|
+
none: '(hover: none)'
|
309
|
+
},
|
193
310
|
componentFolder: 'src',
|
194
311
|
cssUniqueness: {
|
195
312
|
value: true,
|
196
313
|
cli: 'css_unique'
|
197
314
|
},
|
315
|
+
enableChunkHash: false,
|
198
316
|
folder: 'src',
|
317
|
+
disableES5Transpile: false,
|
318
|
+
// TODO: Deprecated
|
199
319
|
hasRTL: false,
|
200
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
|
+
},
|
201
341
|
cssHashSelectors: {
|
202
342
|
filenames: [],
|
203
343
|
packages: []
|
@@ -208,6 +348,7 @@ var _default = {
|
|
208
348
|
}
|
209
349
|
},
|
210
350
|
test: {
|
351
|
+
classnameFormat: '[classname]',
|
211
352
|
srcBranch: {
|
212
353
|
value: 'master',
|
213
354
|
cli: 'src_branch'
|
@@ -225,7 +366,6 @@ var _default = {
|
|
225
366
|
cli: 'branch_name'
|
226
367
|
},
|
227
368
|
impactServerDomain: {
|
228
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
229
369
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
230
370
|
cli: 'impact_server_domain'
|
231
371
|
},
|
@@ -248,7 +388,6 @@ var _default = {
|
|
248
388
|
cli: 'service_name'
|
249
389
|
},
|
250
390
|
impactServerDomain: {
|
251
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
252
391
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
253
392
|
cli: 'impact_server_domain'
|
254
393
|
},
|
@@ -286,11 +425,23 @@ var _default = {
|
|
286
425
|
cli: 'path_to_sub_projs'
|
287
426
|
},
|
288
427
|
tokenGit: {
|
289
|
-
value: '
|
428
|
+
value: '',
|
290
429
|
cli: 'git_token'
|
430
|
+
},
|
431
|
+
changesOnly: {
|
432
|
+
value: false,
|
433
|
+
cli: 'changes_only'
|
291
434
|
}
|
292
435
|
},
|
293
436
|
impactService: {
|
437
|
+
cssSelectorZipPath: {
|
438
|
+
value: '',
|
439
|
+
cli: 'cssselector_zip'
|
440
|
+
},
|
441
|
+
writeToDisk: {
|
442
|
+
value: false,
|
443
|
+
cli: 'write_disk'
|
444
|
+
},
|
294
445
|
componentServiceName: {
|
295
446
|
value: 'ZohoDeskLibrary',
|
296
447
|
cli: 'impact_component_service'
|
@@ -455,7 +606,6 @@ var _default = {
|
|
455
606
|
},
|
456
607
|
impactServerDomain: {
|
457
608
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
458
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
459
609
|
cli: 'impact_server_domain'
|
460
610
|
},
|
461
611
|
impactRun: {
|
@@ -480,6 +630,10 @@ var _default = {
|
|
480
630
|
value: null,
|
481
631
|
cli: 'clone_revision'
|
482
632
|
},
|
633
|
+
shallowClone: {
|
634
|
+
value: false,
|
635
|
+
cli: 'shallow_clone'
|
636
|
+
},
|
483
637
|
projectName: {
|
484
638
|
value: null,
|
485
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
|
-
|
32
|
-
|
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
|
-
|
39
|
+
const {
|
38
40
|
port,
|
39
41
|
branch,
|
40
42
|
host,
|
41
43
|
domain,
|
42
44
|
iphost
|
43
45
|
} = server;
|
44
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
117
|
-
|
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
|
+
}
|