1 Star 0 Fork 476

辅助线/vue-ele-form-generator

forked from 张超杰/f-render 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
start.js 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
张超杰 提交于 2020-01-30 23:21 . chore: 提示更新命令加yarn
const exec = require('child_process').exec
const program = require('commander')
const handler = require('serve-handler')
const http = require('http')
const path = require('path')
const chalk = require('chalk')
const spawn = require('child_process').spawn
const updateNotifier = require('update-notifier')
const pkg = require('./package.json')
// 检查更新
function updateCheck () {
const notifier = updateNotifier({ pkg })
const message = []
if (notifier.update) {
message.push('Update available: ' + chalk.green.bold(notifier.update.latest) + chalk.gray(' (current: ' + notifier.update.current + ');'))
message.push('Run ' + chalk.magenta('npm install -g ' + pkg.name) + ' Or ' + chalk.magenta('yarn global add ' + pkg.name) + ' to update.')
console.log(message.join('\r\n'))
}
}
updateCheck()
const openURL = function (url) {
switch (process.platform) {
case 'darwin':
exec('open ' + url)
break
case 'win32':
exec('start ' + url)
break
default:
spawn('xdg-open', [url])
}
}
const server = http.createServer((request, response) => {
return handler(request, response, {
public: path.resolve(__dirname, './dist')
})
})
program
.version(`fgen ${pkg.version}`)
.usage('<command> [options]')
program
.option('-p, --port <port>', 'Port used by the server', 54321)
program.parse(process.argv)
server.listen(program.port, () => {
console.log(`Running at http://localhost:${program.port}`)
openURL(`http://localhost:${program.port}`)
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/fuzhuxian2018/vue-ele-form-generator.git
git@gitee.com:fuzhuxian2018/vue-ele-form-generator.git
fuzhuxian2018
vue-ele-form-generator
vue-ele-form-generator
master

搜索帮助