-
Notifications
You must be signed in to change notification settings - Fork 355
/
config.ts
84 lines (79 loc) · 1.93 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import convict from "convict";
import { LOCALES } from "../common/helpers/i18n/locales";
const config = convict({
env: {
doc: "The application environment.",
format: ["production", "development", "test"],
default: "development",
env: "NODE_ENV",
},
port: {
doc: "The port the server is bound to",
format: "port",
default: 3000,
env: "PORT",
arg: "port",
},
dev_port: {
doc: "The port to bind for the Webpack Dev Server.",
format: "port",
default: 8080,
env: "DEV_PORT",
arg: "dev-port",
},
defaultLocale: {
doc: "Specify the default locale to use",
format: LOCALES,
default: "en-US",
env: "LOCALE",
},
generateReport: {
doc: "Generate a report using webpack-bundle-analyzer",
format: Boolean,
default: false,
env: "WEBPACK_REPORT",
arg: "generateReport",
},
disableSourcemaps: {
doc: "Disable sourcemaps generation",
format: Boolean,
default: false,
env: "WEBPACK_DISABLE_SOURCEMAPS",
arg: "disableSourceMaps",
},
disableMinimize: {
doc: "Disable minimization in production",
format: Boolean,
default: false,
env: "WEBPACK_DISABLE_MINIMIZE",
arg: "disableMinimize",
},
disableChunkSplitting: {
doc: "Disables chunk splitting beheviour",
format: Boolean,
default: false,
env: "WEBPACK_DISABLE_CHUNK_SPLITTING",
arg: "disableChunkSplitting",
},
enableTreeShake: {
doc: "Enabled tree shaking in development",
format: Boolean,
default: false,
env: "WEBPACK_TREESHAKE",
arg: "enableTreeShake",
},
maxCores: {
doc: "Set maximum of available cores",
format: "nat",
default: require("os").cpus().length,
env: "WEBPACK_MAX_CORES",
arg: "maxCores",
},
});
export type Config = typeof config;
export const createClientEnv = (c: Config) => ({
NODE_ENV: c.get("env"),
WEBPACK: "true",
});
// Setup the base configuration.
export default config;