workflow: basic template explorer
This commit is contained in:
13
scripts/bootstrap.js
vendored
13
scripts/bootstrap.js
vendored
@@ -9,16 +9,21 @@ const packagesDir = path.resolve(__dirname, '../packages')
|
||||
const files = fs.readdirSync(packagesDir)
|
||||
|
||||
files.forEach(shortName => {
|
||||
if (shortName === 'shared') {
|
||||
return
|
||||
}
|
||||
if (!fs.statSync(path.join(packagesDir, shortName)).isDirectory()) {
|
||||
return
|
||||
}
|
||||
|
||||
const name = shortName === `vue` ? shortName : `@vue/${shortName}`
|
||||
const pkgPath = path.join(packagesDir, shortName, `package.json`)
|
||||
if (args.force || !fs.existsSync(pkgPath)) {
|
||||
const pkgExists = fs.existsSync(pkgPath)
|
||||
if (pkgExists) {
|
||||
const pkg = require(pkgPath)
|
||||
if (pkg.private) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (args.force || !pkgExists) {
|
||||
const json = {
|
||||
name,
|
||||
version: baseVersion,
|
||||
|
||||
@@ -51,12 +51,16 @@ async function build(target) {
|
||||
|
||||
await fs.remove(`${pkgDir}/dist`)
|
||||
|
||||
const env =
|
||||
(pkg.buildOptions && pkg.buildOptions.env) ||
|
||||
(devOnly ? 'development' : 'production')
|
||||
|
||||
await execa(
|
||||
'rollup',
|
||||
[
|
||||
'-c',
|
||||
'--environment',
|
||||
`NODE_ENV:${devOnly ? 'development' : 'production'},` +
|
||||
`NODE_ENV:${env},` +
|
||||
`TARGET:${target}` +
|
||||
(formats ? `,FORMATS:${formats}` : ``) +
|
||||
(args.types ? `,TYPES:true` : ``) +
|
||||
|
||||
@@ -5,7 +5,7 @@ const targets = (exports.targets = fs.readdirSync('packages').filter(f => {
|
||||
return false
|
||||
}
|
||||
const pkg = require(`../packages/${f}/package.json`)
|
||||
if (pkg.private) {
|
||||
if (pkg.private && !pkg.buildOptions) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -26,6 +26,6 @@ exports.fuzzyMatchTarget = (partialTargets, includeAllMatching) => {
|
||||
if (matched.length) {
|
||||
return matched
|
||||
} else {
|
||||
throw new Error(`Target ${partialTarget} not found!`)
|
||||
throw new Error(`Target ${partialTargets} not found!`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user