From 0857d964381a6763b01341acf5a4baf3465d0565 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 23 Oct 2018 11:58:37 -0400 Subject: [PATCH] build: add vue package --- packages/vue-compat/package.json | 2 +- packages/vue/.npmignore | 3 +++ packages/vue/README.md | 1 + packages/vue/index.js | 7 +++++++ packages/vue/package.json | 29 +++++++++++++++++++++++++++++ packages/vue/src/index.ts | 3 +++ rollup.config.js | 2 +- scripts/bootstrap.js | 3 +++ scripts/build.js | 5 +++-- scripts/utils.js | 5 ++++- 10 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 packages/vue/.npmignore create mode 100644 packages/vue/README.md create mode 100644 packages/vue/index.js create mode 100644 packages/vue/package.json create mode 100644 packages/vue/src/index.ts diff --git a/packages/vue-compat/package.json b/packages/vue-compat/package.json index 517d07f44d..58e802bb9d 100644 --- a/packages/vue-compat/package.json +++ b/packages/vue-compat/package.json @@ -1,7 +1,7 @@ { "name": "vue-compat", "version": "3.0.0-alpha.1", - "description": "vue", + "description": "Vue 2.x compat build", "main": "index.js", "module": "dist/vue.esm-bundler.js", "unpkg": "dist/vue.global.js", diff --git a/packages/vue/.npmignore b/packages/vue/.npmignore new file mode 100644 index 0000000000..bb5c8a541b --- /dev/null +++ b/packages/vue/.npmignore @@ -0,0 +1,3 @@ +__tests__/ +__mocks__/ +dist/packages \ No newline at end of file diff --git a/packages/vue/README.md b/packages/vue/README.md new file mode 100644 index 0000000000..9a0fc3e6cf --- /dev/null +++ b/packages/vue/README.md @@ -0,0 +1 @@ +# vue \ No newline at end of file diff --git a/packages/vue/index.js b/packages/vue/index.js new file mode 100644 index 0000000000..7a3dc2d825 --- /dev/null +++ b/packages/vue/index.js @@ -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') +} diff --git a/packages/vue/package.json b/packages/vue/package.json new file mode 100644 index 0000000000..d624af8699 --- /dev/null +++ b/packages/vue/package.json @@ -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" + } +} diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts new file mode 100644 index 0000000000..cda6a7c917 --- /dev/null +++ b/packages/vue/src/index.ts @@ -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' diff --git a/rollup.config.js b/rollup.config.js index 4a31cbb88f..4a24b15d26 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -19,7 +19,7 @@ const packageOptions = pkg.buildOptions || {} const aliasOptions = { resolve: ['.ts'] } fs.readdirSync(packagesDir).forEach(dir => { if ( - dir !== 'vue' && + !dir.startsWith('vue') && fs.statSync(path.resolve(packagesDir, dir)).isDirectory() ) { aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 8ee7e961ec..557b6fc567 100644 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -9,6 +9,9 @@ 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 } diff --git a/scripts/build.js b/scripts/build.js index e65ea810c7..e37746c6c0 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -25,13 +25,14 @@ const { targets, fuzzyMatchTarget } = require('./utils') const args = require('minimist')(process.argv.slice(2)) const target = args._[0] const formats = args.formats || args.f +const buildAllMatching = args.all || args.a ;(async () => { if (!target) { await buildAll(targets) checkAllSizes(targets) } else { - await buildAll(fuzzyMatchTarget(target)) - checkAllSizes(fuzzyMatchTarget(target)) + await buildAll(fuzzyMatchTarget(target, buildAllMatching)) + checkAllSizes(fuzzyMatchTarget(target, buildAllMatching)) } })() diff --git a/scripts/utils.js b/scripts/utils.js index 8aca7cab76..9816d795d7 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -11,11 +11,14 @@ const targets = (exports.targets = fs.readdirSync('packages').filter(f => { return true })) -exports.fuzzyMatchTarget = partialTarget => { +exports.fuzzyMatchTarget = (partialTarget, includeAllMatching) => { const matched = [] for (const target of targets) { if (target.match(partialTarget)) { matched.push(target) + if (!includeAllMatching) { + return matched + } } } if (matched.length) { -- 2.47.3