Skip to content

Commit

Permalink
chore: improve devcontainer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tinesoft committed Aug 9, 2024
1 parent d777457 commit 3c0a138
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4211],
// 4211 = nx graph port
// 4873 = verdaccio (local npm registry) port
"forwardPorts": [4211, 4873],
"runArgs": [],
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
Expand All @@ -44,10 +46,11 @@
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner",
"anweber.reveal-button",
"github.vscode-github-actions"
"github.vscode-github-actions",
"mutantdino.resourcemonitor" // to monitor cpu, memory usage from the dev containeréé
],
"settings": {
"debug.javascript.autoAttachFilter": "onlyWithFlag",
"debug.javascript.autoAttachFilter": "disabled",
"dotfiles.repository": "https://github.com/tinesoft/dotfiles"
}
}
Expand Down
19 changes: 13 additions & 6 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/bin/sh

# Install/Activate PNPM version defined in root package.json
corepack enable pnpm
# Uninstall globally installed PNPM (required version will be reinstalled through corepack)
echo "❌ Uninstalling globally installed PNPM..."
npm uninstall -g pnpm

# Prevent corepack from prompting user before downloading PNPM
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0

# Make sure 'node' user can access the 'node_modules' folder that will be mounted as a volume
# https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume
#sudo chown node node_modules
# Enable corepack
corepack enable

# Install dependencies
# Install the PNPM version defined in the root package.json
echo "⚙️ Installing required PNPM version..."
corepack prepare --activate

# Install NPM dependencies
echo "⚙️ Installing NPM dependencies..."
pnpm install --frozen-lockfile
2 changes: 2 additions & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tools/
/.devcontainer/

0 comments on commit 3c0a138

Please sign in to comment.