mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
29 lines
707 B
JavaScript
Executable File
29 lines
707 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) {
|
|
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)
|
|
})
|