Skip to content
Snippets Groups Projects
Commit 30cb3c9b authored by Leonardo Christino's avatar Leonardo Christino
Browse files

chore: switch frontend from pnpm to bun

parent c7e4945c
No related branches found
Tags v1.54.0
1 merge request!338Chore/pnpm to bun
Pipeline #141875 failed
Showing
with 45 additions and 19397 deletions
#!/usr/bin/env sh
pnpm dlx commitlint --edit $1
bunx commitlint --edit $1
#!/usr/bin/env sh
pnpm push
\ No newline at end of file
bun push
\ No newline at end of file
FROM node:19-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV BUN_HOME="/bun"
ENV PATH="$BUN_HOME:$PATH"
RUN corepack enable
WORKDIR /app
ARG IMAGE_TAG="dev-no-image-tag"
......@@ -9,14 +9,14 @@ ENV GRAPHPOLARIS_VERSION=$IMAGE_TAG
FROM base AS install
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY bun.lockb ./
COPY pnpm-workspace.yaml ./
COPY turbo.json ./
COPY apps/web/package.json ./apps/web/package.json
COPY apps/docs/package.json ./apps/docs/package.json
COPY libs/config/package.json ./libs/config/package.json
COPY libs/shared/package.json ./libs/shared/package.json
RUN pnpm install --frozen-lockfile
RUN bun install --frozen-lockfile
FROM base AS build
......@@ -26,7 +26,7 @@ COPY libs /app/libs
COPY --from=install /app /app
# Fixes: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN pnpm run build
RUN bun run build
FROM base AS env-build
......
# windows:
# pnpm build
# bun build
# macos:
# pnpm build
# bun build
# linux:
# pnpm build
# bun build
# @docker push harbor.graphpolaris.com/graphpolaris/frontend\:latest
......@@ -17,7 +17,7 @@ run:
brun: build run
push:
@pnpm push
@bun push
clean:
rm -rf node_modules
......@@ -25,14 +25,15 @@ clean:
rm -rf libs/shared/node_modules
rm -rf libs/storybook/node_modules
rm -rf libs/config/node_modules
pnpm i
bun i
cleanrm:
rm -rf pnpm-lock.yaml
rm -rf bun.lockb
rm -rf node_modules
rm -rf apps/web/node_modules
rm -rf libs/shared/node_modules
rm -rf libs/storybook/node_modules
rm -rf libs/config/node_modules
pnpm i
pnpm build
bun i
bun build
......@@ -2,27 +2,27 @@
## Preparing to Run Locally
Be sure that you have node.js (v18 or up) and pnpm installed. Please use pnpm for building and running the scripts of package.json.
Be sure that you have node.js (v18 or up) and bun installed. Please use bun for building and running the scripts of package.json.
Due to the way auth works (using a sameSite cookie), the procedure for running locally is a little different than usual. These steps will only have to be done, after that everything should 'just' work.
## Running Locally
### Install
First run `pnpm i` on the root of the workspace to install all dependencies. It will create a node_module folder in the root of the workspace as well as one for each app/library within it.
First run `bun i` on the root of the workspace to install all dependencies. It will create a node_module folder in the root of the workspace as well as one for each app/library within it.
If you need to install a new dependency or upgrade an existing one, do so in the respective package.json and rerun `pnpm i` in the root of the workspace. If you find any issues, feel free to delete the node_modules folder from the workspace root and from the app/lib which you are changing the dependency and rerun the `pnpm i` command from the root of the workspace. Most issues are solved by then.
If you need to install a new dependency or upgrade an existing one, do so in the respective package.json and rerun `bun i` in the root of the workspace. If you find any issues, feel free to delete the node_modules folder from the workspace root and from the app/lib which you are changing the dependency and rerun the `bun i` command from the root of the workspace. Most issues are solved by then.
Secondly, make sure you create a local `.env` file. For local development, you can simply copy the contents of the `.env.development` template in the `/apps/web` directory to a new `.env` file and you should be good to go.
### Running Storybook.js
To run the dev storybook (implementing visualizations) simply run `pnpm sb` and once it is running, ctrl-click the link what appears in the terminal. The url should be [http://localhost:6006].
To run the dev storybook (implementing visualizations) simply run `bun sb` and once it is running, ctrl-click the link what appears in the terminal. The url should be [http://localhost:6006].
### Dev server
The dev server (as of now) expects the backend to be also running in your machine. Therefore, for it to be useful you will need first to have the Backend
running. After that you also need to be sure tp update your hosts file. Finally, to run the application simply run `pnpm dev` from the workspace root.
running. After that you also need to be sure tp update your hosts file. Finally, to run the application simply run `bun dev` from the workspace root.
#### Hosts file
......@@ -46,6 +46,6 @@ This will make the dev server to try to connect to the backend running in your o
### Other Commands
You can run pnpm commands (see available ones in packages.json) from the root of the workspace, which will trigger turborepo to run it in all libraries and apps of the workspace. You can run `pnpm test` or `pnpm lint` this way to test or lint the entire workspace.
You can run bun commands (see available ones in packages.json) from the root of the workspace, which will trigger turborepo to run it in all libraries and apps of the workspace. You can run `bun test` or `bun lint` this way to test or lint the entire workspace.
You can also go into a specific lib/app and run pnpm commands from there to scope the task to only that part of the workspace.
You can also go into a specific lib/app and run bun commands from there to scope the task to only that part of the workspace.
GRAPHPOLARIS_VERSION=dev
BACKEND_URL=http://localhost
BACKEND_WSS_URL=ws://localhost:3001/
BACKEND_WSS_URL=ws://localhost:3001/ws
STAGING=dev
SKIP_LOGIN=true
BACKEND_USER=:3000
BACKEND_USER=:3001
GRAPHPOLARIS_VERSION=dev
SENTRY_ENABLED=false
......
{
"extends": ["./node_modules/config/.eslintrc.json"]
"extends": ["../../libs/config/.eslintrc.json"]
}
......@@ -4,12 +4,12 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev2": "vite --host local.graphpolaris.com --port 4200",
"dev": "vite --port 4200",
"build": "vite build",
"dev2": "bunx --bun vite --host local.graphpolaris.com --port 4200",
"dev": "bunx --bun vite --port 4200",
"build": "bunx --bun vite build",
"build-env": "npx import-meta-env -x .env.example",
"build-dev": "export NODE_OPTIONS=\"--max-old-space-size=8192\" && vite build --mode development",
"preview": "vite preview --port 4200",
"build-dev": "export NODE_OPTIONS=\"--max-old-space-size=8192\" && bunx --bun vite build --mode development",
"preview": "bunx --bun vite preview --port 4200",
"type": "tsc --noEmit --skipLibCheck",
"lint": "eslint src/**/* --no-error-on-unmatched-pattern",
"test": "vitest run"
......
const sharedConfig = require('../../libs/config/tailwind.config.js');
import sharedConfig from '../../libs/config/tailwind.config.js';
module.exports = {
presets: [sharedConfig],
export default {
...sharedConfig,
};
bun.lockb 0 → 100755
File added
{
"extends": ["./node_modules/config/.eslintrc.json"]
"extends": ["../config/.eslintrc.json"]
}
......@@ -52,9 +52,9 @@ export const Tab = ({
}
return (
<div className={`btn btn-ghost btn-xs rounded-none ${className}`} {...props}>
<div className={`btn btn-ghost btn-xs rounded-none text-xs font-semibold flex items-center ${className}`} {...props}>
<span>{text}</span>
{props.children}
</div>
);
......
......@@ -490,11 +490,11 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
};
const onMouseDown = useCallback(
(event: MouseEvent | TouchEvent, viewport: Viewport) => {
(event: React.MouseEvent) => {
if (contextMenuOpen.open) {
setContextMenuOpen({ ...contextMenuOpen, open: false });
}
dispatch(resultSetFocus({ focusType: 'query' }))
dispatch(resultSetFocus({ focusType: 'query' }));
},
[contextMenuOpen],
);
......
@import './handles.module.scss';
@forward './handles.module.scss';
.react-flow__node {
&.selected {
......
......@@ -2,5 +2,5 @@
import sharedConfig from 'config/tailwind.config.js';
export default {
presets: [sharedConfig],
...sharedConfig,
};
{
"extends": ["./node_modules/config/.eslintrc.json"]
"extends": ["../config/.eslintrc.json"]
}
......@@ -2,10 +2,11 @@
"name": "graphpolaris-monorepo",
"version": "0.0.0",
"private": true,
"packageManager": "pnpm@9.9.0",
"packageManager": "bun@1.1.34",
"workspaces": [
"apps/*",
"libs/*"
"libs/*",
"libs/workspace/*"
],
"scripts": {
"build": "turbo run build --no-daemon",
......@@ -29,6 +30,7 @@
"@commitlint/config-conventional": "^19.4.1",
"@import-meta-env/cli": "^0.7.0",
"@types/react-plotly.js": "^2.6.3",
"bunx": "^0.1.0",
"eslint-config-custom": "workspace:*",
"husky": "^9.1.5",
"prettier": "^3.3.3",
......
This diff is collapsed.
packages:
- "apps/web"
- "apps/docs"
- "libs/**"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment