Skip to content

Commit 7a24993

Browse files
committed
add size checking
1 parent cb83716 commit 7a24993

File tree

6 files changed

+81
-6
lines changed

6 files changed

+81
-6
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
CI: true
1919

2020
jobs:
21-
test:
21+
lint:
2222
name: 'Lint on Node.js ${{ matrix.node }} OS: ${{matrix.os}}'
2323
runs-on: ${{ matrix.os }}
2424
strategy:

.github/workflows/size.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Size
2+
on:
3+
push:
4+
branches-ignore:
5+
- gh-pages
6+
- releases/**
7+
pull_request:
8+
branches-ignore:
9+
- gh-pages
10+
- releases/**
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
permissions:
16+
contents: read
17+
env:
18+
CI: true
19+
20+
jobs:
21+
size:
22+
name: 'Size check on Node.js ${{ matrix.node }} OS: ${{matrix.os}}'
23+
runs-on: ${{ matrix.os }}
24+
env:
25+
CI_JOB_NUMBER: 1
26+
strategy:
27+
matrix:
28+
os: [ubuntu-latest]
29+
node: [14]
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
- name: Setup Node.js ${{ matrix.node }}
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: ${{ matrix.node }}
37+
cache: 'yarn'
38+
- name: Install
39+
run: yarn install
40+
- name: Build packages
41+
run: yarn build
42+
- name: Check build size
43+
uses: posva/[email protected]
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
build_script: build:size
47+
files: packages/vue-i18n/dist/vue-i18n.global.prod.js packages/vue-i18n/dist/vue-i18n.runtime.global.prod.js packages/petite-vue-i18n/dist/petite-vue-i18n.global.prod.js packages/petite-vue-i18n/dist/petite-vue-i18n.runtime.prod.js packages/size-check-vue-i18n/dist/assets/index.js packages/size-check-petite-vue-i18n/dist/assets/index.js

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"benchmark": "node ./benchmark/index.js",
1818
"build": "node -r esbuild-register scripts/build.ts",
1919
"build:size": "npm-run-all --parallel build:size-*",
20-
"build:size-core": "cd packages/size-check-core && yarn build --minify false",
21-
"build:size-petite-vue-i18n": "cd packages/size-check-petite-vue-i18n && yarn build --minify false",
22-
"build:size-vue-i18n": "cd packages/size-check-vue-i18n && yarn build --minify false",
20+
"build:size-core": "cd packages/size-check-core && yarn build",
21+
"build:size-petite-vue-i18n": "cd packages/size-check-petite-vue-i18n && yarn build",
22+
"build:size-vue-i18n": "cd packages/size-check-vue-i18n && yarn build",
2323
"build:sourcemap": "yarn build --sourcemap",
2424
"build:type": "yarn build --types && tail -n +32 ./packages/vue-i18n/src/vue.d.ts >> ./packages/vue-i18n/dist/vue-i18n.d.ts && tail -n +32 ./packages/petite-vue-i18n/src/vue.d.ts >> ./packages/petite-vue-i18n/dist/petite-vue-i18n.d.ts",
2525
"build:typed": "yarn build core-base vue-i18n-core --types",

packages/size-check-core/vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,14 @@ export default defineConfig({
1616
'process.env.NODE_ENV': JSON.stringify('production'),
1717
__INTLIFY_PROD_DEVTOOLS__: false
1818
},
19+
build: {
20+
rollupOptions: {
21+
output: {
22+
entryFileNames: `assets/[name].js`,
23+
chunkFileNames: `assets/[name].js`,
24+
assetFileNames: `assets/[name].[ext]`
25+
}
26+
}
27+
},
1928
plugins: []
2029
})

packages/size-check-petite-vue-i18n/vite.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ export default defineConfig({
2323
},
2424
resolve: {
2525
alias: {
26-
'vue-i18n': 'petite-vue-i18n/dist/petite-vue-i18n.runtime.esm-bundler.js'
26+
'vue-i18n':
27+
'../petite-vue-i18n/dist/petite-vue-i18n.runtime.esm-bundler.js'
28+
}
29+
},
30+
build: {
31+
rollupOptions: {
32+
output: {
33+
entryFileNames: `assets/[name].js`,
34+
chunkFileNames: `assets/[name].js`,
35+
assetFileNames: `assets/[name].[ext]`
36+
}
2737
}
2838
},
2939
plugins: [vue()]

packages/size-check-vue-i18n/vite.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ export default defineConfig({
2323
},
2424
resolve: {
2525
alias: {
26-
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
26+
'vue-i18n': '../vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
27+
}
28+
},
29+
build: {
30+
rollupOptions: {
31+
output: {
32+
entryFileNames: `assets/[name].js`,
33+
chunkFileNames: `assets/[name].js`,
34+
assetFileNames: `assets/[name].[ext]`
35+
}
2736
}
2837
},
2938
plugins: [vue()]

0 commit comments

Comments
 (0)