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" },