修复fite的环境判断

pull/1/head
yutent 2023-05-23 18:32:24 +08:00
parent 388465842c
commit 3385c4947a
4 changed files with 8 additions and 8 deletions

View File

@ -18,16 +18,16 @@ const IS_WINDOWS = process.platform === 'win32'
const CONFIG_FILE = normalize(join(WORK_SPACE, 'fite.config.js'))
const PROTOCOL = IS_WINDOWS ? 'file://' : ''
const NODE_VERSION = +process.versions.node.split('.').slice(0, 2).join('.')
const NODE_VERSION = process.versions.node.split('.').map(n => +n)
let args = process.argv.slice(2)
let mode = args.shift() || 'prod'
let clean = args.shift() !== '--no-clean'
if (NODE_VERSION < 16.6) {
console.log(red('Error: 你当前的环境不满足 Vue-live 构建工具的要求'))
if (NODE_VERSION[0] < 16 || (NODE_VERSION[0] === 16 && NODE_VERSION[1] < 6)) {
console.log(red('Error: 你当前的环境不满足 fite 构建工具的要求'))
console.log(
'Vue-live 需要Node.js版本在 %s 以上, \n你当前的Node.js版本为: %s',
'fite 需要Node.js版本在 %s 以上, \n你当前的Node.js版本为: %s',
blue('v16.6.0'),
red(process.version),
'\n\n'

View File

@ -18,14 +18,14 @@ export function friendlyErrors(pathname, ext = '') {
export function createHmrScript(legacy) {
return `
!(function vue_live_hmr(){
var ws = new WebSocket(\`ws\${location.protocol === 'https:' ? 's' : ''}://\${location.host}/ws-vue-live\`)
var ws = new WebSocket(\`ws\${location.protocol === 'https:' ? 's' : ''}://\${location.host}/ws-fite-hmr\`)
ws.addEventListener('open', function (r) {
if(vue_live_hmr.closed){
delete vue_live_hmr.closed
location.reload()
}
console.log('vue-live hmr ready...')
console.log('fite hmr ready...')
})
ws.addEventListener('close', function(){

View File

@ -11,7 +11,7 @@ class WebSocket {
constructor(server) {
if (server.listening) {
let conn = new WebSocketServer({ server, path: '/ws-vue-live' })
let conn = new WebSocketServer({ server, path: '/ws-fite-hmr' })
conn.on('connection', ws => {
this.#ws = ws
// ws.on('message', data => {

View File

@ -1,7 +1,7 @@
{
"name": "fite",
"type": "module",
"version": "1.1.5",
"version": "1.1.6",
"bin": {
"fite": "index.js"
},