build: add vue package

This commit is contained in:
Evan You 2018-10-23 11:58:37 -04:00
parent f57ca5e189
commit 0857d96438
10 changed files with 55 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "vue-compat", "name": "vue-compat",
"version": "3.0.0-alpha.1", "version": "3.0.0-alpha.1",
"description": "vue", "description": "Vue 2.x compat build",
"main": "index.js", "main": "index.js",
"module": "dist/vue.esm-bundler.js", "module": "dist/vue.esm-bundler.js",
"unpkg": "dist/vue.global.js", "unpkg": "dist/vue.global.js",

3
packages/vue/.npmignore Normal file
View File

@ -0,0 +1,3 @@
__tests__/
__mocks__/
dist/packages

1
packages/vue/README.md Normal file
View File

@ -0,0 +1 @@
# vue

7
packages/vue/index.js Normal file
View File

@ -0,0 +1,7 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/vue.cjs.prod.js')
} else {
module.exports = require('./dist/vue.cjs.js')
}

29
packages/vue/package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "vue",
"version": "3.0.0-alpha.1",
"description": "vue",
"main": "index.js",
"module": "dist/vue.esm-bundler.js",
"types": "dist/index.d.ts",
"unpkg": "dist/vue.global.js",
"buildOptions": {
"name": "Vue",
"formats": ["esm", "cjs", "global", "esm-browser"]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue.git"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue/issues"
},
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue#readme",
"dependencies": {
"@vue/renderer-dom": "3.0.0-alpha.1"
}
}

View File

@ -0,0 +1,3 @@
// TODO this package will be the "full-build" that includes both the runtime
// and the compiler
export * from '@vue/renderer-dom'

View File

@ -19,7 +19,7 @@ const packageOptions = pkg.buildOptions || {}
const aliasOptions = { resolve: ['.ts'] } const aliasOptions = { resolve: ['.ts'] }
fs.readdirSync(packagesDir).forEach(dir => { fs.readdirSync(packagesDir).forEach(dir => {
if ( if (
dir !== 'vue' && !dir.startsWith('vue') &&
fs.statSync(path.resolve(packagesDir, dir)).isDirectory() fs.statSync(path.resolve(packagesDir, dir)).isDirectory()
) { ) {
aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`) aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`)

View File

@ -9,6 +9,9 @@ const packagesDir = path.resolve(__dirname, '../packages')
const files = fs.readdirSync(packagesDir) const files = fs.readdirSync(packagesDir)
files.forEach(shortName => { files.forEach(shortName => {
if (shortName === 'shared') {
return
}
if (!fs.statSync(path.join(packagesDir, shortName)).isDirectory()) { if (!fs.statSync(path.join(packagesDir, shortName)).isDirectory()) {
return return
} }

View File

@ -25,13 +25,14 @@ const { targets, fuzzyMatchTarget } = require('./utils')
const args = require('minimist')(process.argv.slice(2)) const args = require('minimist')(process.argv.slice(2))
const target = args._[0] const target = args._[0]
const formats = args.formats || args.f const formats = args.formats || args.f
const buildAllMatching = args.all || args.a
;(async () => { ;(async () => {
if (!target) { if (!target) {
await buildAll(targets) await buildAll(targets)
checkAllSizes(targets) checkAllSizes(targets)
} else { } else {
await buildAll(fuzzyMatchTarget(target)) await buildAll(fuzzyMatchTarget(target, buildAllMatching))
checkAllSizes(fuzzyMatchTarget(target)) checkAllSizes(fuzzyMatchTarget(target, buildAllMatching))
} }
})() })()

View File

@ -11,11 +11,14 @@ const targets = (exports.targets = fs.readdirSync('packages').filter(f => {
return true return true
})) }))
exports.fuzzyMatchTarget = partialTarget => { exports.fuzzyMatchTarget = (partialTarget, includeAllMatching) => {
const matched = [] const matched = []
for (const target of targets) { for (const target of targets) {
if (target.match(partialTarget)) { if (target.match(partialTarget)) {
matched.push(target) matched.push(target)
if (!includeAllMatching) {
return matched
}
} }
} }
if (matched.length) { if (matched.length) {