-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathbuild.js
62 lines (57 loc) · 1.51 KB
/
build.js
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
import terminalLink from 'terminal-link'
import { sides } from '../lib/project'
import { checkNodeVersion } from '../middleware/checkNodeVersion'
export const command = 'build [side..]'
export const description = 'Build for production'
export const builder = (yargs) => {
const choices = sides()
yargs
.positional('side', {
choices,
default: choices,
description: 'Which side(s) to build',
type: 'array',
})
.option('stats', {
default: false,
description: `Use ${terminalLink(
'Webpack Bundle Analyzer',
'https://github.com/webpack-contrib/webpack-bundle-analyzer'
)}`,
type: 'boolean',
})
.option('verbose', {
alias: 'v',
default: false,
description: 'Print more',
type: 'boolean',
})
.option('prerender', {
default: true,
description: 'Prerender after building web',
type: 'boolean',
})
.option('prisma', {
type: 'boolean',
alias: 'db',
default: true,
description: 'Generate the Prisma client',
})
.option('performance', {
alias: 'perf',
type: 'boolean',
default: false,
description: 'Measure build performance',
})
.middleware(checkNodeVersion)
.epilogue(
`Also see the ${terminalLink(
'Redwood CLI Reference',
'https://redwoodjs.com/docs/cli-commands#build'
)}`
)
}
export const handler = async (options) => {
const { handler } = await import('./buildHandler.js')
return handler(options)
}