mirror of https://github.com/vuejs/vitepress
parent
fac49e8dbb
commit
ba8de9fba7
@ -1,4 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
require('../dist').createServer().listen(3000, () => {
|
||||
console.log('listening at http://localhost:3000')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const argv = require('minimist')(process.argv.slice(2))
|
||||
|
||||
console.log(chalk.cyan(`vitepress v${require('../package.json').version}`))
|
||||
|
||||
const command = argv._[0]
|
||||
|
||||
if (!command || command === 'dev') {
|
||||
const port = argv.port || 3000
|
||||
const root = command === 'dev' && argv._[1]
|
||||
if (root) {
|
||||
argv.root = root
|
||||
}
|
||||
require('../dist').createServer(argv).listen(port, () => {
|
||||
console.log(`listening at http://localhost:${port}`)
|
||||
})
|
||||
} else if (command === 'build') {
|
||||
require('../dist').build(argv).catch(err => {
|
||||
console.error(`build error: `, err)
|
||||
})
|
||||
} else {
|
||||
console.log(chalk.red(`unknown command "${command}".`))
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
import { buildClient } from './buildClient'
|
||||
import { BuildOptions } from 'vite'
|
||||
|
||||
export async function build(options: BuildOptions = {}) {
|
||||
await buildClient(options)
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import { build, BuildOptions } from 'vite'
|
||||
|
||||
export async function buildClient(options: BuildOptions) {
|
||||
await build({
|
||||
...options,
|
||||
cdn: false
|
||||
})
|
||||
}
|
@ -1 +1,2 @@
|
||||
export * from './server/server'
|
||||
export * from './build/build'
|
||||
|
Loading…
Reference in new issue