Skip to content

Commit

Permalink
🎨 新增json api
Browse files Browse the repository at this point in the history
  • Loading branch information
mobaijun committed Jan 6, 2024
1 parent 33945c3 commit 111e046
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions api.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-http -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
<version>5.8.24</version>
</dependency>
</dependencies>

Expand All @@ -35,8 +35,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>17</source>
<target>17</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/mobaijun/ApplicationMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.StrBuilder;
import cn.hutool.json.JSONUtil;
import com.mobaijun.github.Github;
import com.mobaijun.github.Repository;

Expand Down Expand Up @@ -52,6 +53,10 @@ public static void main(String[] args) {
// 标题
sb.append("# ").append(username).append(" Starred Repositories\n\n");
List<Repository> repositoryList = Github.getGithubStarList(username);

// 写入 json api
FileUtil.writeString(JSONUtil.toJsonStr(repositoryList),FileUtil.newFile("api.json"),StandardCharsets.UTF_8);

// 写入 html
writeRepositoriesToHtml(repositoryList);
// 拼接列表
Expand Down

0 comments on commit 111e046

Please sign in to comment.