Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/bash__deploy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ jobs:
with:
fetch-depth: 1

- name: Set up Node.js and Yarn for yarn command
- name: Set up Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: '24.3.0'
registry-url: 'https://registry.yarnpkg.com'
node-version: 24.7.0
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.17.0

- name: Set up SSH config
run: |
Expand All @@ -49,5 +54,5 @@ jobs:
# Add SSH server key to known_hosts
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts

- name: Run bash file with yarn
run: yarn deploy:docker
- name: Run bash file with pnpm
run: pnpm deploy:docker
19 changes: 12 additions & 7 deletions .github/workflows/bash__deploy-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,22 @@ jobs:
git show -s --format='%h %s'
echo "github.ref -> {{ github.ref }}"

- name: Set up Node.js and Yarn
- name: Set up Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: '24.3.0'
registry-url: 'https://registry.yarnpkg.com'
node-version: 24.7.0
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.17.0

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Build app
run: yarn build
run: pnpm build

- name: Set up SSH config
run: |
Expand All @@ -63,5 +68,5 @@ jobs:
# Add SSH server key to known_hosts
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts

- name: Run bash file with yarn
run: yarn deploy:nginx
- name: Run bash file with pnpm
run: pnpm deploy:nginx
15 changes: 10 additions & 5 deletions .github/workflows/default__deploy-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ jobs:
git show -s --format='%h %s'
echo "github.ref -> {{ github.ref }}"

- name: Set up Node.js and Yarn
- name: Set up Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: '24.3.0'
registry-url: 'https://registry.yarnpkg.com'
node-version: 24.7.0
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.17.0

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

# fix this for turbo
- name: Build nemanjamiticcom
run: yarn build
run: pnpm build

- name: Clean up website dir
uses: appleboy/ssh-action@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages__deploy-astro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
uses: withastro/action@v2
with:
path: ./
node-version: 24.3.0
# package-manager: yarn@1.22.22
node-version: 24.7.0
package-manager: pnpm@10.17.0

deploy:
needs: build-astro
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/gh-pages__deploy-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,22 @@ jobs:
git show -s --format='%h %s'
echo "github.ref -> {{ github.ref }}"

