Skip to content

Commit

Permalink
fix(cli): 修复 octokit 依赖更新导致 cli 命令执行失败的问题 (#1293)
Browse files Browse the repository at this point in the history
### 问题
**在 #1251 中,octokit发生大版本更新导致octokit的导入出现问题, 通过require导入也无法解决**
octokit/octokit.js#2674

![image](https://github.com/PKUHPC/SCOW/assets/43978285/db6d16c8-402d-4c86-8a49-c739c8020ed4)

**octokit/core等不支持octokit.rest方法**

![image](https://github.com/PKUHPC/SCOW/assets/43978285/830e702d-89f6-4114-80b9-cbced9e9fe42)


### 修改
### 可回退octokit版本或者指定 octokit/rest进行修复
**此PR指定依赖为 @octokit/rest 进行修复**
**修复后可正常运行cli命令**

![image](https://github.com/PKUHPC/SCOW/assets/43978285/3c09055c-7e70-4fff-a3e0-e89f8c52929f)
  • Loading branch information
piccaSun authored Jun 11, 2024
1 parent 028dfe4 commit 5f14ce8
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 259 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-islands-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/cli": patch
---

修复更新 octokit 依赖后导致 cli 命令执行失败的问题
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"js-yaml": "4.1.0",
"pino": "8.16.2",
"pino-pretty": "10.3.1",
"octokit": "4.0.2",
"@octokit/rest": "20.1.1",
"jszip": "3.10.1",
"dotenv": "16.4.5",
"death": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/cmd/updateCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
* See the Mulan PSL v2 for more details.
*/

import { Octokit } from "@octokit/rest";
import fs, { existsSync } from "fs";
import { chmod, unlink } from "fs/promises";
import JSZip from "jszip";
// node-fetch is esm only
import fetch from "node-fetch-commonjs";
import { Octokit } from "octokit";
import prompt from "prompts";
import { createProxyAgent, proxyUrl } from "src/config/proxy";
import { logger } from "src/log";
Expand Down
Loading

0 comments on commit 5f14ce8

Please sign in to comment.