mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-24 09:28:41 +00:00
add link script
This commit is contained in:
parent
74e592059d
commit
e161d70a4f
25
scripts/link.js
Normal file
25
scripts/link.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const consola = require('consola')
|
||||||
|
const execa = require('execa')
|
||||||
|
const fs = require('fs-extra')
|
||||||
|
const glob = require('pify')(require('glob').glob)
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const packageDirs = await glob('+(packages|distributions)/*')
|
||||||
|
|
||||||
|
const packages = packageDirs.map(pkgDir => ({
|
||||||
|
dir: pkgDir,
|
||||||
|
pkg: fs.readJSONSync(path.join(pkgDir, 'package.json'))
|
||||||
|
}))
|
||||||
|
|
||||||
|
const packageNames = packages.map(p => p.pkg.name).join(' ')
|
||||||
|
|
||||||
|
consola.info(`Linking ${packages.length} packages...`)
|
||||||
|
|
||||||
|
await Promise.all(packages.map(pkg => execa('yarn', ['link'], { cwd: pkg.dir })))
|
||||||
|
|
||||||
|
consola.log(`Link: \nyarn link ${packageNames}\n`)
|
||||||
|
consola.log(`Unlink: \nyarn unlink ${packageNames}\n`)
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(consola.error)
|
Loading…
Reference in New Issue
Block a user