@zohodesk/react-cli 1.1.17 → 1.1.18-exp.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +22 -0
- package/lib/babel/cmjs-plugins-presets.js +7 -1
- package/lib/babel/es-plugins-presets.js +7 -1
- package/lib/configs/webpack.dev.config.js +7 -2
- package/lib/configs/webpack.prod.config.js +9 -2
- package/lib/loaderUtils/getDevJsLoaders.js +5 -1
- package/lib/schemas/index.js +4 -0
- package/npm-shrinkwrap.json +31 -5
- package/package.json +1 -1
- package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
- package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
- package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
- package/packages/client_build_tool/lib/commands/build/config.js +12 -0
- package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/build/index.js +35 -0
- package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
- package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
- package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
- package/packages/client_build_tool/lib/commands/start/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
- package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
- package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
- package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
- package/packages/client_build_tool/lib/commandsRouter.js +71 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
- package/packages/client_build_tool/lib/shared/constants.js +33 -0
- package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
- package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
- package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
- package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
- package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
- package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
- package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
- package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
- package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
- package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
- package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
- package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
- package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
- package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
- package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
- package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
- package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
@@ -0,0 +1,480 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _os = require("os");
|
9
|
+
|
10
|
+
var _getIp = require("../server/getIp");
|
11
|
+
|
12
|
+
var _default = {
|
13
|
+
cliRootPath: null,
|
14
|
+
unstableDepsInverse: {
|
15
|
+
value: false,
|
16
|
+
cli: 'unstable_deps_inverse'
|
17
|
+
},
|
18
|
+
sslCertURL: {
|
19
|
+
value: null,
|
20
|
+
cli: 'ssl_cert_url'
|
21
|
+
},
|
22
|
+
preprocess: {
|
23
|
+
// This option is for tell the react-cli which in preprocessor js file path
|
24
|
+
runner: {
|
25
|
+
value: '',
|
26
|
+
cli: 'preprocessor'
|
27
|
+
},
|
28
|
+
// usally preprocessor run in nodemon for, start and docs , preprocessor
|
29
|
+
stopNodemon: {
|
30
|
+
value: false,
|
31
|
+
cli: 'stop_nodemon'
|
32
|
+
}
|
33
|
+
},
|
34
|
+
i18n: {
|
35
|
+
chunkSplitEnable: {
|
36
|
+
value: false,
|
37
|
+
cli: 'i18n_split'
|
38
|
+
},
|
39
|
+
disableDefault: false,
|
40
|
+
templateLabel: '{{--user-locale}}',
|
41
|
+
jsResource: null,
|
42
|
+
localeVarName: 'document.documentElement.lang',
|
43
|
+
jsonpFunc: 'console.log',
|
44
|
+
propertiesFolder: null
|
45
|
+
},
|
46
|
+
css: {
|
47
|
+
enableRTLSplit: false,
|
48
|
+
valueReplacer: null,
|
49
|
+
//valueReplacer: [
|
50
|
+
// {
|
51
|
+
// props: ['font', 'font-family'],
|
52
|
+
// values: {
|
53
|
+
// 'zdfonts-rCallBar': 'zdfonts-rCallBar01',
|
54
|
+
// 'zdfonts-rCall': 'zdfonts-rCallBar02'
|
55
|
+
// }
|
56
|
+
// // ,suffix: '0'
|
57
|
+
// }
|
58
|
+
// ],
|
59
|
+
templateLabel: '{{--dir}}',
|
60
|
+
disableMiniFiySelector: false,
|
61
|
+
dirVarName: 'document.dir'
|
62
|
+
},
|
63
|
+
efc: {
|
64
|
+
hasEFC: {
|
65
|
+
value: false,
|
66
|
+
cli: 'enable_efc'
|
67
|
+
},
|
68
|
+
createSDkFile: false,
|
69
|
+
nameScope: 'ZOHODESK',
|
70
|
+
version: 'default',
|
71
|
+
outputFile: {
|
72
|
+
value: 'efc-sdk-[version].js',
|
73
|
+
cli: 'efc_output_file'
|
74
|
+
},
|
75
|
+
templateFilePath: '',
|
76
|
+
localeAttr: 'data-efc-locale',
|
77
|
+
localeDefaultValue: 'en_US',
|
78
|
+
localeStatement: null,
|
79
|
+
cssDirAttr: 'data-efc-dir',
|
80
|
+
cssDirDefaultValue: 'ltr',
|
81
|
+
cdnStatement: '',
|
82
|
+
// cdnStatement: "new URL(document.querySelector(\"script[src*='zohodesk-efc-sdk']\").src).origin",
|
83
|
+
cssDirStatement: null
|
84
|
+
},
|
85
|
+
app: {
|
86
|
+
// this option only for impact testing
|
87
|
+
devCssFileBountry: {
|
88
|
+
value: '',
|
89
|
+
cli: 'impact_cssbountry'
|
90
|
+
},
|
91
|
+
disableWatch: {
|
92
|
+
value: false,
|
93
|
+
cli: 'disable_watch'
|
94
|
+
},
|
95
|
+
enableDevCache: {
|
96
|
+
value: false,
|
97
|
+
cli: 'dev_cache'
|
98
|
+
},
|
99
|
+
crossorigin: {
|
100
|
+
value: false,
|
101
|
+
cli: 'enable_crossorigin'
|
102
|
+
},
|
103
|
+
context: {
|
104
|
+
value: 'app',
|
105
|
+
cli: 'app_context'
|
106
|
+
},
|
107
|
+
tpFolder: null,
|
108
|
+
// folder: 'src',
|
109
|
+
folder: {
|
110
|
+
cli: 'app_folder',
|
111
|
+
value: 'src'
|
112
|
+
},
|
113
|
+
vendorExclude: [],
|
114
|
+
vendorInclude: [],
|
115
|
+
cssHashSelectors: {
|
116
|
+
filenames: [],
|
117
|
+
packages: []
|
118
|
+
},
|
119
|
+
server: {
|
120
|
+
host: {
|
121
|
+
value: (0, _os.hostname)(),
|
122
|
+
cli: 'app_host'
|
123
|
+
},
|
124
|
+
port: {
|
125
|
+
value: 9090,
|
126
|
+
cli: 'app_port'
|
127
|
+
},
|
128
|
+
domain: {
|
129
|
+
value: null,
|
130
|
+
cli: 'app_domain'
|
131
|
+
},
|
132
|
+
mode: {
|
133
|
+
value: 'dev',
|
134
|
+
cli: 'app_mode'
|
135
|
+
},
|
136
|
+
branch: {
|
137
|
+
value: 'master',
|
138
|
+
cli: 'app_branch'
|
139
|
+
},
|
140
|
+
redisHost: {
|
141
|
+
value: '127.0.0.1',
|
142
|
+
cli: 'redis:host'
|
143
|
+
},
|
144
|
+
redisPort: {
|
145
|
+
value: '6379',
|
146
|
+
cli: 'redis:port'
|
147
|
+
},
|
148
|
+
disableContextURL: false,
|
149
|
+
hasMock: false,
|
150
|
+
mockPrefix: {
|
151
|
+
value: '/api',
|
152
|
+
cli: 'mock_prefix'
|
153
|
+
},
|
154
|
+
mockPort: {
|
155
|
+
value: 5000,
|
156
|
+
cli: 'mock_port'
|
157
|
+
}
|
158
|
+
},
|
159
|
+
disableES5Transpile: false,
|
160
|
+
isReactMig: false,
|
161
|
+
hasWidget: false,
|
162
|
+
hasEFC: {
|
163
|
+
value: false,
|
164
|
+
cli: 'enable_efc'
|
165
|
+
},
|
166
|
+
enableChunkHash: {
|
167
|
+
value: false,
|
168
|
+
cli: 'hash_enable'
|
169
|
+
},
|
170
|
+
cssUniqueness: {
|
171
|
+
value: true,
|
172
|
+
cli: 'css_unique'
|
173
|
+
},
|
174
|
+
outputFolder: {
|
175
|
+
value: 'build',
|
176
|
+
cli: 'output_folder'
|
177
|
+
},
|
178
|
+
bundleAnalyze: {
|
179
|
+
value: false,
|
180
|
+
cli: 'bundle_analyze'
|
181
|
+
},
|
182
|
+
optimize: true,
|
183
|
+
manifestFileName: 'manifest.json',
|
184
|
+
removeAttribute: {
|
185
|
+
value: true,
|
186
|
+
cli: 'rm_attr'
|
187
|
+
},
|
188
|
+
attrbuteNames: {
|
189
|
+
value: ['data-testid'],
|
190
|
+
cli: 'attr_name'
|
191
|
+
},
|
192
|
+
publicPaths: false,
|
193
|
+
instrumentScript: {
|
194
|
+
value: false,
|
195
|
+
cli: 'instru_script'
|
196
|
+
},
|
197
|
+
enableSMap: {
|
198
|
+
value: false,
|
199
|
+
cli: 'enable_smap'
|
200
|
+
},
|
201
|
+
enableSMapHook: {
|
202
|
+
value: true,
|
203
|
+
cli: 'enable_smaphook'
|
204
|
+
},
|
205
|
+
hasRTL: false,
|
206
|
+
rtlExclude: [],
|
207
|
+
seperateCssModules: {
|
208
|
+
value: false,
|
209
|
+
cli: 'sep_cssmodules'
|
210
|
+
},
|
211
|
+
hasShadowDOM: {
|
212
|
+
value: false,
|
213
|
+
cli: 'has_shadowdom'
|
214
|
+
},
|
215
|
+
resourceHints: [],
|
216
|
+
changeRuntimeChunkChar: false,
|
217
|
+
classNamePrefix: {
|
218
|
+
value: 'zd',
|
219
|
+
cli: 'class_prefix'
|
220
|
+
},
|
221
|
+
selectorReplace: null,
|
222
|
+
devConsoleExculde: {
|
223
|
+
value: false,
|
224
|
+
cli: 'console_exculde'
|
225
|
+
},
|
226
|
+
serviceWorker: {
|
227
|
+
enableSw: false,
|
228
|
+
filePath: 'sw.js',
|
229
|
+
fileName: 'v1.js',
|
230
|
+
exitPath: '/',
|
231
|
+
replaceText: '//<!--AssetsFromBuild -->'
|
232
|
+
},
|
233
|
+
htmlTemplate: {
|
234
|
+
inject: true
|
235
|
+
},
|
236
|
+
removePropTypes: false,
|
237
|
+
customChunks: [{
|
238
|
+
name: 'styles',
|
239
|
+
pattern: '\\.css$'
|
240
|
+
}],
|
241
|
+
tpHashMapping: [],
|
242
|
+
cdnMapping: {
|
243
|
+
isCdnEnabled: false,
|
244
|
+
variableName: '',
|
245
|
+
cssTemplate: '',
|
246
|
+
jsTemplate: '',
|
247
|
+
i18nTemplate: ''
|
248
|
+
},
|
249
|
+
sourcemap: {
|
250
|
+
cli: 'source_map',
|
251
|
+
value: 'cheap-eval-source-map'
|
252
|
+
}
|
253
|
+
},
|
254
|
+
docs: {
|
255
|
+
server: {
|
256
|
+
iphost: (0, _getIp.getIp)(),
|
257
|
+
host: (0, _os.hostname)(),
|
258
|
+
port: {
|
259
|
+
value: 9292,
|
260
|
+
cli: 'docs_port'
|
261
|
+
},
|
262
|
+
domain: {
|
263
|
+
value: null,
|
264
|
+
cli: 'docs_domain'
|
265
|
+
},
|
266
|
+
branch: false
|
267
|
+
},
|
268
|
+
componentFolder: 'src',
|
269
|
+
cssUniqueness: {
|
270
|
+
value: true,
|
271
|
+
cli: 'css_unique'
|
272
|
+
},
|
273
|
+
enableChunkHash: false,
|
274
|
+
folder: 'src',
|
275
|
+
disableES5Transpile: false,
|
276
|
+
hasRTL: false,
|
277
|
+
rtlExclude: [],
|
278
|
+
cssHashSelectors: {
|
279
|
+
filenames: [],
|
280
|
+
packages: []
|
281
|
+
},
|
282
|
+
classNamePrefix: {
|
283
|
+
value: 'zd',
|
284
|
+
cli: 'class_prefix'
|
285
|
+
}
|
286
|
+
},
|
287
|
+
ssr: {
|
288
|
+
server: {
|
289
|
+
host: (0, _os.hostname)(),
|
290
|
+
port: {
|
291
|
+
value: 4040,
|
292
|
+
cli: 'ssr_port'
|
293
|
+
},
|
294
|
+
domain: {
|
295
|
+
value: false,
|
296
|
+
cli: 'ssr_domain'
|
297
|
+
},
|
298
|
+
repoUrl: 'https://vimalesan.a@git.csez.zohocorpin.com/zohodesk/supportportal.git',
|
299
|
+
branch: {
|
300
|
+
value: 'theme1',
|
301
|
+
cli: 'ssr_branch'
|
302
|
+
},
|
303
|
+
clientAppPath: 'jsapps/portalapp'
|
304
|
+
},
|
305
|
+
watch: {
|
306
|
+
value: false,
|
307
|
+
cli: 'ssr_watch'
|
308
|
+
}
|
309
|
+
},
|
310
|
+
cluster: {
|
311
|
+
server: {
|
312
|
+
host: (0, _os.hostname)(),
|
313
|
+
port: 4000,
|
314
|
+
domain: {
|
315
|
+
value: false,
|
316
|
+
cli: 'cluster_domain'
|
317
|
+
}
|
318
|
+
}
|
319
|
+
},
|
320
|
+
help: {
|
321
|
+
server: {
|
322
|
+
host: (0, _os.hostname)(),
|
323
|
+
port: 3000,
|
324
|
+
domain: {
|
325
|
+
value: false,
|
326
|
+
cli: 'help_domain'
|
327
|
+
}
|
328
|
+
}
|
329
|
+
},
|
330
|
+
umd: {
|
331
|
+
component: {
|
332
|
+
watch: {
|
333
|
+
value: false,
|
334
|
+
cli: 'umdComp_watch'
|
335
|
+
},
|
336
|
+
umdVar: 'Component',
|
337
|
+
isDocs: false,
|
338
|
+
isHtml: false,
|
339
|
+
outputFolder: 'build',
|
340
|
+
cssUniqueness: {
|
341
|
+
value: true,
|
342
|
+
cli: 'umdComp_css_unique'
|
343
|
+
},
|
344
|
+
folder: 'src'
|
345
|
+
},
|
346
|
+
css: {
|
347
|
+
watch: {
|
348
|
+
value: false,
|
349
|
+
cli: 'umdCss_watch'
|
350
|
+
},
|
351
|
+
outputFolder: 'dist',
|
352
|
+
umdVar: 'CSS',
|
353
|
+
cssUniqueness: {
|
354
|
+
value: true,
|
355
|
+
cli: 'umdCss_css_unique'
|
356
|
+
},
|
357
|
+
folder: 'src',
|
358
|
+
publicPath: {
|
359
|
+
value: false,
|
360
|
+
cli: 'umdCss_public_path'
|
361
|
+
},
|
362
|
+
cssHashSelectors: {
|
363
|
+
filenames: [],
|
364
|
+
packages: []
|
365
|
+
},
|
366
|
+
classNamePrefix: {
|
367
|
+
value: 'zd',
|
368
|
+
cli: 'class_prefix'
|
369
|
+
}
|
370
|
+
},
|
371
|
+
library: {
|
372
|
+
umdVar: 'Component',
|
373
|
+
outputFolder: 'build',
|
374
|
+
watch: {
|
375
|
+
value: false,
|
376
|
+
cli: 'umdLib_watch'
|
377
|
+
}
|
378
|
+
}
|
379
|
+
},
|
380
|
+
unusedFiles: {
|
381
|
+
usedFilesExcludes: ['node_modules'],
|
382
|
+
appFilesExcludes: ['.docs.js$', '/__tests__/.*(spec|test).js$'],
|
383
|
+
delete: false,
|
384
|
+
enable: {
|
385
|
+
value: false,
|
386
|
+
cli: 'enable_unusedfiles'
|
387
|
+
},
|
388
|
+
outputFileName: 'Unusedfiles.json'
|
389
|
+
},
|
390
|
+
esLint: {
|
391
|
+
enable: {
|
392
|
+
value: false,
|
393
|
+
cli: 'enable_eslint'
|
394
|
+
},
|
395
|
+
ignoreFilePaths: false,
|
396
|
+
fix: {
|
397
|
+
value: false,
|
398
|
+
cli: 'eslint_fix'
|
399
|
+
},
|
400
|
+
isCI: {
|
401
|
+
value: false,
|
402
|
+
cli: 'eslint_ci'
|
403
|
+
},
|
404
|
+
reportType: {
|
405
|
+
value: 'json',
|
406
|
+
cli: 'report_type'
|
407
|
+
},
|
408
|
+
reportPath: {
|
409
|
+
value: './eslint/report.json',
|
410
|
+
cli: 'report_path'
|
411
|
+
},
|
412
|
+
srcBranch: {
|
413
|
+
value: 'master',
|
414
|
+
cli: 'src_branch'
|
415
|
+
},
|
416
|
+
targetBranch: {
|
417
|
+
value: 'master',
|
418
|
+
cli: 'target_branch'
|
419
|
+
},
|
420
|
+
serviceName: {
|
421
|
+
value: 'ZohoDeskReactApp',
|
422
|
+
cli: 'service_name'
|
423
|
+
},
|
424
|
+
impactServerDomain: {
|
425
|
+
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
426
|
+
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
427
|
+
cli: 'impact_server_domain'
|
428
|
+
},
|
429
|
+
impactRun: {
|
430
|
+
value: false,
|
431
|
+
cli: 'impact_run'
|
432
|
+
}
|
433
|
+
},
|
434
|
+
clone: {
|
435
|
+
type: {
|
436
|
+
value: null,
|
437
|
+
cli: 'clone_type'
|
438
|
+
},
|
439
|
+
url: {
|
440
|
+
value: null,
|
441
|
+
cli: 'clone_url'
|
442
|
+
},
|
443
|
+
branch: {
|
444
|
+
value: null,
|
445
|
+
cli: 'clone_branch'
|
446
|
+
},
|
447
|
+
revision: {
|
448
|
+
value: null,
|
449
|
+
cli: 'clone_revision'
|
450
|
+
},
|
451
|
+
shallowClone: {
|
452
|
+
value: false,
|
453
|
+
cli: 'shallow_clone'
|
454
|
+
},
|
455
|
+
projectName: {
|
456
|
+
value: null,
|
457
|
+
cli: 'clone_proj_name'
|
458
|
+
},
|
459
|
+
remoteName: {
|
460
|
+
value: 'origin',
|
461
|
+
cli: 'clone_remote_name'
|
462
|
+
},
|
463
|
+
cacheDir: {
|
464
|
+
value: null,
|
465
|
+
cli: 'clone_cacheDir'
|
466
|
+
},
|
467
|
+
shouldDelete: {
|
468
|
+
value: true,
|
469
|
+
cli: 'clone_delete'
|
470
|
+
}
|
471
|
+
},
|
472
|
+
module: {
|
473
|
+
mode: {
|
474
|
+
value: 'prod',
|
475
|
+
cli: 'module_mode'
|
476
|
+
},
|
477
|
+
disableES5Transpile: true
|
478
|
+
}
|
479
|
+
};
|
480
|
+
exports.default = _default;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getOptions = exports.args = void 0;
|
7
|
+
|
8
|
+
var _applyValuesToShema = require("./applyValuesToShema");
|
9
|
+
|
10
|
+
var _cliArgsToObject = require("./cliArgsToObject");
|
11
|
+
|
12
|
+
var _defaultConfigValues = _interopRequireDefault(require("./defaultConfigValues"));
|
13
|
+
|
14
|
+
var _deprecatedOptionsHandler = require("./deprecatedOptionsHandler");
|
15
|
+
|
16
|
+
var _getCWD = require("./getCWD");
|
17
|
+
|
18
|
+
var _getNpmVersion = require("./getNpmVersion");
|
19
|
+
|
20
|
+
var _npmConfigToObject = require("./npmConfigToObject");
|
21
|
+
|
22
|
+
var _readOptionsForPackageJson = require("./readOptionsForPackageJson");
|
23
|
+
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
|
+
|
26
|
+
// import schemas from './oldDefaultConfigValues';
|
27
|
+
const args = process.argv.slice(2);
|
28
|
+
exports.args = args;
|
29
|
+
const processEnv = (0, _npmConfigToObject.npmConfigToObject)();
|
30
|
+
const cliArgsObject = (0, _cliArgsToObject.cliArgsToObject)(args);
|
31
|
+
Object.assign(processEnv, cliArgsObject);
|
32
|
+
global.reactCLIOptions = null;
|
33
|
+
|
34
|
+
const getOptions = () => {
|
35
|
+
if (global.reactCLIOptions) {
|
36
|
+
return global.reactCLIOptions;
|
37
|
+
}
|
38
|
+
|
39
|
+
const appPath = process.cwd();
|
40
|
+
const userSchemas = (0, _readOptionsForPackageJson.readOptionsForPackageJson)(appPath);
|
41
|
+
const options = (0, _applyValuesToShema.applyValuesToShema)(_defaultConfigValues.default, userSchemas || {}, processEnv);
|
42
|
+
(0, _deprecatedOptionsHandler.deprecatedOptionsHandler)(options); // for future may be for npm 8 edge cases
|
43
|
+
|
44
|
+
options.npmVersion = (0, _getNpmVersion.getNpmVersion)();
|
45
|
+
options.cwd = (0, _getCWD.getCWD)();
|
46
|
+
options.packageVersion = process.env.npm_package_version;
|
47
|
+
options.extraArgs = process.argv.slice(3); // eslint-disable-next-line prefer-destructuring
|
48
|
+
|
49
|
+
options.commandOption = process.argv[2];
|
50
|
+
global.reactCLIOptions = options; // console.log({ options });
|
51
|
+
|
52
|
+
return options;
|
53
|
+
};
|
54
|
+
|
55
|
+
exports.getOptions = getOptions;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.readOptionsForPackageJson = readOptionsForPackageJson;
|
7
|
+
|
8
|
+
var _fs = require("fs");
|
9
|
+
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
12
|
+
var _constants = require("../constants");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
// import { CONFIG_ROOT } from "../constants";
|
17
|
+
function readOptionsForPackageJson(appPath) {
|
18
|
+
const packagePath = _path.default.join(appPath, "package.json");
|
19
|
+
|
20
|
+
if ((0, _fs.existsSync)(packagePath)) {
|
21
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require
|
22
|
+
return require(packagePath)[_constants.BASE_CONFIG_KEY] || {};
|
23
|
+
}
|
24
|
+
|
25
|
+
return {};
|
26
|
+
}
|
@@ -0,0 +1,152 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getOptions = void 0;
|
7
|
+
|
8
|
+
var _child_process = require("child_process");
|
9
|
+
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
11
|
+
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
13
|
+
|
14
|
+
var _defaultConfigValues = _interopRequireDefault(require("./defaultConfigValues.js"));
|
15
|
+
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
+
|
18
|
+
// import { argv } from 'process';
|
19
|
+
const args = process.argv.slice(2); // console.log('argv', argv);
|
20
|
+
|
21
|
+
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
22
|
+
// if user use react-cli stritly without using npm scripts options won't work,
|
23
|
+
// So we have to write our own option parse logic or some other library
|
24
|
+
// console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
|
25
|
+
// console.log('Object.keys(process.env).filter(s => s.startsWith(\'npm_config_\') && s.includes(\'clone\')', Object.keys(process.env).filter(s => s.startsWith('npm_config_') && s.includes('clone')));
|
26
|
+
// // clone:type
|
27
|
+
|
28
|
+
const processEnv = {};
|
29
|
+
let keysWithColon = [];
|
30
|
+
Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEach(key => {
|
31
|
+
let nkey = key.slice(NPM_CONFIG_PREFIX.length);
|
32
|
+
processEnv[nkey] = process.env[key];
|
33
|
+
nkey.includes(':') && keysWithColon.push(nkey);
|
34
|
+
});
|
35
|
+
keysWithColon.forEach(key => {
|
36
|
+
let nkey = key.replace(/:/g, '_');
|
37
|
+
|
38
|
+
if (processEnv[nkey]) {
|
39
|
+
throw Error('there is some options conflict', key, nkey);
|
40
|
+
}
|
41
|
+
|
42
|
+
processEnv[nkey] = processEnv[key];
|
43
|
+
});
|
44
|
+
|
45
|
+
function getNpmVersion() {
|
46
|
+
// require("child_process").
|
47
|
+
let vers = '6';
|
48
|
+
|
49
|
+
try {
|
50
|
+
[vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
|
51
|
+
} catch (error) {
|
52
|
+
console.log(error);
|
53
|
+
}
|
54
|
+
|
55
|
+
return vers;
|
56
|
+
}
|
57
|
+
|
58
|
+
function getCWD() {
|
59
|
+
// require("child_process").
|
60
|
+
let cwd = process.cwd();
|
61
|
+
|
62
|
+
try {
|
63
|
+
let ress = (0, _child_process.execSync)('npm bin').toString();
|
64
|
+
let i = ress.lastIndexOf('node_modules');
|
65
|
+
cwd = i === -1 ? cwd : ress.slice(0, i);
|
66
|
+
} catch (error) {
|
67
|
+
console.log(error);
|
68
|
+
}
|
69
|
+
|
70
|
+
return cwd;
|
71
|
+
} // experimental argumnet parsing logic
|
72
|
+
|
73
|
+
|
74
|
+
args.forEach(option => {
|
75
|
+
if (/^--./.test(option)) {
|
76
|
+
let equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
|
77
|
+
|
78
|
+
let key = option.slice(2, equIndex);
|
79
|
+
let value = option.slice(equIndex + 1);
|
80
|
+
|
81
|
+
if (equIndex === -1) {
|
82
|
+
key = option.slice(2);
|
83
|
+
value = true;
|
84
|
+
}
|
85
|
+
|
86
|
+
key = key.replace(/-|:/g, '_');
|
87
|
+
processEnv[key] = value;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
let defaulter = (target, source) => {
|
92
|
+
let defaultObject = {};
|
93
|
+
Object.keys(target).forEach(key => {
|
94
|
+
let data = target[key];
|
95
|
+
|
96
|
+
if (data && typeof data === 'object') {
|
97
|
+
if (Array.isArray(data)) {
|
98
|
+
defaultObject[key] = source[key] || data;
|
99
|
+
} else if (typeof data.cli === 'string') {
|
100
|
+
let cliData;
|
101
|
+
|
102
|
+
if (typeof processEnv[data.cli] === 'string') {
|
103
|
+
cliData = processEnv[data.cli];
|
104
|
+
} else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
|
105
|
+
cliData = processEnv[data.cli.toLowerCase()];
|
106
|
+
} else {
|
107
|
+
cliData = source && source[key] || data.value;
|
108
|
+
}
|
109
|
+
|
110
|
+
if (typeof data.value === 'boolean') {
|
111
|
+
cliData = cliData === 'true' || cliData === true ? true : cliData === 'false' || cliData === false || cliData === '' ? false : data.value;
|
112
|
+
}
|
113
|
+
|
114
|
+
defaultObject[key] = cliData;
|
115
|
+
} else {
|
116
|
+
defaultObject[key] = defaulter(data, source && source[key] ? source[key] : Array.isArray(target[key]) ? [] : {});
|
117
|
+
}
|
118
|
+
} else {
|
119
|
+
defaultObject[key] = typeof source === 'object' && source[key] !== null && typeof source[key] !== 'undefined' ? source[key] : target[key];
|
120
|
+
}
|
121
|
+
});
|
122
|
+
return defaultObject;
|
123
|
+
};
|
124
|
+
|
125
|
+
global.reactCLIOptions = null;
|
126
|
+
|
127
|
+
const getOptions = () => {
|
128
|
+
if (global.reactCLIOptions) {
|
129
|
+
return global.reactCLIOptions;
|
130
|
+
}
|
131
|
+
|
132
|
+
let appPath = process.cwd();
|
133
|
+
let userSchemas;
|
134
|
+
|
135
|
+
let packagePath = _path.default.join(appPath, 'package.json');
|
136
|
+
|
137
|
+
if (_fs.default.existsSync(packagePath)) {
|
138
|
+
userSchemas = require(packagePath)['react-cli'] || {};
|
139
|
+
}
|
140
|
+
|
141
|
+
let options = defaulter(_defaultConfigValues.default, userSchemas || {}); // for future may be for npm 8 edge cases
|
142
|
+
|
143
|
+
options.npmVersion = getNpmVersion();
|
144
|
+
options.cwd = getCWD();
|
145
|
+
options.packageVersion = process.env.npm_package_version;
|
146
|
+
options.extraArgs = process.argv.slice(3);
|
147
|
+
options.commandOption = process.argv[2];
|
148
|
+
global.reactCLIOptions = options;
|
149
|
+
return options;
|
150
|
+
};
|
151
|
+
|
152
|
+
exports.getOptions = getOptions;
|