workflow: basic template explorer

This commit is contained in:
Evan You
2019-10-04 13:08:06 -04:00
parent 4d2fa51347
commit 5047bc8dbe
12 changed files with 188 additions and 12 deletions

13
scripts/bootstrap.js vendored
View File

@@ -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,

View File

@@ -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` : ``) +

View File

@@ -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!`)
}
}