499648a90b
Some checks failed
Monaco Editor checks / Monaco Editor checks (push) Failing after 35m27s
142 lines
2.3 KiB
Markdown
142 lines
2.3 KiB
Markdown
最后更改日期:2024.11.01 00:41
|
||
|
||
系统环境 win11家庭版
|
||
|
||
源码版本 1.96.0
|
||
|
||
node版本 20.18.0 长期支持版
|
||
|
||
python版本 3.10.4
|
||
|
||
vs_BuildTools版本 2022
|
||
|
||
|
||
|
||
# 0 下载源文件
|
||
|
||
进入 https://github.com/microsoft/vscode
|
||
|
||
使用git clone或者下载zip都行
|
||
|
||
注意:
|
||
|
||
**源码需要在git仓库中才能跑完依赖**
|
||
|
||
|
||
|
||
所以需要对项目文件夹执行:
|
||
|
||
```
|
||
git init
|
||
```
|
||
|
||
|
||
|
||
# 1 安装Node.js
|
||
|
||
这里使用原生安装,设置好没有空格的安装路径后一路点继续
|
||
|
||
|
||
|
||
**警告:**
|
||
|
||
**fnm在win11上需要配置poweshell有点麻烦故不使用。**
|
||
|
||
**nvm use <node版本> 实质上会复制一个你use的 <node版本>到C:/ [Program Files](C:\Program Files),而这个路径上的空格会引起node-gyp 错误导致安装依赖失败。**
|
||
|
||
|
||
|
||
# 2 安装 C/C++ compiler tool
|
||
|
||
依照官网文档下载vs_BuildTools,选择安装c++构建工具,
|
||
|
||
然后进入“单个组件”安装:
|
||
|
||
- `MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)`(用于`ARM64`ARM 上的 Windows,但可能仍然需要 x64/x86)
|
||
- `C++ ATL for latest build tools with Spectre Mitigations`
|
||
- `C++ MFC for latest build tools with Spectre Mitigations`
|
||
|
||
|
||
|
||
官方bulid指南:
|
||
|
||
https://github.com/microsoft/vscode/wiki/How-to-Contribute
|
||
|
||
|
||
|
||
# 3 配置 npm config
|
||
|
||
创建缓存文件夹例如npm-cache, 我这里选择在c盘根目录创建最后路径如下:
|
||
|
||
```
|
||
C:\npm-cache
|
||
```
|
||
|
||
打开powershell输入
|
||
|
||
```
|
||
npm config edit
|
||
```
|
||
|
||
随后复制:
|
||
|
||
```
|
||
cache=C:\npm-cache
|
||
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
|
||
electron_mirror=https://cdn.npmmirror.com/binaries/electron/
|
||
msvs_version=2022
|
||
proxy=http://127.0.0.1:7890
|
||
registry=https://registry.npmjs.org
|
||
|
||
```
|
||
|
||
包括配置缓存,electron源,msvs路径,配置代理,最后选择官方源
|
||
|
||
|
||
|
||
|
||
|
||
# 4 安装依赖
|
||
|
||
挂好打理
|
||
|
||
使用:
|
||
|
||
```
|
||
npm ci
|
||
```
|
||
|
||
细心等待所以依赖安装完成,截至文档第一次编写大概需要1500多个包
|
||
|
||
|
||
|
||
# 5 运行
|
||
|
||
如果安装依赖一切无误
|
||
|
||
运行
|
||
|
||
```
|
||
npm run watch
|
||
```
|
||
|
||
或者按下
|
||
|
||
Ctrl+ Shift+ B
|
||
|
||
|
||
|
||
等待编译完成
|
||
|
||
如果一切无误
|
||
|
||
vscode中按下 F5 即会出现目标程序
|
||
|
||
|
||
|
||
## 提交
|
||
|
||
vscode内部设置了验证不允许中文注释提交,使用以下语句以跳过验证
|
||
|
||
git commit -m "新建了一个 contrib Demo 成功创建图标到侧边栏" --no-verify
|