Nuxt/scripts/dev

29 lines
707 B
Plaintext
Raw Normal View History

#!/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)
})