diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66f0f972..a286fb35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,4 +50,4 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} build_script: size - files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/size-check.global.prod.js + files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/index.js diff --git a/package.json b/package.json index 50fa4420..bce3fff9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "scripts": { "dev": "node scripts/dev.js", "build": "node scripts/build.js", - "size": "node scripts/build.js vue runtime-dom size-check -p -f global", + "size": "run-s size-global size-baseline", + "size-global": "node scripts/build.js vue runtime-dom -f global -p", + "size-baseline": "node scripts/build.js vue runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build", "lint": "eslint --ext .ts packages/*/src/**.ts", "format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"", "test": "node scripts/build.js vue -f global -d && jest --runInBand", @@ -15,8 +17,8 @@ "test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json", "release": "node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve", - "dev-sfc": "npm-run-all --parallel \"dev compiler-sfc -f esm-browser\" \"dev runtime-core -f esm-bundler\" \"dev runtime-dom -f esm-bundler\" serve-sfc-playground", + "dev-compiler": "run-p \"dev template-explorer\" serve", + "dev-sfc": "run-p \"dev compiler-sfc -f esm-browser\" \"dev runtime-core -f esm-bundler\" \"dev runtime-dom -f esm-bundler\" serve-sfc-playground", "serve-sfc-playground": "vite packages/sfc-playground --host", "serve": "serve", "open": "open http://localhost:5000/packages/template-explorer/local.html", diff --git a/packages/size-check/package.json b/packages/size-check/package.json index fec38474..d7b30f70 100644 --- a/packages/size-check/package.json +++ b/packages/size-check/package.json @@ -2,10 +2,10 @@ "name": "@vue/size-check", "version": "3.2.16", "private": true, - "buildOptions": { - "name": "Vue", - "formats": [ - "global" - ] + "scripts": { + "build": "vite build" + }, + "devDependencies": { + "vite": "^2.5.10" } } diff --git a/packages/size-check/src/index.ts b/packages/size-check/src/index.ts index 3c9d23c2..ad3b68a5 100644 --- a/packages/size-check/src/index.ts +++ b/packages/size-check/src/index.ts @@ -1,4 +1,4 @@ -import { h, createApp } from '@vue/runtime-dom' +import { h, createApp } from 'vue' // The bare minimum code required for rendering something to the screen createApp({ diff --git a/packages/size-check/vite.config.js b/packages/size-check/vite.config.js new file mode 100644 index 00000000..a14a91c2 --- /dev/null +++ b/packages/size-check/vite.config.js @@ -0,0 +1,10 @@ +export default { + build: { + rollupOptions: { + input: ['src/index.ts'], + output: { + entryFileNames: `[name].js` + } + } + } +} diff --git a/scripts/build.js b/scripts/build.js index 9b5e37bf..7f002950 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -155,7 +155,7 @@ async function build(target) { } function checkAllSizes(targets) { - if (devOnly) { + if (devOnly || (formats && !formats.includes('global'))) { return } console.log() @@ -168,7 +168,9 @@ function checkAllSizes(targets) { function checkSize(target) { const pkgDir = path.resolve(`packages/${target}`) checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`) - checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`) + if (!formats || formats.includes('global-runtime')) { + checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`) + } } function checkFileSize(filePath) {