1 | #!/usr/bin/env node
|
2 |
|
3 | const { compiler } = require('./dist/common.js')
|
4 | const args = process.argv.slice(2)
|
5 |
|
6 | const commands = [
|
7 | 'development',
|
8 | 'production',
|
9 | 'debug',
|
10 | ]
|
11 |
|
12 |
|
13 | const scriptIndex = args.findIndex(
|
14 | x => commands.includes(x)
|
15 | )
|
16 |
|
17 |
|
18 | const script = scriptIndex === -1 ? args[0] : args[scriptIndex]
|
19 |
|
20 | switch (script) {
|
21 | case 'development':
|
22 | compiler('development')
|
23 | break
|
24 | case 'production':
|
25 | compiler('production')
|
26 | break
|
27 | case 'debug':
|
28 | compiler('debug')
|
29 | break
|
30 | default:
|
31 | console.log('Unknown command "' + script + '"')
|
32 | console.log('Available commands are:')
|
33 | commands.map(c => { console.log(c) })
|
34 | break
|
35 | }
|