Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use size-limit to track gzip size of the van #163

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
950 changes: 950 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
},
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "(cd ./src; ./publish.sh) && npm run test:size",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change it to build? The command doesn't run any browser-based tests. Thus the name test could be misleading.

"test:size": "size-limit"
},
"keywords": [
"Van",
Expand All @@ -35,9 +36,11 @@
"author": "Tao Xin",
"license": "MIT",
"devDependencies": {
"@size-limit/preset-small-lib": "^9.0.0",
"all-contributors-cli": "^6.26.1",
"esbuild": "^0.17.12",
"node-jq": "^2.3.5",
"size-limit": "^9.0.0",
"terser": "^5.22.0",
"typescript": "^5.1.6"
},
Expand All @@ -49,5 +52,12 @@
"url": "https://github.com/vanjs-org/van/issues",
"email": "[email protected]"
},
"homepage": "https://vanjs.org"
"homepage": "https://vanjs.org",
"size-limit": [
{
"name": "Van",
"path": "public/van-latest.min.js",
"limit": "962 B"
}
]
}
2 changes: 1 addition & 1 deletion public/van-1.2.5.debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import van from "./van-1.2.5.js"
import van from "./van.js"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is a bug?


// If this variable is set to an Array, we will push the error message into the array instead of
// throwing an error. This is useful in testing, to capture the error occurred asynchronous to the initiating
Expand Down
1 change: 1 addition & 0 deletions public/van-1.2.5.nomodule.debug.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused the change here?

(() => {
// van.js
var Obj = Object;
Expand Down
1 change: 1 addition & 0 deletions public/van-1.2.5.nomodule.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
(() => {
// van.js
var Obj = Object;
Expand Down
2 changes: 1 addition & 1 deletion public/van-1.2.5.nomodule.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/van-latest.nomodule.debug.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
(() => {
// van.js
var Obj = Object;
Expand Down
1 change: 1 addition & 0 deletions public/van-latest.nomodule.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
(() => {
// van.js
var Obj = Object;
Expand Down
2 changes: 1 addition & 1 deletion public/van-latest.nomodule.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ cp ../public/van-$VER.nomodule.js ../public/van-latest.nomodule.js
cp ../public/van-$VER.nomodule.min.js ../public/van-latest.nomodule.min.js
cp ../public/van-$VER.nomodule.debug.js ../public/van-latest.nomodule.debug.js

sed -i .bak s/van\\.js/van-$VER\\.js/ ../public/van-$VER.debug.js
sed -i .bak s/van\\.js/van-latest\\.js/ ../public/van-latest.debug.js
sed -i='.bak' 's/van\\.js/van-$VER\\.js/' ../public/van-$VER.debug.js
sed -i='.bak' s/van\\.js/van-latest\\.js/ ../public/van-latest.debug.js

rm ../demo/terminal/van-*.min.js
cp ../public/van-$VER.min.js ../demo/terminal/

rm ../public/*.bak

# Testing
npx tsc -m es2020 -t es2017 ../test/van.test.ts
(cd ../test; tsc)
npx esbuild ../test/van.test.forbundle.js --bundle --banner:js="'use strict';" --outfile=../test/van.test.nomodule.js
10 changes: 10 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "es2020",
"target": "es2017",
"skipLibCheck": true
},
"files": [
"./van.test.ts"
]
}