Skip to content

Commit cfbc3a8

Browse files
committed
use size-limit to track gzip size of the van:
devDependencies ∋ size-limit ∋ @size-limit/preset-small-lib publish.sh: fix: build on linux systems
1 parent 701bebd commit cfbc3a8

11 files changed

+982
-8
lines changed

package-lock.json

+950
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"type": "module",
1818
"scripts": {
19-
"test": "echo \"Error: no test specified\" && exit 1"
19+
"test": "(cd ./src; ./publish.sh) && npm run test:size",
20+
"test:size": "size-limit"
2021
},
2122
"keywords": [
2223
"Van",
@@ -35,9 +36,11 @@
3536
"author": "Tao Xin",
3637
"license": "MIT",
3738
"devDependencies": {
39+
"@size-limit/preset-small-lib": "^9.0.0",
3840
"all-contributors-cli": "^6.26.1",
3941
"esbuild": "^0.17.12",
4042
"node-jq": "^2.3.5",
43+
"size-limit": "^9.0.0",
4144
"terser": "^5.22.0",
4245
"typescript": "^5.1.6"
4346
},
@@ -49,5 +52,12 @@
4952
"url": "https://github.com/vanjs-org/van/issues",
5053
"email": "[email protected]"
5154
},
52-
"homepage": "https://vanjs.org"
55+
"homepage": "https://vanjs.org",
56+
"size-limit": [
57+
{
58+
"name": "Van",
59+
"path": "public/van-latest.min.js",
60+
"limit": "962 B"
61+
}
62+
]
5363
}

public/van-1.2.5.debug.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import van from "./van-1.2.5.js"
1+
import van from "./van.js"
22

33
// If this variable is set to an Array, we will push the error message into the array instead of
44
// throwing an error. This is useful in testing, to capture the error occurred asynchronous to the initiating

public/van-1.2.5.nomodule.debug.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
(() => {
23
// van.js
34
var Obj = Object;

public/van-1.2.5.nomodule.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
(() => {
23
// van.js
34
var Obj = Object;

public/van-1.2.5.nomodule.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/van-latest.nomodule.debug.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
(() => {
23
// van.js
34
var Obj = Object;

public/van-latest.nomodule.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
(() => {
23
// van.js
34
var Obj = Object;

public/van-latest.nomodule.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/publish.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ cp ../public/van-$VER.nomodule.js ../public/van-latest.nomodule.js
3030
cp ../public/van-$VER.nomodule.min.js ../public/van-latest.nomodule.min.js
3131
cp ../public/van-$VER.nomodule.debug.js ../public/van-latest.nomodule.debug.js
3232

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

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

3939
rm ../public/*.bak
4040

4141
# Testing
42-
npx tsc -m es2020 -t es2017 ../test/van.test.ts
42+
(cd ../test; tsc)
4343
npx esbuild ../test/van.test.forbundle.js --bundle --banner:js="'use strict';" --outfile=../test/van.test.nomodule.js

test/tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"module": "es2020",
4+
"target": "es2017",
5+
"skipLibCheck": true
6+
},
7+
"files": [
8+
"./van.test.ts"
9+
]
10+
}

0 commit comments

Comments
 (0)