Skip to content
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

chore: node version locked #355

Merged
merged 6 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ G6VP 产品中包含了很多的惊喜功能,大家可以前往「开放市场

## 02. 开发 G6VP

G6VP 采用 pnpm 管理仓库,根据 pnpm 的官方[兼容性说明](https://pnpm.io/installation#compatibility),请提前使用 nvm 切换 Node.js 版本到 14 及其以上
G6VP 采用 pnpm 包管理工具,并使用 Node 16 进行开发。Node 版本过高在安装依赖和运行 NPM 脚本时可能存在问题,建议使用 [nvm](https://github.com/nvm-sh/nvm) 管理 Node 版本

### 2.1 安装依赖

Expand Down
12 changes: 2 additions & 10 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,7 @@
| packages/gi-portal | `-` | G6VP 首页 |
| packages/gi-httpservice | `@antv/gi-httpservices` | G6VP BFF 服务 |

### 02 进入到每个子包中启动,遇到依赖找不到的问题

注意 ⚠️: cd 到每个子包的目录时候,一定要注意查看 node 的版本,比如我的默认 node 版本是 12, 切换到 16 装完所有依赖,此时进入到每个子包中, node 的版本自动切换到 12,执行命令是找不到安装的依赖的,所以得重新 `nvm use 16`,这样就可以了,如果想一劳永逸,可以在 zsh terminal 中设置

```bash
nvm alias default v16.17.0
```

### 03 如何发布版本
### 02 如何发布版本

G6VP 采用 [changesets](https://pnpm.io/using-changesets) 来进行包版本管理和发布,因此不需要手动维护版本号,只需要在提交代码时,使用`pnpm run changeset`来生成对应的版本号即可。

Expand Down Expand Up @@ -88,6 +80,6 @@ cd packages/gi-site
npm run deploy
```

### 04 如何打包 gi-httpservice
### 03 如何打包 gi-httpservice

- 在根目录下执行 `npm run tar:gi-httpservice`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"engines": {
"node": ">=14.0.0"
"node": "^16"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down
4 changes: 2 additions & 2 deletions packages/gi-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"main": "dist/app.js",
"scripts": {
"analyse": "ANALYZE=1 NODE_OPTIONS=--max_old_space_size=4096 umi build",
"build": "node scripts/pre-build.mjs && NODE_OPTIONS=--max_old_space_size=4096 umi build",
"build": "node --experimental-json-modules scripts/pre-build.mjs && NODE_OPTIONS=--max_old_space_size=4096 umi build",
"build:docker": "cd ../../ && npm run build:all:umd && cd packages/gi-site/ && BUILD_MODE=docker node scripts/pre-build.mjs && node scripts/copy-assets.mjs && BUILD_MODE=docker NODE_OPTIONS=--max_old_space_size=4096 umi build",
"deploy": "node ./scripts/deploy.js",
"start": "node scripts/pre-build.mjs && cross-env NODE_OPTIONS=--max_old_space_size=4096 cross-env PORT=8000 umi dev"
"start": "node --experimental-json-modules scripts/pre-build.mjs && cross-env NODE_OPTIONS=--max_old_space_size=4096 cross-env PORT=8000 umi dev"
Comment on lines +14 to +17
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个--experimental-json-modules在16.14版本还是需要的,但是16.20版本就已经不需要了。具体是哪个版本开始不需要这个flag的我没有实测,总之是追加一个评论FYI。

},
"dependencies": {
"@ant-design/charts": "^1.0.21",
Expand Down