Skip to content

Commit

Permalink
chore: 🤖 add size-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed Nov 2, 2023
1 parent 3cad70e commit 2803152
Show file tree
Hide file tree
Showing 6 changed files with 445 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- name: 🛡️ Test
run: pnpm test

- name: Check size
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

release:
name: release
needs: validate
Expand Down
6 changes: 6 additions & 0 deletions packages/web/.size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = [
{
path: './dist/index.js',
import: '{ DotLottie }',
},
];
5 changes: 5 additions & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"build:wasm:docker": "./docker_build_wasm.sh",
"dev": "tsup --watch",
"lint": "eslint --fix .",
"size": "size-limit",
"size:why": "size-limit --why --clean-dir --save-bundle ./tmp",
"stats:eslint": "cross-env TIMING=1 eslint .",
"stats:ts": "tsc -p tsconfig.build.json --extendedDiagnostics",
"type-check": "tsc --noEmit"
Expand All @@ -43,7 +45,10 @@
"@dotlottie/dotlottie-js": "^0.6.0"
},
"devDependencies": {
"@size-limit/esbuild-why": "^10.0.2",
"@size-limit/preset-small-lib": "^10.0.2",
"cross-env": "7.0.3",
"size-limit": "^10.0.2",
"tsup": "7.2.0",
"typescript": "5.0.4"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/web/src/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ export class DotLottie {
if (this._renderer?.load(data, this._canvas.width, this._canvas.height)) {
this._totalFrames = this._renderer.totalFrames();
this._duration = this._renderer.duration();

this._eventManager.dispatch({
type: 'load',
});

if (this._autoplay) {
this.play();
}
Expand Down
1 change: 1 addition & 0 deletions packages/web/tsup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ module.exports = defineConfig({
path.resolve(__dirname, './dist/renderer.wasm'),
);
},
noExternal: ['@dotlottie/dotlottie-js'],
});
Loading

0 comments on commit 2803152

Please sign in to comment.