mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
29 lines
707 B
Plaintext
29 lines
707 B
Plaintext
|
#!/usr/bin/env node -r esm
|
||
|
import path from 'path'
|
||
|
import fs from 'fs-extra'
|
||
|
import consola from 'consola'
|
||
|
|
||
|
import Package from './package.js'
|
||
|
|
||
|
async function main() {
|
||
|
// Read package at current directory
|
||
|
const rootPackage = new Package()
|
||
|
const workspacePackages = rootPackage.getWorkspacePackages()
|
||
|
|
||
|
// Create a dev-only entrypoint to the src
|
||
|
for (const pkg of workspacePackages) {
|
||
|
if (!pkg.pkg.main) {
|
||
|
continue
|
||
|
}
|
||
|
consola.info(pkg.pkg.main)
|
||
|
const distMain = pkg.resolvePath(pkg.pkg.main)
|
||
|
await fs.mkdirp(path.dirname(distMain))
|
||
|
await fs.writeFile(distMain, `export * from '../src/index'`)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
main().catch((error) => {
|
||
|
consola.error(error)
|
||
|
process.exit(1)
|
||
|
})
|