andresz1 / size-limit-action

Compare the real cost to run your JS app or lib to keep good performance in every pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Working directory

mrsln opened this issue · comments

Thank you for the action! It would be awesome if we could set a working/project directory because there are cases when a repo has several projects (a monorepo). Thank you!

Hi @mrsln,

Sure! that's a great idea 👍 thank you for opening the issue. I'll try to add it during this week and I'll let you know 😉 thanks again

Hi again @mrsln,

I checked it and I think that this could be achieved already without setting a working_dir 🤔This is an example of how could be used with lerna.

"scripts": {
  "build": "lerna run build",
  "postinstall": "lerna bootstrap",
  "size": "npm run size-build && size-limit",
  "size-build": "npm run build"
},
"size-limit": [{
  "name": "package1",
  "limit": "3 KB",
  "path": "./packages/package1/dist/index.js"
},  {
  "name": "package2",
  "limit": "3 KB",
  "path": "./packages/package2/dist/index.js"
}],

The postinstall script is important since packages dependencies should be also installed.

Let me know your thoughts.
Thanks!

Hi @andresz1! Thank you for the suggestion! We do use lerna for running Prettier in the pre-commit hook but not for building the projects. It would've been easier if the action supported working_dir option but I might try the lerna solution at some point. Thanks again!

Hi @mrsln, I'll close this by now since an example with lerna was added. Feel free to reopen or creating a new issue when you try it out! thank you so much.