Skip to content

Commit

Permalink
chore: 🤖 update size-limit config (#48)
Browse files Browse the repository at this point in the history
* chore: 🤖 update size-limit config

* ci: 🎡 run report bundle size only on pull request
  • Loading branch information
theashraf authored Nov 13, 2023
1 parent 02bef95 commit 10222fd
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
run: pnpm test

- name: 📏 Report bundle size
if: github.event_name == 'pull_request'
uses: andresz1/size-limit-action@v1
continue-on-error: true
with:
Expand Down
25 changes: 25 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');

const packagesDir = path.join(__dirname, 'packages');
const packageDirs = fs.readdirSync(packagesDir);

const packages = packageDirs
.map((dir) => {
const packageJsonPath = path.join(packagesDir, dir, 'package.json');

if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));

return {
name: packageJson.name,
path: path.join(__dirname, packageJson.repository.directory, packageJson.module),
import: '*',
};
}

return null;
})
.filter(Boolean);

module.exports = packages;
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"release": "pnpm release:version && pnpm release:publish",
"release:publish": "pnpm clean && pnpm build && changeset publish",
"release:version": "changeset version",
"size": "size-limit",
"size:why": "size-limit --why --clean-dir --save-bundle ./tmp",
"stats:eslint": "cross-env TIMING=1 turbo run stats:eslint",
"stats:ts": "turbo run stats:ts",
"test": "turbo run test",
Expand All @@ -41,13 +43,17 @@
"@lottiefiles/prettier-config": "3.0.0",
"@lottiefiles/remark-preset": "1.0.0",
"@lottiefiles/tsconfig": "2.0.0",
"@size-limit/esbuild": "^11.0.0",
"@size-limit/esbuild-why": "^11.0.0",
"@size-limit/preset-small-lib": "^10.0.2",
"cross-env": "7.0.3",
"eslint": "7.32.0",
"husky": "8.0.3",
"lint-staged": "13.2.1",
"npm-check-updates": "16.10.9",
"prettier": "2.8.8",
"remark-cli": "11.0.0",
"size-limit": "^10.0.2",
"syncpack": "9.8.6",
"turbo": "1.10.16",
"typescript": "5.0.4"
Expand Down
6 changes: 0 additions & 6 deletions packages/web/.size-limit.cjs

This file was deleted.

4 changes: 0 additions & 4 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"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",
Expand All @@ -49,10 +48,7 @@
"@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
44 changes: 32 additions & 12 deletions pnpm-lock.yaml

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

0 comments on commit 10222fd

Please sign in to comment.