-
Notifications
You must be signed in to change notification settings - Fork 160
Upgrade pnpm to v10, and dev container updates #1228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c2da5fc
feat: remove hardhat-dependency-compiler from contracts/test
RembrandtK b5848df
feat(build): upgrade pnpm from v9 to v10
RembrandtK b7f507a
feat(container): update and simplify dev container config
RembrandtK cd59452
chore: add core dump files to .gitignore
RembrandtK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,15 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:debian | ||
|
||
# Set non-interactive frontend for apt | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 | ||
|
||
# Switch to root for installing packages | ||
USER root | ||
|
||
# Install additional dependencies | ||
RUN apt update && apt install -y \ | ||
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y \ | ||
build-essential \ | ||
curl \ | ||
jq \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv \ | ||
pipx \ | ||
&& apt clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Node.js 20.x using NodeSource | ||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | ||
apt update && \ | ||
apt install -y nodejs && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Solidity compiler using pipx (isolated environment) | ||
RUN pipx install solc-select && \ | ||
pipx ensurepath && \ | ||
/root/.local/bin/solc-select install 0.8.27 && \ | ||
/root/.local/bin/solc-select use 0.8.27 && \ | ||
# Copy binaries to /usr/local/bin with proper permissions (not symlinks) | ||
cp /root/.local/bin/solc /usr/local/bin/solc && \ | ||
cp /root/.local/bin/solc-select /usr/local/bin/solc-select && \ | ||
chmod 755 /usr/local/bin/solc && \ | ||
chmod 755 /usr/local/bin/solc-select && \ | ||
# Make sure pipx directory is accessible | ||
chmod -R a+rx /root/.local/pipx && \ | ||
# Set up for vscode user | ||
mkdir -p /home/vscode/.solc-select && \ | ||
cp -r /root/.solc-select/* /home/vscode/.solc-select/ && \ | ||
chown -R vscode:vscode /home/vscode/.solc-select | ||
|
||
RUN npm install -g [email protected] | ||
|
||
# Install cloc for code analysis | ||
RUN npm install -g cloc | ||
|
||
# Install Foundry for Anvil (as root for global installation) | ||
RUN curl -L https://foundry.paradigm.xyz | bash && \ | ||
/root/.foundry/bin/foundryup && \ | ||
|
@@ -61,10 +24,6 @@ RUN curl -L https://foundry.paradigm.xyz | bash && \ | |
chmod 755 /usr/local/bin/forge && \ | ||
chmod 755 /usr/local/bin/chisel | ||
|
||
# Set up pnpm | ||
RUN corepack enable && \ | ||
corepack prepare [email protected] --activate | ||
|
||
# Ensure all users have access to the tools | ||
RUN chmod 755 /usr/local/bin/* && \ | ||
# Create a directory for vscode user's binaries | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,27 +13,6 @@ The dev container provides a consistent development environment with caching to | |
1. **Docker Compose Configuration**: Defines the container setup, volume mounts, and environment variables | ||
2. **Dockerfile**: Specifies the container image and installed tools | ||
3. **project-setup.sh**: Configures the environment after container creation | ||
4. **host-setup.sh**: Sets up the host environment before starting the container | ||
5. **setup-git-signing.sh**: Automatically configures Git to use SSH signing with forwarded SSH keys | ||
|
||
## Cache System | ||
|
||
The container uses a conservative caching approach to prevent cache corruption issues: | ||
|
||
1. **Local Cache Directories**: Each container instance maintains its own cache directories | ||
- `vscode-cache` → `/home/vscode/.cache` (VS Code cache) | ||
- `vscode-config` → `/home/vscode/.config` (VS Code configuration) | ||
- `vscode-data` → `/home/vscode/.local/share` (VS Code data) | ||
- `vscode-bin` → `/home/vscode/.local/bin` (User binaries) | ||
|
||
2. **Safe Caches Only**: Only caches that won't cause cross-branch issues are configured | ||
- GitHub CLI: `/home/vscode/.cache/github` | ||
- Python packages: `/home/vscode/.cache/pip` | ||
|
||
3. **Intentionally Not Cached**: These tools use their default cache locations to avoid contamination | ||
- NPM (different dependency versions per branch) | ||
- Foundry, Solidity (different compilation artifacts per branch) | ||
- Hardhat (different build artifacts per branch) | ||
|
||
## Setup Instructions | ||
|
||
|
@@ -48,7 +27,7 @@ To start the dev container: | |
When the container starts, the `project-setup.sh` script will automatically run and: | ||
|
||
- Install project dependencies using pnpm | ||
- Configure Git to use SSH signing with your forwarded SSH key | ||
- Configure basic Git settings (user.name, user.email) from environment variables | ||
- Source shell customizations if available in PATH | ||
|
||
## Environment Variables | ||
|
@@ -60,10 +39,10 @@ Environment variables are defined in two places: | |
|
||
### Git Configuration | ||
|
||
To enable Git commit signing, add the following settings to your environment file: | ||
To configure Git user settings, add the following to your environment file: | ||
|
||
```env | ||
# Git settings for commit signing | ||
# Git settings | ||
GIT_USER_NAME=Your Name | ||
[email protected] | ||
``` | ||
|
@@ -72,34 +51,20 @@ These environment variables are needed for Git commit signing to work properly. | |
|
||
## Troubleshooting | ||
|
||
### Cache Issues | ||
### Build Issues | ||
|
||
If you encounter build or compilation issues that seem related to cached artifacts: | ||
If you encounter build or compilation issues: | ||
|
||
1. **Rebuild the container**: This will start with fresh local caches | ||
1. **Rebuild the container**: This will start with fresh isolated caches | ||
2. **Clean project caches**: Run `pnpm clean` to clear project-specific build artifacts | ||
3. **Clear node modules**: Delete `node_modules` and run `pnpm install` again | ||
|
||
### Git SSH Signing Issues | ||
### Git Authentication Issues | ||
|
||
If you encounter issues with Git SSH signing: | ||
If you encounter issues with Git operations: | ||
|
||
1. **SSH Agent Forwarding**: Make sure SSH agent forwarding is properly set up in your VS Code settings | ||
2. **GitHub Configuration**: Ensure your SSH key is added to GitHub as a signing key in your account settings | ||
3. **Manual Setup**: If automatic setup fails, you can manually configure SSH signing: | ||
|
||
```bash | ||
# Check available SSH keys | ||
ssh-add -l | ||
|
||
# Configure Git to use SSH signing | ||
git config --global gpg.format ssh | ||
git config --global user.signingkey "key::ssh-ed25519 YOUR_KEY_CONTENT" | ||
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers | ||
git config --global commit.gpgsign true | ||
|
||
# Create allowed signers file | ||
echo "[email protected] ssh-ed25519 YOUR_KEY_CONTENT" > ~/.ssh/allowed_signers | ||
``` | ||
1. **GitHub CLI**: Use `gh auth login` to authenticate with GitHub | ||
2. **Git Configuration**: Set user.name and user.email if not configured via environment variables | ||
3. **Commit Signing**: Handle commit signing on your host machine for security | ||
|
||
For other issues, check the `project-setup.sh` and `setup-git-signing.sh` scripts for any errors. | ||
For other issues, check the `project-setup.sh` script for any errors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,28 @@ sudo chmod -R 755 /home/vscode/.cache /home/vscode/.config /home/vscode/.local | |
|
||
echo "User directories set up with proper permissions" | ||
|
||
# Install Solidity compiler (moved from Dockerfile since Python/pipx is now available) | ||
echo "Installing Solidity compiler..." | ||
pipx install solc-select | ||
pipx ensurepath | ||
solc-select install 0.8.27 | ||
solc-select use 0.8.27 | ||
|
||
# Upgrade npm to latest version for better compatibility and security | ||
echo "Upgrading npm to latest version..." | ||
npm install -g npm@latest | ||
|
||
npm install -g [email protected] cloc @anthropic-ai/claude-code | ||
|
||
# Set up pnpm with correct version (matching package.json) | ||
echo "Setting up pnpm..." | ||
corepack enable | ||
corepack prepare [email protected] --activate | ||
|
||
# Verify pnpm is working | ||
echo "Verifying pnpm installation..." | ||
pnpm --version | ||
|
||
# Install project dependencies | ||
echo "Installing project dependencies..." | ||
if [ -f "$REPO_ROOT/package.json" ]; then | ||
|
@@ -72,11 +94,18 @@ else | |
echo "Shell customizations not found in PATH, skipping..." | ||
fi | ||
|
||
# Set up Git SSH signing | ||
if [ -f "$SCRIPT_DIR/setup-git-signing.sh" ]; then | ||
"$SCRIPT_DIR/setup-git-signing.sh" | ||
# Set up basic Git configuration (user.name and user.email from environment) | ||
echo "Setting up basic Git configuration..." | ||
if [[ -n "${GIT_USER_NAME:-}" && -n "${GIT_USER_EMAIL:-}" ]]; then | ||
echo "Setting Git user.name: $GIT_USER_NAME" | ||
git config --global user.name "$GIT_USER_NAME" | ||
echo "Setting Git user.email: $GIT_USER_EMAIL" | ||
git config --global user.email "$GIT_USER_EMAIL" | ||
echo "Git user configuration complete" | ||
else | ||
echo "WARNING: setup-git-signing.sh not found, skipping Git SSH signing setup" | ||
echo "GIT_USER_NAME and/or GIT_USER_EMAIL not set - skipping Git user configuration" | ||
echo "You can set these manually with: git config --global user.name 'Your Name'" | ||
echo "and: git config --global user.email '[email protected]'" | ||
fi | ||
|
||
echo "Project-specific setup completed" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"license": "GPL-2.0-or-later", | ||
"repository": "[email protected]:graphprotocol/contracts.git", | ||
"author": "The Graph team", | ||
"packageManager": "pnpm@9.0.6+sha1.648f6014eb363abb36618f2ba59282a9eeb3e879", | ||
"packageManager": "pnpm@10.17.0", | ||
"scripts": { | ||
"postinstall": "husky", | ||
"clean": "pnpm -r run clean", | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.