Skip to content

Commit

Permalink
use size-limit to track gzip size of the van:
Browse files Browse the repository at this point in the history
	devDependencies
		∋ size-limit
		∋ @size-limit/preset-small-lib

publish.sh: fix: build on linux systems
  • Loading branch information
btakita committed Oct 31, 2023
1 parent 701bebd commit db42e63
Show file tree
Hide file tree
Showing 11 changed files with 982 additions and 8 deletions.
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",
"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": "bugs@vanjs.org"
},
"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"

// 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";
(() => {
// 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"
]
}

0 comments on commit db42e63

Please sign in to comment.