Skip to content

Commit 8e2f5e3

Browse files
committed
chore(pnpm): bootstrap project with pnpm
1 parent 75fb45e commit 8e2f5e3

18 files changed

+15817
-29552
lines changed

.dockerignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ README.md
1212
docker-compose.yml
1313
**/.DS_Store
1414
**/venv
15-
**/env
15+
**/env
16+
**/dist
17+
**/build

.github/workflows/build_and_deploy.yaml

+4-8
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,20 @@ jobs:
4646
4747
- name: Build
4848
run: |
49-
docker build \
50-
--platform linux/amd64 \
51-
--tag ${{env.TAG }} \
52-
-f ./packages/app-builder/Dockerfile \
53-
.
49+
docker build . --target app-builder --tag ${{ env.TAG}}
5450
5551
- name: Push
5652
run: |
57-
docker push ${{env.TAG }}
53+
docker push ${{ env.TAG }}
5854
5955
- name: Deploy server
6056
run: |
6157
gcloud run deploy marble-front \
6258
--quiet \
63-
--image="${{env.TAG }}" \
59+
--image="${{ env.TAG }}" \
6460
--region="europe-west1" \
6561
--allow-unauthenticated \
66-
--service-account=${{env.SERVICE_ACCOUNT }} \
62+
--service-account=${{ env.SERVICE_ACCOUNT }} \
6763
--set-env-vars=ENV=${{ vars.ENV }},FIREBASE_API_KEY=${{ vars.FIREBASE_API_KEY }},FIREBASE_APP_ID=${{ vars.FIREBASE_APP_ID }},FIREBASE_AUTH_DOMAIN=${{ vars.FIREBASE_AUTH_DOMAIN }},FIREBASE_MESSAGING_SENDER_ID=${{ vars.FIREBASE_MESSAGING_SENDER_ID }},FIREBASE_PROJECT_ID=${{ vars.FIREBASE_PROJECT_ID }},FIREBASE_STORAGE_BUCKET=${{ vars.FIREBASE_STORAGE_BUCKET }},MARBLE_API_DOMAIN=${{ vars.MARBLE_API_DOMAIN }},NODE_ENV=${{ vars.NODE_ENV }},SESSION_MAX_AGE=${{ vars.SESSION_MAX_AGE }} \
6864
--set-secrets=SESSION_SECRET=COOKIE_SESSION_SECRET:latest \
6965
--port=8080

.github/workflows/check.yaml

+10-8
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ jobs:
1111
actions: read
1212
steps:
1313
- uses: actions/checkout@v3
14-
14+
- uses: pnpm/action-setup@v2
15+
with:
16+
version: 8
1517
- name: Set up Node
1618
uses: actions/setup-node@v3
1719
with:
1820
node-version-file: '.tool-versions'
19-
cache: 'npm'
21+
cache: 'pnpm'
2022

21-
- run: npm ci
23+
- run: pnpm install --frozen-lockfile
2224

23-
- run: npm run format:check
24-
- run: npm run lint --workspaces
25-
- run: npm run type-check --workspaces
26-
- run: npm run test:all
27-
- run: npm run build --workspaces --if-present
25+
- run: pnpm run format:check
26+
- run: pnpm run -r lint
27+
- run: pnpm run -r type-check
28+
- run: pnpm run test:all
29+
- run: pnpm run -r build

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Add files here to ignore them from prettier formatting
22
/.vscode/
3+
pnpm-lock.yaml
34

45
# app-builder
56
/packages/app-builder/.cache/

.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
nodejs 20.2.0
2+
pnpm 8.6.8

Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:20-slim AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
COPY . /app
6+
WORKDIR /app
7+
8+
FROM base AS prod-deps
9+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
10+
11+
FROM base AS build
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
13+
RUN pnpm run -r build
14+
15+
FROM base AS app-builder
16+
ENV NODE_ENV=production
17+
ENV PORT=8080
18+
19+
# To remove when nested package.json are correctly setup
20+
COPY --from=prod-deps /app/node_modules /app/node_modules
21+
22+
COPY --from=prod-deps /app/packages/app-builder/node_modules/ /app/packages/app-builder/node_modules
23+
COPY --from=build /app/packages/app-builder/build /app/packages/app-builder/build
24+
COPY --from=build /app/packages/app-builder/public /app/packages/app-builder/public
25+
WORKDIR /app/packages/app-builder
26+
EXPOSE 8080
27+
CMD [ "pnpm", "exec", "remix-serve", "build"]
28+

README.md

+43-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,52 @@
11
# Marble Front Monorepo
22

3-
This is the frontend marble monorepo. We use `npm` to handle dependancies and `nx` as build system tool.
3+
This is the frontend marble monorepo. We use `pnpm` to handle dependancies.
44

55
## Getting started
66

7-
We recommand you look at [Nx](https://nx.dev/) documentation. For information, most of this monorepo follow the "Integrated Repo" philosophy.
7+
This README is a global README for the monorepo. Each package may have its own README. You can find them in the `packages/*/README.md` files.
88

9-
For VS Code users, we higlhy recommand the [official extension](https://nx.dev/core-features/integrate-with-editors#vscode-plugin:-nx-console). It will bring some UI on top of nx consol. It is based on the introspection of the monrepo `project.json` and `package.json` files, and thus can help you inspect/lauch all the targets of each projects.
9+
### Install pnpm
1010

11-
> There is also some community extensions for WebStorm and Neovim
11+
```bash
12+
brew install pnpm
13+
```
1214

13-
## Environment variables in Nx
15+
> NB: more installation options [here](https://pnpm.io/installation)
1416
15-
Nx task runner comes with [a built in opinionated way to handle env variables](https://nx.dev/recipes/environment-variables/define-environment-variables)
17+
To enable shell autocompletion (works for bash, zsh and fish), run:
18+
19+
```bash
20+
pnpm install-completion
21+
```
22+
23+
### Install dependancies
24+
25+
```bash
26+
pnpm install
27+
```
28+
29+
### Work in a package
30+
31+
Each packages are located in the `packages` folder. To work in a package, you can use the `--filter` option of `pnpm` to trigger the dedicated scripts present in each `packages/*/package.json`. Exemple to start the app builder in dev mode:
32+
33+
```bash
34+
# This will run the dev script in the ./packages/app-builder/package.json
35+
pnpm --filter app-builder run dev
36+
```
37+
38+
### Some usefull commands
39+
40+
```bash
41+
# Start the builder app in dev mode
42+
pnpm --filter app-builder run dev
43+
44+
# Generate the marble-api client
45+
pnpm --filter marble-api run generate-api
46+
47+
# Start the storybook in dev mode
48+
pnpm --filter ui-design-system run storybook
49+
50+
# Generate icons from svg files
51+
pnpm --filter ui-icons run generate-icons
52+
```

0 commit comments

Comments
 (0)