Skip to content

Commit 6367762

Browse files
committed
Merge branch 'chore/ui-vite-eslint9-cve-fixes' into 'master'
chore(ui): migrate to Vite, ESLint 9, and fix npm CVEs Closes #320, #315, #288, #287, #236, #235, and #229 See merge request postgres-ai/database-lab!1122
2 parents 21abcb5 + b3599e7 commit 6367762

27 files changed

+5430
-11812
lines changed

ui/.gitlab-ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include:
1111

1212
.ui_cache: &ui_cache
1313
image:
14-
name: node:21.1.0-alpine
14+
name: node:22-alpine
1515
pull_policy: if-not-present
1616
cache: &cache
1717
key: "$CI_COMMIT_REF_SLUG"
@@ -26,7 +26,7 @@ check-code-style:
2626
stage: test
2727
before_script:
2828
- corepack enable
29-
- corepack prepare pnpm@8.9.2 --activate
29+
- corepack prepare pnpm@8.15.9 --activate
3030
- export PNPM_HOME=/usr/local/bin
3131
- pnpm config set store-dir /builds/postgres-ai/database-lab/.pnpm-store/
3232

@@ -63,7 +63,7 @@ semgrep-sast:
6363
e2e-ce-ui-test:
6464
<<: *ui_checks
6565
image:
66-
name: node:21.1.0
66+
name: node:22
6767
pull_policy: if-not-present
6868
stage: integration-test
6969
variables:
@@ -72,10 +72,7 @@ e2e-ce-ui-test:
7272
- apt update
7373
- apt install -y curl libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
7474
- npm install -g wait-on
75-
- npm install -g pnpm
76-
- pnpm config set verify-store-integrity false
77-
# TODO: Set up caching.
78-
#- pnpm config set store-dir /builds/postgres-ai/database-lab/.pnpm-store/
75+
- npm install -g pnpm@8.15.9
7976
script:
8077
- pnpm --dir ui/ --filter @postgres.ai/ce install
8178
- pnpm --dir ui/ --filter @postgres.ai/ce build

ui/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,29 @@ For example, cloning a 10 TiB PostgreSQL database can take less than 2 seconds.
2222

2323
At the repository root, you can run commands for all packages or individual packages:
2424

25-
- `<npm command> -ws` – run the specified command on all packages.
26-
- `<npm command> -w <package-name>` – run the specified command on a single package.
25+
- `pnpm --filter <package-name> <command>` – run the specified command on a single package.
2726

2827
#### Examples
29-
- `npm ci -ws` – install all dependencies.
30-
- `npm run build -ws` – build all packages.
31-
- `npm run start -w @postgres.ai/ce` – run the Community Edition UI locally in development mode.
28+
- `pnpm install` – install all dependencies.
29+
- `pnpm --filter @postgres.ai/ce build` – build the Community Edition UI.
30+
- `pnpm --filter @postgres.ai/ce start` – run the Community Edition UI locally in development mode.
3231

3332
_Important note: do not run or build the `@postgres.ai/shared` package directly; it is a dependency._
3433

3534
### How to start the Community Edition UI
3635
- `cd ui`
37-
- `npm ci -ws` – install dependencies for all packages (run once).
38-
- `npm run start -w @postgres.ai/ce` – start the development server.
36+
- `pnpm install` – install dependencies for all packages (run once).
37+
- `pnpm --filter @postgres.ai/ce start` – start the development server.
38+
39+
The dev server proxies `/api` and `/ws` to `http://localhost:446` by default.
40+
Set the `VITE_DEV_PROXY_TARGET` environment variable to override the proxy target, for example:
41+
`VITE_DEV_PROXY_TARGET=https://demo.dblab.dev:446 pnpm --filter @postgres.ai/ce start`
3942

4043
### How to build the Community Edition UI
4144

4245
- `cd ui`
43-
- `npm ci -ws` – install dependencies for all packages (run once).
44-
- `npm run build -w @postgres.ai/ce` – build the Community Edition UI.
46+
- `pnpm install` – install dependencies for all packages (run once).
47+
- `pnpm --filter @postgres.ai/ce build` – build the Community Edition UI.
4548

4649
### CI pipelines for UI code
4750

@@ -58,7 +61,7 @@ Vulnerabilities, CVEs, and security issues can be reported on GitLab or GitHub t
5861
#### Package Issues
5962
Ways to resolve (in descending order of preference):
6063
1. Update the package – search npm for a newer version, as the vulnerability may already be fixed.
61-
2. If the vulnerability is in a sub-package, use [npm-force-resolutions](https://www.npmjs.com/package/npm-force-resolutions) to override it. Use this technique with caution—it may break the project during build or at runtime. Perform a full end-to-end test afterward.
64+
2. If the vulnerability is in a sub-package, use [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides) in the root `package.json` to pin the transitive dependency to a patched version. Use this technique with caution—it may break the project during build or at runtime. Perform a full end-to-end test afterward.
6265
3. Fork the package and include it locally in this repository.
6366
4. If the issue is a false positive vulnerability, ignore it using your SAST tool's ignore directives. **This should be the last resort; apply other solutions first.**
6467

0 commit comments

Comments
 (0)