parent
8f5cc1efb1
commit
50bbe140a9
|
@ -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 <yutent.io@gmail.com>"
|
||||
}
|
||||
}
|
40
update.js
40
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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue