Skip to content

Commit

Permalink
chore: use json-schema-artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchengjie committed May 24, 2024
1 parent 06065ec commit 8e187f6
Show file tree
Hide file tree
Showing 15 changed files with 277 additions and 215 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release On Tag
name: release on tag

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
permissions: write-all

jobs:
bundle_on_commit:
release-on-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -33,7 +33,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ${{ github.workspace }}/CHANGELOG
prerelease: false
make_latest: true
files: |
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.temp
node_modules
CHANGELOG
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.gitattributes
.github
.prettierrc
.temp
.vscode
json-schema-artifact.json
node_modules
scripts
src
test
CHANGELOG
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
],
"yaml.schemas": {
// test/clash-meta 目录的 YAML 文件使用编译后的 meta-json-schema.json
".temp/meta-json-schema.json": "test/clash-meta/**/*.yaml",
"schemas/meta-json-schema.json": "test/clash-meta/**/*.yaml",
// test/clash-verge 目录的 YAML 文件使用编译后的 clash-verge-merge-json-schema.json
".temp/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
"schemas/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
},
// 使用两空格缩进
"editor.tabSize": 2,
Expand All @@ -25,7 +25,6 @@
// 搜索排除下列目录
"search.exclude": {
"node_modules": true, // 忽略模块目录
".temp": true, // 忽略编译输出目录
"schemas": true // 忽略构建发布目录
}
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ code /path/to/project/location
npm install
```

4. 启动项目。执行下列命令后,会对`src`目录进行监视,如果发生变动则会对项目进行bundle,输出到`.temp`目录下。
4. 启动项目。执行下列命令后,会对`src`目录进行监视,如果发生变动则会对项目进行bundle,输出到`schemas`目录下。

```bash
npm run dev
```

5. 测试schema。由于`.vscode`目录下`settings.json`中已事先配置了如下配置(`test`目录下的文件使用`.temp`目录下输出的schema文件)。因此可以对`src`进行修改,并在`test`目录下新增测试文件,及时观察变动并做出修正。
5. 测试schema。由于`.vscode`目录下`settings.json`中已事先配置了如下配置(`test`目录下的文件使用`schemas`目录下输出的schema文件)。因此可以对`src`进行修改,并在`test`目录下新增测试文件,及时观察变动并做出修正。

```json
"yaml.schemas": {
".temp/meta-json-schema.json": "test/clash-meta/**/*.yaml",
".temp/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
"schemas/meta-json-schema.json": "test/clash-meta/**/*.yaml",
"schemas/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
},
```

Expand Down
25 changes: 25 additions & 0 deletions json-schema-artifact.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "node_modules/json-schema-artifact/schema/json-schema-artifact.json",
"watch": [
{
"dir": "src",
"recursive": true
}
],
"build": {
"target": [
{
"input": "src/meta-json-schema.json",
"output": "schemas/meta-json-schema.json"
},
{
"input": "src/clash-verge-merge-json-schema.json",
"output": "schemas/clash-verge-merge-json-schema.json"
}
],
"optimize": {
"format": "minify",
"refsDerefer": true
}
}
}
240 changes: 236 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8e187f6

Please sign in to comment.