From 50bbe140a904d4be8af190beacbb4d6bb02a7aee Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 16 Feb 2023 00:42:59 +0800 Subject: [PATCH] 4.1.6 --- package.json | 4 ++-- update.js | 40 ++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index c282800..ccb101d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bytedo/vue-router", "description": "vue-router去除`@vue/devtools-api`依赖版", - "version": "1.0.0", + "version": "4.1.6", "type": "module", "scripts": { "start": "node ./update.js" @@ -15,4 +15,4 @@ "vue" ], "author": "Yutent " -} +} \ No newline at end of file diff --git a/update.js b/update.js index 7976bb8..9bfcbf5 100644 --- a/update.js +++ b/update.js @@ -8,6 +8,7 @@ import Es from 'esbuild' import fs from 'iofs' import { resolve } from 'path' import { exec } from 'child_process' +import pkg from './package.json' assert { type: 'json' } const NPM_URL = 'https://registry.npmmirror.com' @@ -28,26 +29,29 @@ export function execAsync(cmd) { } !(async function () { - // let { version, url } = await fetch( - // 'https://registry.npmmirror.com/vue-router', - // { - // headers: { - // 'content-type': 'application/json', - // accept: 'application/json' - // } - // } - // ) - // .then(r => r.json()) - // .then(r => { - // let v = r['dist-tags'].latest - // let url = r.versions[v].dist.tarball - // return { version: v, url } - // }) - // let ab = await download(url) + let { version, url } = await fetch( + 'https://registry.npmmirror.com/vue-router', + { + headers: { + 'content-type': 'application/json', + accept: 'application/json' + } + } + ) + .then(r => r.json()) + .then(r => { + let v = r['dist-tags'].latest + let url = r.versions[v].dist.tarball + return { version: v, url } + }) + let ab = await download(url) - // fs.echo(Buffer.from(ab), './vue-router.tgz') + pkg.version = version - // await execAsync('tar -xzf vue-router.tgz') + fs.echo(JSON.stringify(pkg, null, 2), './package.json') + fs.echo(Buffer.from(ab), './vue-router.tgz') + + await execAsync('tar -xzf vue-router.tgz') let code = fs.cat('package/dist/vue-router.esm-browser.js').toString()