Skip to content

Commit

Permalink
Merge pull request #32 from joshuanianji/docs
Browse files Browse the repository at this point in the history
(docs) Edit `mount-pnpm-store` docs
  • Loading branch information
joshuanianji authored Jan 1, 2024
2 parents 40855a1 + 5bca4f4 commit 04a1a0e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ This repo contains my custom devcontainer features.
| [terraform-cli-persistence](./src/terraform-cli-persistence) | Avoid extra logins from the Terraform CLI by preserving the `~/.terraform.d` folder across container instances. |
| [aws-cli-persistence](./src/aws-cli-persistence) | Avoid extra logins from the AWS CLI by preserving the `~/.aws` folder across container instances. |
| [lamdera](./src/lamdera) | Installs [Lamdera](https://dashboard.lamdera.app/), a type-safe full-stack web-app platform for Elm (v1.1.0 and later). |
| [mount-pnpm-store](./src/mount-pnpm-store) | Mounts the pnpm store to a volume to share between multiple devcontainers. |
10 changes: 7 additions & 3 deletions src/mount-pnpm-store/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## Important Implementation Details

### Ensuring PNPM is installed
### pnpm `store-dir`

This feature does not install PNPM by itself and expects `pnpm` to be installed already, either by a base image or by a feature. It fails quietly if pnpm is not installed.
This is opinionated, but I dislike the pnpm store being in the workspace as it adds clutter. This feature sets the pnpm `store-dir` config to `~/.pnpm-store`, so it's out of sight. The home directory will be based on the `remoteUser` of the base image you have.

### Ensuring pnpm is installed

This feature does not install pnpm by itself and expects `pnpm` to be installed already, either by a base image or by a feature. It fails quietly if pnpm is not installed.

If you are installing pnpm with a feature, you may need to ensure it is run **before** `mount-pnpm-store`. To make this work, use the [`overrideFeatureInstallOrder` property](https://containers.dev/implementors/features/#overrideFeatureInstallOrder), since the default feature installation order is based on ID (alphanumerically i think). Here is an example using `features/node`:

Expand Down Expand Up @@ -32,4 +36,4 @@ The volume mount is called `global-devcontainer-pnpm-store`, so ensure that no o

## References

- [PNPM Devcontainer Setup by PatrickChoDev](https://gist.github.com/PatrickChoDev/81d36159aca4dc687b8c89983e64da2e)
- [Pnpm Devcontainer Setup by PatrickChoDev](https://gist.github.com/PatrickChoDev/81d36159aca4dc687b8c89983e64da2e)
4 changes: 2 additions & 2 deletions src/mount-pnpm-store/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Mount PNPM Store",
"name": "Mount pnpm Store",
"id": "mount-pnpm-store",
"version": "0.0.0",
"version": "0.1.0",
"documentationURL": "https://github.com/joshuanianji/devcontainer-features/tree/main/src/mount-pnpm-store",
"description": "Mounts the pnpm store to a volume to share between multiple devcontainers, and sets pnpm store to ~/.pnpm-store. Fails if pnpm is not installed.",
"options": {},
Expand Down
2 changes: 0 additions & 2 deletions src/mount-pnpm-store/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ if [ -e "$_REMOTE_USER_HOME/.pnpm-store" ]; then
fi

ln -s /dc/mounted-pnpm-store "$_REMOTE_USER_HOME/.pnpm-store"
# chown the entire `.config` folder because devcontainers creates
# a `~/.config/vscode-dev-containers` folder later on
chown -R "$_REMOTE_USER:$_REMOTE_USER" "$_REMOTE_USER_HOME/.pnpm-store"

# chown mount (only attached on startup)
Expand Down

0 comments on commit 04a1a0e

Please sign in to comment.