-
Notifications
You must be signed in to change notification settings - Fork 7
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
Testing out bun with NX/TSC/Vite #12
Changes from 8 commits
c11d324
ffdc4b6
3b19801
cda2699
8257d3f
26b6023
14d48a0
75d92db
6664220
f38c403
842ec5b
ee49926
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
# .github/actions/setup-node/action.yml | ||
name: 'install workspace' | ||
description: 'Set up Node.js environment and check out code' | ||
inputs: | ||
node-version-file: | ||
description: 'Path to Node version file' | ||
default: '.nvmrc' | ||
description: 'Set up Bun and install packages' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: setup node | ||
uses: actions/setup-node@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
node-version-file: ${{ inputs.node-version-file }} | ||
cache: 'npm' | ||
cache-dependency-path: 'package-lock.json' | ||
bun-version: latest | ||
|
||
- name: npm ci | ||
run: npm ci --audit=false --fund=false | ||
- name: bun install | ||
run: bun install --silent | ||
shell: bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
FROM node:21-alpine | ||
FROM imbios/bun-node:latest-21-slim | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . ./ | ||
|
||
RUN npm ci | ||
|
||
RUN npx nx run-many -t build -p koa-server react-app | ||
RUN bun install --silent | ||
RUN bunx nx run-many -t build -p koa-server react-app | ||
|
||
ENV PORT=8080 | ||
EXPOSE 8080 | ||
CMD ["node", "./apps/koa-server/dist/server.js"] | ||
CMD ["bun", "./apps/koa-server/dist/server.js"] |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||
"targets": { | ||||||
"watch": { | ||||||
"options": { | ||||||
"commands": ["tsc --watch", "nodemon dist/server.js"] | ||||||
"commands": ["bunx tsc --watch", "bunx nodemon dist/server.js"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read comment below i think you could change this to the following
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! Thx! |
||||||
} | ||||||
}, | ||||||
"build": {}, | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,12 +4,12 @@ | |||||
"targets": { | ||||||
"watch": { | ||||||
"options": { | ||||||
"commands": ["vite"] | ||||||
"commands": ["bunx vite"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've adopted this! Thanks! |
||||||
} | ||||||
}, | ||||||
"build": { | ||||||
"options": { | ||||||
"commands": ["tsc", "vite build"] | ||||||
"commands": ["bunx tsc", "bunx vite build"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using bunx vite will basically run vite in node and not bun. Same with TSC here. You need force bun with --bun
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done! thx! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jordan-Hall regarding: "bun also has bulit in support for typescript compling so you dont need to run TSC. Whats the reasoning for it?" I want to publish reusable libraries for others from some of my projects. Thus I want to transpire to *.js that is non-bundled, non-minified for easy reuse, tree shaking, etc. I guess you'd recommend that I use https://bun.sh/docs/bundler? I guess that can be used for libraries and not just end user React apps? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct working on getting this to work on nx-bun but you can use cli for it bun build ./index.tsx --outdir ./out |
||||||
} | ||||||
}, | ||||||
"lint": {}, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now you are running it in actual bun (vite etc) you shouldn't need node here anymore