- name: Set up Node.js and Yarn
- name: Set up Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: '24.3.0'
registry-url: 'https://registry.yarnpkg.com'
node-version: 24.7.0
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.17.0

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Build nemanjam.github.io
run: yarn build
run: pnpm build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dist
node_modules
.changeset
yarn.yaml
pnpm-lock.yaml
.turbo
.vercel
.astro
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"search.exclude": {
"package-lock.json": true,
"pnpm-lock.yaml": true,
"yarn.lock": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ PREVIEW_MODE=

```bash
# install packages
yarn install
pnpm install

# copy and set environment variables
cp .env.development.example .env.development

# run development server and visit http://localhost:3000
yarn dev
pnpm dev

# delete node_modules and yarn.lock
yarn clean
# delete node_modules and pnpm-lock.yaml
pnpm clean
```

#### Production
Expand All @@ -108,10 +108,10 @@ yarn clean
cp .env.production.example .env.production

# build website
yarn build
pnpm build

# run website and visit http://localhost:3000
yarn start
pnpm start
```

## Deployment
Expand Down Expand Up @@ -157,15 +157,15 @@ All Nginx deployments come down to building the website and copying the compiled
"build:nginx": "SITE_URL='https://nemanjamitic.com' astro build",

# build the app
yarn build:nginx
pnpm build:nginx

# configure ssh for your own "arm1" remote server in /home/username/.ssh/config

# copy compiled app from local /dist folder to Nginx web root on the remote server
"deploy:nginx": "bash scripts/deploy-nginx.sh '~/traefik-proxy/apps/nmc-nginx-with-volume/website' arm1",

# run deploy
yarn deploy:nginx
pnpm deploy:nginx
```

#### Github Actions
Expand Down Expand Up @@ -223,14 +223,14 @@ docker login my-user my-pass
"docker:build:push:arm": "docker buildx build -f ./docker/Dockerfile -t nemanjamitic/nemanjam.github.io --build-arg ARG_SITE_URL_ARM64='https://nmc-docker.arm1.nemanjamitic.com' --platform linux/arm64 --progress=plain --push .",

# build and push Docker image, replace "arm" with your architecture
yarn docker:build:push:arm
pnpm docker:build:push:arm

# replace "~/traefik-proxy/apps/nmc-docker" with your path to docker-compose.yml
# replace "nemanjamitic/nemanjam.github.io" with your image name
"deploy:docker": "bash scripts/deploy-docker.sh arm1 '~/traefik-proxy/apps/nmc-docker' nemanjamitic/nemanjam.github.io",

# pull and run latest image on your production server
yarn deploy:docker
pnpm deploy:docker
```

#### Github Actions
Expand Down
7 changes: 7 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'path';

import mdx from '@astrojs/mdx';
import partytown from '@astrojs/partytown';
import react from '@astrojs/react';
Expand Down Expand Up @@ -51,5 +53,10 @@ export default defineConfig({
// applies only to Vite dev server
allowedHosts: ['localhost', 'preview1.amd1.nemanjamitic.com'],
},
// import { z } from 'astro:content'; (collections) // must use zod v3 (with pnpm)
// import { z } from 'zod'; (config) // must use zod v4
ssr: {
noExternal: ['zod'],
},
},
});
17 changes: 12 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

# alpine is fine
# node:22.1.0-bookworm, node:20.13.1-slim, node:20.13.1-alpine
ARG NODE_IMAGE=node:24.3.0-alpine
ARG NODE_IMAGE=node:24.7.0-alpine

FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} AS base
WORKDIR /app

# for alpine
RUN apk add --no-cache git

# installs pnpm correctly
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

RUN corepack enable
RUN corepack prepare pnpm@10.17.0 --activate

FROM base AS build
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

COPY . .

Expand All @@ -29,7 +36,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
SITE_URL=$ARG_SITE_URL_AMD64; \
fi && \
echo "SITE_URL=$SITE_URL" && \
# must set SITE_URL via .env.production file for yarn build, important
# must set SITE_URL via .env.production file for pnpm build, important
# must use .env.production, .env doesn't work, my logic with dotenv in src/config/process-env.ts
echo SITE_URL=$SITE_URL > .env.production;

Expand All @@ -44,7 +51,7 @@ ARG ARG_PLAUSIBLE_DOMAIN
ENV PLAUSIBLE_DOMAIN=$ARG_PLAUSIBLE_DOMAIN
RUN echo "PLAUSIBLE_DOMAIN=$PLAUSIBLE_DOMAIN"

RUN yarn build
RUN pnpm build

FROM nginx:stable-alpine3.17-slim AS runtime
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
Expand Down
2 changes: 1 addition & 1 deletion docs/working-notes/todo4.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ PLAUSIBLE_SCRIPT_URL: 'https://plausible.arm1.nemanjamitic.com/js/script.js'
PLAUSIBLE_DOMAIN: 'nemanjamitic.com'
```


git checkout refactor/migrate-to-pnpm
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"sync": "astro sync",
"lint": "eslint --ext .astro,.tsx,.ts,.js,.mdx src",
"format": "prettier --write .",
"clean": "rm -rf node_modules yarn.lock",
"clean": "rm -rf node_modules pnpm-lock.yaml",
"up": "pnpm upgrade-interactive --latest",
"check-types": "tsc --noEmit --pretty",
"deploy:nginx": "bash scripts/deploy-nginx.sh '~/traefik-proxy/apps/nmc-nginx-with-volume/website' arm1",
"deploy:nginx:local": "bash scripts/deploy-nginx.sh '~/traefik-proxy/apps/nmc-nginx-with-volume/website' lxc11",
Expand All @@ -25,13 +26,14 @@
"docker:build:push:arm": "docker buildx build -f ./docker/Dockerfile -t nemanjamitic/nemanjam.github.io --build-arg ARG_SITE_URL_ARM64='https://nmc-docker.arm1.nemanjamitic.com' --build-arg ARG_PLAUSIBLE_SCRIPT_URL='https://plausible.arm1.nemanjamitic.com/js/script.js' --build-arg ARG_PLAUSIBLE_DOMAIN='nemanjamitic.com' --platform linux/arm64 --progress=plain --push .",
"docker:build:push:x86": "docker buildx build -f ./docker/Dockerfile -t nemanjamitic/nemanjam.github.io --build-arg ARG_SITE_URL_AMD64='https://nmc-docker.local.nemanjamitic.com' --build-arg ARG_PLAUSIBLE_SCRIPT_URL='https://plausible.arm1.nemanjamitic.com/js/script.js' --build-arg ARG_PLAUSIBLE_DOMAIN='nemanjamitic.com' --platform linux/amd64 --push --progress=plain .",
"docker:push": "docker push nemanjamitic/nemanjam.github.io",
"pi": "yarn build:nginx:pi && yarn deploy:nginx:pi",
"local": "yarn build:nginx:local && yarn deploy:nginx:local",
"nginx": "yarn build:nginx && yarn deploy:nginx",
"pi": "pnpm build:nginx:pi && pnpm deploy:nginx:pi",
"local": "pnpm build:nginx:local && pnpm deploy:nginx:local",
"nginx": "pnpm build:nginx && pnpm deploy:nginx",
"tunnel": "ssh -R *:1081:localhost:3000 amd1c",
"dc:up": "docker compose up --build --force-recreate -d"
},
"dependencies": {
"@astrojs/markdown-remark": "^6.3.6",
"@astrojs/mdx": "^4.3.5",
"@astrojs/partytown": "^2.1.4",
"@astrojs/react": "^4.3.1",
Expand Down Expand Up @@ -65,7 +67,7 @@
"tailwind-merge": "^2.6.0",
"zod": "^4.1.9"
},
"resolutions": {
"overrides": {
"**/sharp": "0.34.3"
},
"devDependencies": {
Expand Down Expand Up @@ -94,8 +96,8 @@
"tailwindcss": "^3.4.15",
"typescript": "^5.9.2"
},
"packageManager": "yarn@1.22.22",
"packageManager": "pnpm@10.17.0",
"engines": {
"node": ">=v24.3.0"
"node": ">=v24.7.0"
}
}
Loading
Loading