node docs and switch to pnpm
All checks were successful
Build, Test & Publish / Build (pull_request) Successful in 1m0s
Build, Test & Publish / Build and Publish Container Image (pull_request) Has been skipped
Build, Test & Publish / Deploy to Infrastructure (pull_request) Has been skipped

This commit is contained in:
2026-03-04 07:34:58 +11:00
parent bfc110e1c1
commit 80031f13b4
7 changed files with 1705 additions and 1826 deletions

View File

@@ -117,6 +117,14 @@ export default defineConfig({
{ text: 'Adding Nginx Site', link: '/nginx/adding-nginx-site' } { text: 'Adding Nginx Site', link: '/nginx/adding-nginx-site' }
] ]
}, },
{
text: 'Node',
link: '/node/',
collapsed: true,
items: [
{ text: 'Managing Node Versions', link: '/node/managing-versions' }
]
},
{ {
text: 'Nuxt', text: 'Nuxt',
link: '/nuxt/', link: '/nuxt/',

View File

@@ -2,21 +2,22 @@ FROM nginx:alpine AS base
EXPOSE 80 EXPOSE 80
WORKDIR /app WORKDIR /app
FROM node:20 as build FROM node:24 AS build
WORKDIR /src WORKDIR /src
# Copy package.json and package-lock.json # Copy package.json and package-lock.json
COPY package.json . COPY package.json .
COPY package-lock.json . COPY pnpm-lock.yaml .
# Install dependencies # Install dependencies
RUN npm ci RUN corepack enable
RUN pnpm install --frozen-lockfile
# Copy the app # Copy the app
COPY . . COPY . .
# Build the app # Build the app
RUN npm run build RUN pnpm run build
FROM base AS final FROM base AS final
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html

View File

@@ -46,6 +46,10 @@ hero:
text: Nginx text: Nginx
link: /nginx/ link: /nginx/
- theme: alt
text: Node
link: /node/
- theme: alt - theme: alt
text: Nuxt text: Nuxt
link: /nuxt/ link: /nuxt/

3
docs/node/index.md Normal file
View File

@@ -0,0 +1,3 @@
# Node.js Snippets and Musings
#### [Managing Node Versions](./managing-versions.md)

View File

@@ -0,0 +1,62 @@
# Managing Node Versions
Managing node versions is important for ensuring that different projects can run with the appropriate version of Node.JS.
Classically I used two different tools to manage node versions:
* **NVM** - a set of bash scripts for MacOS and Linux and
* **NVM-Windows** - a command line utility for Windows.
This quickly grew annoying as they operated slightly differently, and on Windows I like to use multiple accounts to split work and personal projects, which was not compatible with NVM-Windows.
## The Solution: mise-en-place ( or just "mise" )
Mise is a cross-platform tool for managing a wide range of development tools, including Node.JS. Being cross-platform, it works the same way on both Windows and Unix-based systems, making it easier to manage node versions across different environments. It also allows for per-project node versions, which is a great feature for ensuring that each project uses the correct version of Node.JS without affecting other projects.
### Installation
Install Mise using your package manager of choice depending on your operating system:
```bash
brew install mise # For MacOS
winget install jdx.mise # For Windows
sudo add-apt-repository -y ppa:jdxcode/mise && sudo apt update -y && sudo apt install -y mise # For Ubuntu/Debian
```
### Activation
Mise needs to be activated in your shell configuration file. Add the following line to your `.bashrc`, `.zshrc`, or equivalent shell configuration file:
```bash
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc # For Zsh
echo 'eval "$(mise activate bash)"' >> ~/.bashrc # For Bash
```
or windows:
```powershell
# create profile if it doesn't already exist
if (-not (Test-Path $profile)) { New-Item $profile -Force }
# open the profile
Invoke-Item $profile
# add this line
(&mise activate pwsh) | Out-String | Invoke-Expression
```
### Usage
Install Node globally:
```bash
mise use --global node@24
```
Install Node for a specific project:
```bash
cd my-project
mise use node@18
```
When installed in a project Mise will generate a project file in the directory, meaning other users can simply run `mise use` to get the correct version of Node.JS for that project.

1822
package-lock.json generated

File diff suppressed because it is too large Load Diff

1623
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff