node docs and switch to pnpm
This commit is contained in:
@@ -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/',
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
3
docs/node/index.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Node.js Snippets and Musings
|
||||||
|
|
||||||
|
#### [Managing Node Versions](./managing-versions.md)
|
||||||
62
docs/node/managing-versions.md
Normal file
62
docs/node/managing-versions.md
Normal 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
1822
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
1623
pnpm-lock.yaml
generated
Normal file
1623
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user