Add support for bun as a webapp package manager #800

Merged
dboreham merged 2 commits from VPhung24/bun-for-nextjs-and-webapps into main 2024-07-09 18:00:15 +00:00
Owner

This is working off pull request "Add support for pnpm as a webapp build tool. #767" that adds pnpm package manager support for nextjs & webapps.

bun default build output directory (defined as CERC_BUILD_OUTPUT_DIR) is dist which should already be handled with pnpm support in the previously mentioned pull request

Installing bun using npm following our previous pnpm installation

npm install -g bun

We'll be using bun as a package manager that works with Node.js projects as defined in bun's docs

The bun CLI contains a Node.js-compatible package manager designed to be a dramatically faster replacement for npm, yarn, and pnpm. It's a standalone tool that will work in pre-existing Node.js projects; if your project has a package.json, bun install can help you speed up your workflow.

To test next.js apps using node.js and compatibility with all four packager managers -- npm, yarn, pnpm, and bun -- use the branches of snowball's nextjs-package-manager-example-app repo: nextjs-package-manager/npm, nextjs-package-manager/yarn, nextjs-package-manager/pnpm, nextjs-package-manager/bun.

This is working off pull request "[Add support for pnpm as a webapp build tool. #767](https://git.vdb.to/cerc-io/stack-orchestrator/pulls/767/files)" that adds `pnpm` package manager support for `nextjs` & `webapps`. `bun` default build output directory (defined as `CERC_BUILD_OUTPUT_DIR`) is `dist` which should already be handled with `pnpm` support in the previously mentioned [pull request](https://git.vdb.to/cerc-io/stack-orchestrator/pulls/767/files) Installing `bun` using `npm` following our previous `pnpm` installation ```zsh npm install -g bun ``` We'll be using `bun` as a package manager that works with `Node.js` projects as defined in bun's [docs](https://bun.sh/docs/cli/install) > The bun CLI contains a Node.js-compatible package manager designed to be a dramatically faster replacement for npm, yarn, and pnpm. It's a standalone tool that will work in pre-existing Node.js projects; if your project has a package.json, bun install can help you speed up your workflow. To test `next.js` apps using `node.js` and compatibility with all four packager managers -- `npm`, `yarn`, `pnpm`, and `bun` -- use the branches of snowball's [nextjs-package-manager-example-app](https://git.vdb.to/snowball/nextjs-package-manager-example-app) repo: `nextjs-package-manager/npm`, `nextjs-package-manager/yarn`, `nextjs-package-manager/pnpm`, `nextjs-package-manager/bun`.
VPhung24 added 1 commit 2024-04-12 02:35:19 +00:00
bun package management support for nextjs & webapps
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 38s
Deploy Test / Run deploy test suite (pull_request) Successful in 4m57s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m18s
Webapp Test / Run webapp test suite (pull_request) Successful in 4m42s
Smoke Test / Run basic test suite (pull_request) Successful in 4m40s
fa2e0b8cf0
VPhung24 requested review from dboreham 2024-04-12 02:35:28 +00:00
VPhung24 added the
enhancement
help wanted
labels 2024-04-12 02:35:41 +00:00
jonathanface reviewed 2024-04-12 02:41:31 +00:00
@ -29,2 +29,4 @@
# Install pnpm
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
# Install bun
&& su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x" \
Owner

couldn't all these npm installs be combined?

su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x semver pnpm"

I don't actually know if it would work, just an idea

couldn't all these npm installs be combined? `su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x semver pnpm"` I don't actually know if it would work, just an idea
Author
Owner

As a guest contributor (plus as my first pull request and docker noob), I followed @telackey (approved by @dboreham) code style from the pnpm pull request & current code.

@telackey @dboreham your call.

As a guest contributor (plus as my first pull request and docker noob), I followed @telackey (approved by @dboreham) code style from the [pnpm pull request](https://git.vdb.to/cerc-io/stack-orchestrator/pulls/767/files) & current code. @telackey @dboreham your call.
Owner

Running npm several times is probably not much slower than running it once to install several packages.
The more important issue is to run all the commands in the same docker layer, which is being done.

Running npm several times is probably not much slower than running it once to install several packages. The more important issue is to run all the commands in the same docker layer, which _is_ being done.
dboreham marked this conversation as resolved
VPhung24 requested review from telackey 2024-04-12 05:29:23 +00:00
VPhung24 self-assigned this 2024-04-12 05:29:34 +00:00
VPhung24 changed title from bun package management support for nextjs & webapps to Add support for bun as a webapp package manager 2024-04-12 05:38:28 +00:00
dboreham changed title from Add support for bun as a webapp package manager to WIP: Add support for bun as a webapp package manager 2024-04-12 13:51:07 +00:00
Owner

Hi, this should be tested using a test like this one: https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/main/tests/webapp-test/run-webapp-test.sh (can be run manually first, then we can talk about making a CI version).

Currently the CI test uses this repo for its target app : https://git.vdb.to/cerc-io/test-progressive-web-app but perhaps we should switch to the multi-branch test app cited above now that we have three package managers to test?

Hi, this should be tested using a test like this one: https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/main/tests/webapp-test/run-webapp-test.sh (can be run manually first, then we can talk about making a CI version). Currently the CI test uses this repo for its target app : https://git.vdb.to/cerc-io/test-progressive-web-app but perhaps we should switch to the multi-branch test app cited above now that we have three package managers to test?
dboreham approved these changes 2024-07-09 17:15:12 +00:00
dboreham added 1 commit 2024-07-09 17:15:24 +00:00
Merge branch 'main' into VPhung24/bun-for-nextjs-and-webapps
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 36s
Webapp Test / Run webapp test suite (pull_request) Successful in 4m31s
Smoke Test / Run basic test suite (pull_request) Successful in 4m23s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m3s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 7m41s
17277730fb
dboreham changed title from WIP: Add support for bun as a webapp package manager to Add support for bun as a webapp package manager 2024-07-09 17:15:53 +00:00
dboreham merged commit 3b9422095c into main 2024-07-09 18:00:15 +00:00
dboreham deleted branch VPhung24/bun-for-nextjs-and-webapps 2024-07-09 18:00:23 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/stack-orchestrator#800
No description provided.