Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add package_manager option to set manager in the config #87

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

PilotConway
Copy link
Contributor

This PR would add a package_manager option to the configuration of the action to manually specify the package manager to use and skip auto detection. Issue #77.

Details

Although the script option is useful for specifying the script to use to configure the size-limit script to run and can be used in monorepos to only run a specific workspace (using yarn workspace package1 size-limit --json for instance), this still runs the install and build scripts on the entire repo which can drastically increase build times for larger monorepos and add increase costs. We tried using directory option to specific just the directory to run, but in doing so the yarn.lock file is not in those subfolders so npm was used which didn't work in our repo.

This new option allows users to manually specify the package manager to use such as yarn in this situation, allowing us to combine directory option with a monorepo to just build and install a single subpackage reducing time and costs and allowing for more configuration of the tool.

Tests

I have created a small test repo to show the use case my team is using, with two actions one using the original action and another using this PR. In the repo I blocked npm usage to show the action failing that is calling npm and the PR will succeed since package_manager: yarn is used in the config.

PilotConway/size-limit-monorepo-test#1

This option allows the user to explicitly set the package manager instead of using auto detection which may not work in some cases like monorepos.
@andresz1 andresz1 merged commit dd31dce into andresz1:master Aug 22, 2022
@inomdzhon
Copy link

Hi, @andresz1 👋

I see, we have package_manager in a documentation, but we haven't got this property in a last version (current is 1.7.0) =(

Could we release minor version?

Thanks, and thanks @PilotConway for PR :)

@mendrew
Copy link

mendrew commented Jun 16, 2023

Hi @andresz1

could you please release a new version of this wonderful package? 🙏
We really miss this package_manager feature as it allows to run size-limit-action within monorepo package.

There is a hacky workaround, though. We currently create fake yarn.lock to let action detect yarn automatically, but we struggles, especially as feature in the documentation but not in the npm.

Thank you in advance!

rafaelss pushed a commit to rafaelss/size-limit-action that referenced this pull request Jun 28, 2023
…1#87)

This option allows the user to explicitly set the package manager instead of using auto detection which may not work in some cases like monorepos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants