Skip to content

Commit

Permalink
feat: custom build config
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Apr 17, 2024
1 parent 562af27 commit 3c2c302
Show file tree
Hide file tree
Showing 6 changed files with 1,638 additions and 1,306 deletions.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GKD 订阅模板, 此仓库方便您直接构建自己订阅, 点击右上角 [U
请安装最新版 nodejs 和 pnpm 运行, 以及使用 vscode 打开项目

- node>=20 <https://nodejs.org/en/download>
- pnpm>=8 <https://pnpm.io/zh/installation>
- pnpm>=9 <https://pnpm.io/zh/installation>
- vscode <https://code.visualstudio.com>

安装好后使用模板, 假设您创建的仓库是 `https://gihtub.com/lisonge/subscription`
Expand Down Expand Up @@ -41,6 +41,54 @@ pnpm install

另外您必须修改 订阅详情 [./src/subscription.ts](./src/subscription.ts) 下的 id 字段, 否则可能会和其它订阅冲突, 填一个较大的随机数字即可

## 配置文件

你可以在 [./package.json](./package.json) 下添加 gkd 属性配置自定义构建选项

```json
{
"gkd": {
"outDir": "dist",
"file": "gkd.json5",
"versionFile": "gkd.version.json5",
"changelog": "CHANGELOG.md",
"README.md": "README.md"
}
}
```

这个 gkd 属性的类型如下

```ts
/**
* @default package.json.gkd
*/
type GkdConfig = {
/**
* @default 'dist'
*/
outDir?: string;
/**
* @default 'gkd.json5'
*/
file?: string;
/**
* @default 'gkd.version.json5'
*/
versionFile?: string;
/**
* @default 'CHANGELOG.md'
*/
changelog?: string;
/**
* @default 'README.md'
*/
readme?: string;
};
```

如果不想写配置文件, 也可以将这个参数直接传递给 `@gkd-kit/tools``updateDist` 函数

## 格式修复

我们使用 [prettier](https://github.com/prettier/prettier) 来格式化代码 和 [eslint](https://github.com/eslint/eslint) 来检测并修复代码错误
Expand Down
2 changes: 1 addition & 1 deletion dist/gkd.json5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{id:233,name:'Subscription',version:0,author:'author',updateUrl:'https://gkd.li/',checkUpdateUrl:'https://gkd.li/',supportUri:'https://gkd.li/',categories:[],globalGroups:[],apps:[{id:'li.songe.gkd',name:'GKD',groups:[]},{id:'com.tencent.mobileqq',name:'QQ',groups:[]},{id:'com.tencent.mm',name:'微信',groups:[]}]}
{id:233,name:'Subscription',version:0,author:'author',checkUpdateUrl:'./gkd.version.json5',supportUri:'https://github.com/gkd-kit/subscription-template',categories:[],globalGroups:[],apps:[{id:'li.songe.gkd',name:'GKD',groups:[]},{id:'com.tencent.mobileqq',name:'QQ',groups:[]},{id:'com.tencent.mm',name:'微信',groups:[]}]}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"./dist"
],
"dependencies": {
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@commitlint/cli": "19.2.2",
"@commitlint/config-conventional": "19.2.2",
"@commitlint/types": "19.0.3",
"@gkd-kit/api": "0.0.5",
"@gkd-kit/define": "0.0.1",
"@gkd-kit/tools": "0.1.0",
"@types/node": "20.12.6",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
"@gkd-kit/tools": "0.2.0",
"@types/node": "20.12.7",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-define-config": "2.1.0",
Expand All @@ -49,12 +49,12 @@
"prettier": "3.2.5",
"simple-git-hooks": "2.11.1",
"tsx": "4.7.2",
"typescript": "5.4.4"
"typescript": "5.4.5"
},
"volta": {
"node": "20.12.1"
},
"packageManager": "pnpm@8.15.7",
"packageManager": "pnpm@9.0.1",
"engineStrict": true,
"engines": {
"node": ">=20"
Expand Down
Loading

0 comments on commit 3c2c302

Please sign in to comment.