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

Support --if-present argument with bun run #5670

Closed
simenandre opened this issue Sep 18, 2023 · 1 comment · Fixed by #6248
Closed

Support --if-present argument with bun run #5670

simenandre opened this issue Sep 18, 2023 · 1 comment · Fixed by #6248
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request

Comments

@simenandre
Copy link

simenandre commented Sep 18, 2023

What is the problem this feature would solve?

When building standardized CI workflows, we set some standard commands that are typical to find in projects.
If the script doesn't exists, bun fails, which breaks those workflows if a project doesn't have that script/command.

What is the feature you are proposing to solve the problem?

We typically use pnpm run --if-present <command> on workflows today.

This will only run the command if the script is available in the package.

What alternatives have you considered?

  • We can probably build some script that skips steps in our workflow based on package.json.
  • Add all scripts defined in a workflow, e.g. exit 0
@simenandre simenandre added the enhancement New feature or request label Sep 18, 2023
@simenandre
Copy link
Author

simenandre commented Sep 18, 2023

More context: I'm adding support for Bun in our standardized GitHub Actions, which you can find a PR for here:
bjerkio/workflows#6.

As displayed in the PR above, the workaround for us, right now, is to add scripts with exit 0.

Example workflow from PNPM:
https://github.com/bjerkio/workflows/blob/main/.github/workflows/pnpm-typical.yml

@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Sep 18, 2023
Electroid added a commit that referenced this issue Oct 3, 2023
Jarred-Sumner pushed a commit that referenced this issue Oct 4, 2023
* Support --if-present
Closes #5670

* More robust tests, handle more cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants