Skip to content

Commit 5ea1c65

Browse files
authored
Merge pull request #105 from DiamondLightSource/get_build_working
Update and get a working build for deployment
2 parents 0a00655 + 475ead9 commit 5ea1c65

11 files changed

Lines changed: 11481 additions & 10147 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Base stage with Node.js and pnpm
2+
FROM node:20-bullseye AS base
3+
WORKDIR /workspaces
4+
5+
# Install system dependencies
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
vim \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Install pnpm globally
11+
RUN npm install -g pnpm@latest
12+
13+
# Developer stage
14+
FROM base AS developer
15+
16+
# Keep container alive for devcontainer exec
17+
CMD ["pnpm", "start"]

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "I24 DAQ UI Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"target": "developer",
6+
"context": ".."
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-vscode.vscode-typescript-next",
12+
"esbenp.prettier-vscode",
13+
"ms-vscode.vscode-json",
14+
"redhat.vscode-yaml"
15+
],
16+
"settings": {
17+
"typescript.preferences.preferTypeOnlyAutoImports": true,
18+
"editor.formatOnSave": true,
19+
"editor.defaultFormatter": "esbenp.prettier-vscode",
20+
"editor.codeActionsOnSave": {
21+
"source.fixAll.eslint": "always"
22+
}
23+
}
24+
}
25+
},
26+
"features": {
27+
// add in eternal history and other bash features
28+
"ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": {}
29+
},
30+
// Create the config folder for the bash-config feature
31+
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config",
32+
"runArgs": ["--net=host", "--security-opt=label=disable"],
33+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
34+
"postCreateCommand": "pnpm install"
35+
}

.github/workflows/_lint.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,28 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
9+
- uses: pnpm/action-setup@v3
10+
with:
11+
version: 10
912

1013
- name: Set up Node.js
1114
uses: actions/setup-node@v4
1215
with:
1316
node-version: 22
14-
cache: "npm"
17+
cache: "pnpm"
18+
cache-dependency-path: "**/pnpm-lock.yaml"
1519

1620
- name: Install dependencies
17-
run: npm ci
21+
run: pnpm install --frozen-lockfile
1822

1923
- name: Run audit
20-
run: npm audit --audit-level=high
24+
run: pnpm audit --audit-level=high
2125

2226
- name: Run Prettier
23-
run: npm run prettier
27+
run: pnpm run prettier
2428

2529
- name: Run ESLint
26-
run: npm run lint
30+
run: pnpm run lint
2731

2832
- name: Run TypeScript Compiler
29-
run: npm run tscheck
33+
run: pnpm run tscheck

.github/workflows/_tests.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ jobs:
1313
- name: Checkout code
1414
uses: actions/checkout@v3
1515

16+
- name: Use pnpm
17+
uses: pnpm/action-setup@v3
18+
with:
19+
version: 10
20+
1621
- name: Use Node.js ${{ matrix.node-version }}
1722
uses: actions/setup-node@v3
1823
with:
1924
node-version: ${{ matrix.node-version }}
20-
cache: "npm"
25+
cache: "pnpm"
26+
cache-dependency-path: "**/pnpm-lock.yaml"
2127

2228
- name: Install dependencies
23-
run: npm install
29+
run: pnpm install --frozen-lockfile
2430

2531
- name: Run tests
26-
run: npm test
32+
run: pnpm test

.github/workflows/actions.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,22 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v4
2626

27+
- name: Use pnpm
28+
uses: pnpm/action-setup@v3
29+
with:
30+
version: 10
31+
2732
- name: Set up Node
2833
uses: actions/setup-node@v4
2934
with:
3035
node-version: 22
31-
cache: "npm"
36+
cache: "pnpm"
3237

3338
- name: Install dependencies
34-
run: npm ci
39+
run: pnpm i
3540

3641
- name: Build
37-
run: npm run build
42+
run: pnpm run build
3843

3944
- name: Setup Pages
4045
uses: actions/configure-pages@v4

.husky/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
npm run lint
2-
npm run prettier
3-
npm test
1+
pnpm run lint
2+
pnpm run prettier
3+
pnpm test

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
On a DLS workstation, clone the repository and inside it run:
66

77
```bash
8-
module load node
8+
module load vscode
99

10-
npm install
10+
code .
1111
```
1212

13-
Note that the current default version for node is `21.7.1`, which is getting quite old and not supported by somme of the packages we need to install. It would be best to have a version `>=22.12.0`.
13+
When vscode opens, select `Reopen in container` to get a working environment with `pnpm` installed.
14+
15+
On a non-dls workstation you have the option of opening the devcontainer or installing pnpm globally and then running the app.
16+
To install the app:
17+
18+
```bash
19+
pnpm install
20+
```
1421

1522
## Gotchas
1623

@@ -51,7 +58,13 @@ For I24 instead, The first few plans are in the branch https://github.com/Diamon
5158
Once all the above steps are done, start a blueapi server. The gui can be started by running:
5259
5360
```bash
54-
npm run dev
61+
pnpm run dev
5562
```
5663

5764
inside the repository and clicking on the link.
65+
66+
## Make a release
67+
68+
Make a release from the github `Releases` page and point it to either a tag or a branch.
69+
There is a workflow job that will then build the app and publish a docker image - which is necessary
70+
for deployment.

0 commit comments

Comments
 (0)