From 3385c4947af24bc2f94254f482000ac9042d2287 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 23 May 2023 18:32:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dfite=E7=9A=84=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 8 ++++---- lib/utils.js | 4 ++-- lib/ws.js | 2 +- package.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 25125ed..25e38e5 100755 --- a/index.js +++ b/index.js @@ -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' diff --git a/lib/utils.js b/lib/utils.js index b96ab35..ead7c3a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -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(){ diff --git a/lib/ws.js b/lib/ws.js index 2428a01..a28ff6f 100644 --- a/lib/ws.js +++ b/lib/ws.js @@ -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 => { diff --git a/package.json b/package.json index c94d6bd..55e3205 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fite", "type": "module", - "version": "1.1.5", + "version": "1.1.6", "bin": { "fite": "index.js" },