Skip to content

Commit 3b94220

Browse files
VPhung24VPhung24David Boreham
committed
Add support for bun as a webapp package manager (#800)
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`. Co-authored-by: Vivian Phung <[email protected]> Co-authored-by: David Boreham <[email protected]> Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/800 Reviewed-by: David Boreham <[email protected]> Co-authored-by: VPhung24 <[email protected]> Co-committed-by: VPhung24 <[email protected]>
1 parent 36d4969 commit 3b94220

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

stack_orchestrator/data/container-build/cerc-nextjs-base/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ RUN \
2828
&& su ${USERNAME} -c "umask 0002 && npm install -g semver" \
2929
# Install pnpm
3030
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
31+
# Install bun
32+
&& su ${USERNAME} -c "umask 0002 && npm install -g [email protected]" \
3133
&& npm cache clean --force > /dev/null 2>&1
3234

3335
# [Optional] Uncomment this section to install additional OS packages.

stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/apply-runtime-env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
1414
CERC_BUILD_TOOL=pnpm
1515
elif [ -f "yarn.lock" ]; then
1616
CERC_BUILD_TOOL=yarn
17+
elif [ -f "bun.lockb" ]; then
18+
CERC_BUILD_TOOL=bun
1719
else
1820
CERC_BUILD_TOOL=npm
1921
fi

stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/build-app.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
1313
CERC_BUILD_TOOL=pnpm
1414
elif [ -f "yarn.lock" ]; then
1515
CERC_BUILD_TOOL=yarn
16+
elif [ -f "bun.lockb" ]; then
17+
CERC_BUILD_TOOL=bun
1618
else
1719
CERC_BUILD_TOOL=npm
1820
fi

stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
2020
CERC_BUILD_TOOL=pnpm
2121
elif [ -f "yarn.lock" ]; then
2222
CERC_BUILD_TOOL=yarn
23+
elif [ -f "bun.lockb" ]; then
24+
CERC_BUILD_TOOL=bun
2325
else
2426
CERC_BUILD_TOOL=npm
2527
fi

stack_orchestrator/data/container-build/cerc-webapp-base/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ RUN \
2828
&& su ${USERNAME} -c "umask 0002 && npm install -g semver" \
2929
# Install pnpm
3030
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
31+
# Install bun
32+
&& su ${USERNAME} -c "umask 0002 && npm install -g [email protected]" \
3133
&& npm cache clean --force > /dev/null 2>&1
3234

3335
# [Optional] Uncomment this section to install additional OS packages.

stack_orchestrator/data/container-build/cerc-webapp-base/scripts/build-app.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ elif [ -f "${WORK_DIR}/package.json" ]; then
2727
CERC_BUILD_TOOL=pnpm
2828
elif [ -f "yarn.lock" ]; then
2929
CERC_BUILD_TOOL=yarn
30+
elif [ -f "bun.lockb" ]; then
31+
CERC_BUILD_TOOL=bun
3032
else
3133
CERC_BUILD_TOOL=npm
3234
fi

0 commit comments

Comments
 (0)