build(devcontainer): 优化 zsh 配置与 pnpm 环境设置
This commit is contained in:
@@ -73,15 +73,14 @@ USER usr_vscode
|
|||||||
|
|
||||||
# 配置 Zsh https://github.com/deluan/zsh-in-docker/releases
|
# 配置 Zsh https://github.com/deluan/zsh-in-docker/releases
|
||||||
# Default powerline10k theme
|
# Default powerline10k theme
|
||||||
RUN touch /home/usr_vscode/.zshrc \
|
RUN sh -c "$(curl -L -o - https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
|
||||||
&& sh -c "$(curl -L -o - https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
|
-p git \
|
||||||
-p git \
|
-p fzf \
|
||||||
-p fzf \
|
-a "source <(fzf --zsh)" \
|
||||||
-a "source <(fzf --zsh)" \
|
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
||||||
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
-x \
|
||||||
-x \
|
# -a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
||||||
# -a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
# -a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
||||||
# -a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
|
||||||
# https://github.com/deluan/zsh-in-docker/blob/55a4e476f78f37204af9dfc0290a92e52cf881b1/zsh-in-docker.sh#L121-L123
|
# https://github.com/deluan/zsh-in-docker/blob/55a4e476f78f37204af9dfc0290a92e52cf881b1/zsh-in-docker.sh#L121-L123
|
||||||
&& sed -i 's/^export LANG=.*/export LANG="zh_CN.UTF-8"/' /home/usr_vscode/.zshrc \
|
&& sed -i 's/^export LANG=.*/export LANG="zh_CN.UTF-8"/' /home/usr_vscode/.zshrc \
|
||||||
&& sed -i 's/^export LANGUAGE=.*/export LANGUAGE="zh_CN:zh"/' /home/usr_vscode/.zshrc \
|
&& sed -i 's/^export LANGUAGE=.*/export LANGUAGE="zh_CN:zh"/' /home/usr_vscode/.zshrc \
|
||||||
@@ -95,11 +94,6 @@ RUN touch /home/usr_vscode/.zshrc \
|
|||||||
# https://pnpm.io/installation#in-a-docker-container
|
# https://pnpm.io/installation#in-a-docker-container
|
||||||
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.zshrc" SHELL="$(which zsh)" zsh - \
|
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.zshrc" SHELL="$(which zsh)" zsh - \
|
||||||
&& pnpm --version \
|
&& pnpm --version \
|
||||||
&& pnpm env use lts --global \
|
# /home/usr_vscode/.config/pnpm/rc
|
||||||
&& pnpm config set store-dir /home/usr_vscode/.pnpm-store
|
&& pnpm config set store-dir /home/usr_vscode/.pnpm-store \
|
||||||
|
&& pnpm env use lts --global
|
||||||
# 安装 AI 工具
|
|
||||||
RUN pnpm install -g \
|
|
||||||
@google/gemini-cli@latest \
|
|
||||||
@anthropic-ai/claude-code@latest \
|
|
||||||
@musistudio/claude-code-router@latest
|
|
||||||
|
|||||||
@@ -89,13 +89,12 @@
|
|||||||
},
|
},
|
||||||
"remoteUser": "usr_vscode",
|
"remoteUser": "usr_vscode",
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=${localWorkspaceFolderBasename}--bashhistory,target=/commandhistory,type=volume",
|
"source=${localWorkspaceFolderBasename}---bashhistory,target=/commandhistory,type=volume",
|
||||||
"source=${localWorkspaceFolderBasename}--lingma,target=/home/usr_vscode/.lingma,type=volume",
|
"source=${localWorkspaceFolderBasename}---gemini,target=/home/usr_vscode/.gemini,type=volume",
|
||||||
"source=${localWorkspaceFolderBasename}--gemini,target=/home/usr_vscode/.gemini,type=volume",
|
"source=${localWorkspaceFolderBasename}---claude-code-router,target=/home/usr_vscode/.claude-code-router,type=volume",
|
||||||
"source=${localWorkspaceFolderBasename}--claude-code-router,target=/home/usr_vscode/.claude-code-router,type=volume",
|
"source=${localWorkspaceFolderBasename}---claude-code,target=/home/usr_vscode/.claude,type=volume",
|
||||||
"source=${localWorkspaceFolderBasename}--claude-code-config,target=/home/usr_vscode/.claude,type=volume",
|
"source=${localWorkspaceFolderBasename}---pnpm-store,target=/home/usr_vscode/.pnpm-store,type=volume",
|
||||||
"source=${localWorkspaceFolderBasename}--pnpm-store,target=/home/usr_vscode/.pnpm-store,type=volume",
|
"source=${localWorkspaceFolderBasename}---node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
|
||||||
"source=${localWorkspaceFolderBasename}--node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,13 +112,15 @@
|
|||||||
"initializeCommand": /* 本地执行(容器创建前) */ "echo '准备创建容器...'",
|
"initializeCommand": /* 本地执行(容器创建前) */ "echo '准备创建容器...'",
|
||||||
"onCreateCommand": /* 容器内执行(仅首次创建) */ {
|
"onCreateCommand": /* 容器内执行(仅首次创建) */ {
|
||||||
"fix-claude-code-router": "sudo chown -R usr_vscode /home/usr_vscode/.claude-code-router",
|
"fix-claude-code-router": "sudo chown -R usr_vscode /home/usr_vscode/.claude-code-router",
|
||||||
"fix-lingma": "sudo chown -R usr_vscode /home/usr_vscode/.lingma",
|
|
||||||
"fix-claude": "sudo chown -R usr_vscode /home/usr_vscode/.claude",
|
"fix-claude": "sudo chown -R usr_vscode /home/usr_vscode/.claude",
|
||||||
"fix-gemini": "sudo chown -R usr_vscode /home/usr_vscode/.gemini",
|
"fix-gemini": "sudo chown -R usr_vscode /home/usr_vscode/.gemini",
|
||||||
"fix-node_modules": "sudo chown usr_vscode node_modules;"
|
"fix-node_modules": "sudo chown usr_vscode node_modules"
|
||||||
|
},
|
||||||
|
"updateContentCommand": /* 容器内执行(创建后或内容更新) */ "pnpm install",
|
||||||
|
"postCreateCommand": /* 容器内执行(创建完成后) */ {
|
||||||
|
// pnpm env use lts --global
|
||||||
|
"install-global-cli": "pnpm install -g @google/gemini-cli@latest @anthropic-ai/claude-code@latest @musistudio/claude-code-router@latest"
|
||||||
},
|
},
|
||||||
"updateContentCommand": /* 容器内执行(创建后或内容更新) */ "echo '更新内容...'",
|
|
||||||
"postCreateCommand": /* 容器内执行(创建完成后) */ "pnpm install",
|
|
||||||
"postStartCommand": /* 容器内执行(每次启动) */ "echo '容器已启动!'",
|
"postStartCommand": /* 容器内执行(每次启动) */ "echo '容器已启动!'",
|
||||||
"postAttachCommand": /* 容器内执行(每次附加) */ "echo '开发环境已就绪!${containerWorkspaceFolder}'",
|
"postAttachCommand": /* 容器内执行(每次附加) */ "echo '开发环境已就绪!${containerWorkspaceFolder}'",
|
||||||
// "updateRemoteUserUID": true,
|
// "updateRemoteUserUID": true,
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -1,11 +1,16 @@
|
|||||||
{
|
{
|
||||||
"packageManager": "pnpm@10.18.3",
|
"packageManager": "pnpm@10.20.0",
|
||||||
"name": "vue-ts-example-2025",
|
"name": "vue-ts-example-2025",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"devEngines": {
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
"runtime": {
|
||||||
|
"name": "node",
|
||||||
|
"version": "^24.11.0",
|
||||||
|
"onFail": "download",
|
||||||
|
"_docs_": "https://pnpm.io/zh/package_json#devenginesruntime"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_all": "run-s lint format:prettier type-check test:unit:DisableWatch build-only",
|
"_all": "run-s lint format:prettier type-check test:unit:DisableWatch build-only",
|
||||||
|
|||||||
95
pnpm-lock.yaml
generated
95
pnpm-lock.yaml
generated
@@ -195,6 +195,9 @@ importers:
|
|||||||
lint-staged:
|
lint-staged:
|
||||||
specifier: ^16.1.6
|
specifier: ^16.1.6
|
||||||
version: 16.2.4
|
version: 16.2.4
|
||||||
|
node:
|
||||||
|
specifier: runtime:^24.11.0
|
||||||
|
version: runtime:24.11.0
|
||||||
npm-run-all2:
|
npm-run-all2:
|
||||||
specifier: ^8.0.4
|
specifier: ^8.0.4
|
||||||
version: 8.0.4
|
version: 8.0.4
|
||||||
@@ -4498,6 +4501,96 @@ packages:
|
|||||||
node-releases@2.0.20:
|
node-releases@2.0.20:
|
||||||
resolution: {integrity: sha512-7gK6zSXEH6neM212JgfYFXe+GmZQM+fia5SsusuBIUgnPheLFBmIPhtFoAQRj8/7wASYQnbDlHPVwY0BefoFgA==}
|
resolution: {integrity: sha512-7gK6zSXEH6neM212JgfYFXe+GmZQM+fia5SsusuBIUgnPheLFBmIPhtFoAQRj8/7wASYQnbDlHPVwY0BefoFgA==}
|
||||||
|
|
||||||
|
node@runtime:24.11.0:
|
||||||
|
resolution:
|
||||||
|
type: variations
|
||||||
|
variants:
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-AVGoDHkzXAEx+qQIOkGjWIQ1rqFNz2aDBq0+q/3nG2U=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-aix-ppc64.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: ppc64
|
||||||
|
os: aix
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-C+KrKBak+gLRrP8BSkNPKfVtjZVvWvapi3DO1sX00gE=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-darwin-arm64.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: arm64
|
||||||
|
os: darwin
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-OIRnHof0b3c4MtmKCmyrzF7E9jcITw81FbaeZuon8vE=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-darwin-x64.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: x64
|
||||||
|
os: darwin
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-R4bQDE0lnT/wsjKDB/dk7zztZfLW6VAtQz5o1mI4UJ0=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-linux-arm64.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: arm64
|
||||||
|
os: linux
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-fnukMm/oWI8R52PFUhe89F9eC3vL8eJru7siJamuRyE=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-linux-ppc64le.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: ppc64le
|
||||||
|
os: linux
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-evDZLnSweiuOkQie5PzMe1Qz/YtjJZvO06NGaJmMvfc=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-linux-s390x.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: s390x
|
||||||
|
os: linux
|
||||||
|
- resolution:
|
||||||
|
archive: tarball
|
||||||
|
bin: bin/node
|
||||||
|
integrity: sha256-s8BxzfR6q4Z8OyqihyV98S7F18liv5IrMv0zImxClf0=
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-linux-x64.tar.gz
|
||||||
|
targets:
|
||||||
|
- cpu: x64
|
||||||
|
os: linux
|
||||||
|
- resolution:
|
||||||
|
archive: zip
|
||||||
|
bin: node.exe
|
||||||
|
integrity: sha256-EtOxqpaWt0EeEVpPoq71f5VWC17ha7Ys1phD5TXscr4=
|
||||||
|
prefix: node-v24.11.0-win-arm64
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-win-arm64.zip
|
||||||
|
targets:
|
||||||
|
- cpu: arm64
|
||||||
|
os: win32
|
||||||
|
- resolution:
|
||||||
|
archive: zip
|
||||||
|
bin: node.exe
|
||||||
|
integrity: sha256-EFRUC84itU7H5Q68B47F0JBwCndldgelj2pk3yH0n90=
|
||||||
|
prefix: node-v24.11.0-win-x64
|
||||||
|
type: binary
|
||||||
|
url: https://nodejs.org/download/release/v24.11.0/node-v24.11.0-win-x64.zip
|
||||||
|
targets:
|
||||||
|
- cpu: x64
|
||||||
|
os: win32
|
||||||
|
version: 24.11.0
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
nopt@7.2.1:
|
nopt@7.2.1:
|
||||||
resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==}
|
resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==}
|
||||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||||
@@ -10375,6 +10468,8 @@ snapshots:
|
|||||||
|
|
||||||
node-releases@2.0.20: {}
|
node-releases@2.0.20: {}
|
||||||
|
|
||||||
|
node@runtime:24.11.0: {}
|
||||||
|
|
||||||
nopt@7.2.1:
|
nopt@7.2.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
abbrev: 2.0.0
|
abbrev: 2.0.0
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
packages:
|
packages:
|
||||||
- 'packages/*'
|
- 'packages/*'
|
||||||
|
# useNodeVersion: 24.11.0 # https://pnpm.io/zh/settings#usenodeversion
|
||||||
useNodeVersion: 24.11.0 # https://pnpm.io/zh/settings#usenodeversion
|
|
||||||
# shamefullyHoist: false # https://pnpm.io/zh/settings#shamefullyhoist
|
# shamefullyHoist: false # https://pnpm.io/zh/settings#shamefullyhoist
|
||||||
|
|
||||||
# https://pnpm.io/zh/settings#node-mirror ???
|
# https://pnpm.io/zh/settings#node-mirror ???
|
||||||
|
|||||||
Reference in New Issue
Block a user