forked from alineacms/alinea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.js
31 lines (29 loc) · 904 Bytes
/
dev.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
import {ensureEnv} from 'alinea/cli/util/EnsureEnv'
import {forwardCommand} from 'alinea/cli/util/ForwardCommand'
import path from 'node:path'
import sade from 'sade'
async function run({production, dir, config}) {
ensureEnv(dir)
const forceProduction = process.env.ALINEA_CLOUD_URL
process.env.NODE_ENV =
forceProduction || production ? 'production' : 'development'
const {serve} = await import('alinea/cli/Serve')
return serve({
alineaDev: true,
production,
cwd: path.resolve(dir),
configFile: config,
staticDir: path.resolve('src/cli/static'),
port: 4500,
onAfterGenerate: forwardCommand,
buildOptions: {
minify: false
}
})
}
sade('dev', true)
.option('--production', `Run in production mode`)
.option('--dir', `Development directory`, 'apps/web')
.option('--config', `Config file`)
.action(opts => run(opts))
.parse(process.argv)