ci: improve size script
This commit is contained in:
parent
c1cf26d207
commit
f27a98becc
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -50,4 +50,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: size
|
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
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.js",
|
"dev": "node scripts/dev.js",
|
||||||
"build": "node scripts/build.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",
|
"lint": "eslint --ext .ts packages/*/src/**.ts",
|
||||||
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
|
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
|
||||||
"test": "node scripts/build.js vue -f global -d && jest --runInBand",
|
"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",
|
"test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json",
|
||||||
"release": "node scripts/release.js",
|
"release": "node scripts/release.js",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||||
"dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve",
|
"dev-compiler": "run-p \"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-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-sfc-playground": "vite packages/sfc-playground --host",
|
||||||
"serve": "serve",
|
"serve": "serve",
|
||||||
"open": "open http://localhost:5000/packages/template-explorer/local.html",
|
"open": "open http://localhost:5000/packages/template-explorer/local.html",
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
"name": "@vue/size-check",
|
"name": "@vue/size-check",
|
||||||
"version": "3.2.16",
|
"version": "3.2.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"buildOptions": {
|
"scripts": {
|
||||||
"name": "Vue",
|
"build": "vite build"
|
||||||
"formats": [
|
},
|
||||||
"global"
|
"devDependencies": {
|
||||||
]
|
"vite": "^2.5.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
// The bare minimum code required for rendering something to the screen
|
||||||
createApp({
|
createApp({
|
||||||
|
10
packages/size-check/vite.config.js
Normal file
10
packages/size-check/vite.config.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default {
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
input: ['src/index.ts'],
|
||||||
|
output: {
|
||||||
|
entryFileNames: `[name].js`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -155,7 +155,7 @@ async function build(target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkAllSizes(targets) {
|
function checkAllSizes(targets) {
|
||||||
if (devOnly) {
|
if (devOnly || (formats && !formats.includes('global'))) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log()
|
console.log()
|
||||||
@ -168,8 +168,10 @@ function checkAllSizes(targets) {
|
|||||||
function checkSize(target) {
|
function checkSize(target) {
|
||||||
const pkgDir = path.resolve(`packages/${target}`)
|
const pkgDir = path.resolve(`packages/${target}`)
|
||||||
checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`)
|
checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`)
|
||||||
|
if (!formats || formats.includes('global-runtime')) {
|
||||||
checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`)
|
checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function checkFileSize(filePath) {
|
function checkFileSize(filePath) {
|
||||||
if (!fs.existsSync(filePath)) {
|
if (!fs.existsSync(filePath)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user