build: adjust esm formats

This commit is contained in:
Evan You
2019-12-10 22:14:02 -05:00
parent 8ed04ed503
commit 136ab753b3
11 changed files with 35 additions and 22 deletions

View File

@@ -27,7 +27,8 @@ const targets = args._
const formats = args.formats || args.f
const devOnly = args.devOnly || args.d
const prodOnly = !devOnly && (args.prodOnly || args.p)
const buildTypes = args.t || args.types
const isRelease = args.release
const buildTypes = args.t || args.types || isRelease
const buildAllMatching = args.all || args.a
const lean = args.lean || args.l
const commit = execa.sync('git', ['rev-parse', 'HEAD']).stdout.slice(0, 7)
@@ -54,6 +55,11 @@ async function build(target) {
const pkgDir = path.resolve(`packages/${target}`)
const pkg = require(`${pkgDir}/package.json`)
// only build published packages for release
if (isRelease && pkg.private) {
return
}
// if building a specific format, do not remove dist.
if (!formats) {
await fs.remove(`${pkgDir}/dist`)