Fail gracefully on initial addition
Klemensas opened this issue · comments
When creating a PR that adds the size-limit
dependency and action initially the action will always fail due to it trying to compare with the base branch that hasn't size-limit
added yet.
Failure log
/usr/local/bin/npx size-limit --json
npx: installed 99 in 5.742s
Install Size Limit preset depends on type of the project
For application, where you send JS bundle directly to users
yarn add --dev @size-limit/preset-app
For frameworks, components and big libraries
yarn add --dev @size-limit/preset-big-lib
For small (< 10 KB) libraries
yarn add --dev @size-limit/preset-small-lib
Check out docs for more complicated cases
https://github.com/ai/size-limit/
You need to add size-limit dependency: yarn add --dev size-limit
Error parsing size-limit output. The output should be a json.
##[error]Unexpected end of JSON input
Instead of failing it could just give a warning about not being setup yet and pass
Hi @Klemensas, you are right, cool idea! Thank you so much for opening this issue. I'll label this as good first issue
in case someone wants to contribute if not I'll try to fix it myself.
I managed to figure out what's going on in the initial error (You need to add size-limit dependency) and merged size-limit
first. I added the size-limit
Github Action in a separate pull request and it fails with the second error (Error parsing size-limit output). It's not obvious to me how I can bypass this error, can you advise please @andresz1?
@Klemensas How did you manage to get past this error?
@mrlubos maybe you're basing your PR on a branch that doesn't have size-limit
?
Once I've merged the size-limit
stuff to my base branch everything worked fine.
Ahhh, I think I've got it. Not only do I need size-limit
dependency, I also need to merge the config first. This is currently in my pull request, will split it into another one. That should do it, thanks for pointing it out!