mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
29 lines
729 B
JavaScript
Executable File
29 lines
729 B
JavaScript
Executable File
#!/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 || !pkg.options.build) {
|
|
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)
|
|
})
|