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

[FR]: Support for other runtimes like Bun #1258

Open
pattrickrice opened this issue Sep 8, 2023 · 3 comments
Open

[FR]: Support for other runtimes like Bun #1258

pattrickrice opened this issue Sep 8, 2023 · 3 comments
Labels
enhancement New feature or request funding needed Contribute to https://opencollective.com/aspect-build

Comments

@pattrickrice
Copy link

What is the current behavior?

Uses NodeJS as runtime.

Describe the feature

This is more a question than a feature request, I didn't see mention of it when searching.

  • Is it possible to support using Bun or Deno in place of Node?
  • [request] If it is possible, maybe add an example or documentation
  • [discussion] If it is not possible, should it be possible with these rules?
@pattrickrice pattrickrice added the enhancement New feature or request label Sep 8, 2023
@github-actions github-actions bot added the untriaged Requires traige label Sep 8, 2023
@alexeagle alexeagle changed the title [FR]: Support for other runtimes like Deno or Bun? [FR]: Support for other runtimes like Bun Sep 19, 2023
@alexeagle
Copy link
Member

We already offer https://gitlab.com/aspect-build/rules_deno so that answers half your question, I'll repurpose your issue for the other half.

we had a couple questions recently about bun, and it does seem feasible to add a small amount of starlark to be able to run their bundler and devserver. I'm not sure if that merits a separate rules_bun or not yet. We need some funding to make it happen.

@alexeagle alexeagle added funding needed Contribute to https://opencollective.com/aspect-build and removed untriaged Requires traige labels Sep 19, 2023
@alexeagle
Copy link
Member

I started some simple experimentation:
https://github.com/aspect-build/rules_js/compare/bun

So far the issue is that bun isn't writing to the --outdir that was specified.

SUBCOMMAND: # //examples/bun:run_with_bun [action 'RunBinary examples/bun/out', configuration: d900f2c6675f9abd37dca719ba1580b468bdfd633f18aefa2143fe33f1de18bf, execution platform: @local_config_platform//:host]
(cd /private/var/tmp/_bazel_alexeagle/deecfabe94c39fb88a37966b779aac74/execroot/aspect_rules_js && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
  bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/bun_darwin_aarch64/bun_exe build examples/bun/a.ts --outdir ./bazel-out/darwin_arm64-fastbuild/bin/examples/bun/out)
# Configuration: d900f2c6675f9abd37dca719ba1580b468bdfd633f18aefa2143fe33f1de18bf
# Execution platform: @local_config_platform//:host
INFO: From RunBinary examples/bun/out:

  ../../../../../../../../../../../../Users/alexeagle/Projects/rules_js/examples/bun/a.js  0.18 KB

[2ms] bundle 1 modules
Target //examples/bun:run_with_bun up-to-date:
  bazel-bin/examples/bun/out
INFO: Elapsed time: 0.106s, Critical Path: 0.02s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
INFO: Build completed successfully, 2 total actions

alexeagle@MacBook-Pro-8 rules_js % ls bazel-bin/examples/bun/out   # it's empty :(

@vkbansal-rubrik
Copy link
Contributor

vkbansal-rubrik commented May 23, 2024

I tried using bun as follows but it fails

# BUILD.bazel
load("@npm//:bun/package_json.bzl", bun_bin = "bin")

bun_bin.bin(
  name = "dummy-script",
  args = ["dummy-script.ts"]
)

[email protected]
[email protected]

Error: Your package manager doesn't seem to support bun. To use bun, install using the following command: curl -fsSL https://bun.sh/install | bash

> [email protected] postinstall 
> node install.js

===============================================================
Failure while running lifecycle hook for package '[email protected]':

  Script:  'postinstall'
  Command: `node install.js`

Stack trace:

Exit status 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request funding needed Contribute to https://opencollective.com/aspect-build
Projects
Status: No status
Development

No branches or pull requests

3 participants