Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit f439bb1

Browse files
committed
refactor
1 parent cbec8ca commit f439bb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+12331
-117
lines changed

.github/RELEASE-TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### 🆕 New Features
2+
* none
3+
4+
### 🛠️ Bug Fixes
5+
* none
6+
7+
### 🔣 Dependencies
8+
* none
9+
10+
### ‼️ Breaking Changes
11+
* none
12+
13+
### 🔄 Other Changes
14+
* none

.github/workflows/build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
6+
permissions:
7+
actions: read
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@main
16+
with:
17+
submodules: recursive
18+
token: ${{ secrets.SUBMODULE_TOKEN }}
19+
- name: Set up Node.js
20+
uses: actions/setup-node@main
21+
with:
22+
node-version: 'latest'
23+
cache: 'npm'
24+
- name: Install dependencies
25+
run: npm install
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
28+
- name: Update local package.json version from release tag
29+
if: github.ref_type == 'tag'
30+
uses: BellCubeDev/update-package-version-by-release-tag@v2
31+
with:
32+
version: ${{ github.ref_name }}
33+
keep-v: "false" # If set to "true", will not remove any 'v' prefix from the version number.
34+
ignore-semver-check: "false" # If set to "true", will not check if the version number is a valid semver version.
35+
- name: Build scripts
36+
run: npm run build
37+
- name: Generate modules
38+
run: npm run build:args
39+
- name: Upload artifact
40+
uses: actions/upload-artifact@master
41+
with:
42+
name: artifact
43+
path: |
44+
CHANGELOG.md
45+
rulesets
46+
dist

.github/workflows/deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/heads
5+
branches:
6+
- dev
7+
8+
permissions:
9+
actions: read
10+
contents: read
11+
12+
jobs:
13+
debug:
14+
uses: ./.github/workflows/dev.yml
15+
secrets: inherit
16+
deploy:
17+
needs: debug
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Download artifact
21+
uses: actions/download-artifact@master
22+
with:
23+
name: artifact
24+
- name: Deploy Response
25+
uses: exuanbo/actions-deploy-gist@main
26+
with:
27+
token: ${{ secrets.GIST_TOKEN }}
28+
gist_id: 862db28df04be7523476d10b61b128f2
29+
gist_description: " iRingo: 🌤 Weather β"
30+
file_path: dist/response.bundle.js

.github/workflows/dev.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Dev
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
6+
permissions:
7+
actions: read
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@main
16+
with:
17+
submodules: recursive
18+
token: ${{ secrets.SUBMODULE_TOKEN }}
19+
ref: dev
20+
- name: Set up Node.js
21+
uses: actions/setup-node@main
22+
with:
23+
node-version: 'latest'
24+
cache: 'npm'
25+
- name: Install dependencies
26+
run: npm install
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
29+
- name: Build
30+
run: npm run build:dev
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@master
33+
with:
34+
name: artifact
35+
path: |
36+
CHANGELOG.md
37+
rulesets
38+
dist

.github/workflows/draft.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Draft
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/heads
5+
branches:
6+
- main
7+
8+
permissions:
9+
actions: read
10+
contents: write
11+
12+
jobs:
13+
build:
14+
uses: ./.github/workflows/build.yml
15+
secrets: inherit
16+
draft:
17+
needs: build
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Download artifact
21+
uses: actions/download-artifact@master
22+
with:
23+
name: artifact
24+
- name: Publish Draft
25+
uses: softprops/action-gh-release@v2
26+
with:
27+
body_path: CHANGELOG.md
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
files: |
30+
rulesets/*
31+
dist/*
32+
draft: true

.github/workflows/pre-release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Pre-Release
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+
7+
- v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+
8+
9+
permissions:
10+
actions: read
11+
contents: write
12+
13+
jobs:
14+
build:
15+
uses: ./.github/workflows/build.yml
16+
secrets: inherit
17+
pre-release:
18+
needs: build
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Download artifact
22+
uses: actions/download-artifact@master
23+
with:
24+
name: artifact
25+
- name: Publish Pre-Release
26+
uses: softprops/action-gh-release@v2
27+
with:
28+
body_path: CHANGELOG.md
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
files: |
31+
rulesets/*
32+
dist/*
33+
prerelease: true

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
8+
permissions:
9+
actions: read
10+
contents: write
11+
12+
jobs:
13+
build:
14+
uses: ./.github/workflows/build.yml
15+
secrets: inherit
16+
release:
17+
needs: build
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Download artifact
21+
uses: actions/download-artifact@master
22+
with:
23+
name: artifact
24+
- name: Publish Release
25+
uses: softprops/action-gh-release@v2
26+
with:
27+
body_path: CHANGELOG.md
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
files: |
30+
rulesets/*
31+
dist/*
32+
make_latest: "true"

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/proto"]
2+
path = src/proto
3+
url = https://github.com/NSRingo/proto.git

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
registry=https://registry.npmjs.org/
2+
@nsnanocat:registry=https://npm.pkg.github.com/
3+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
### 🆕 New Features
2+
* `空气质量`增加`与昨日同时间对比`功能
3+
* 为实现此功能,现在默认替换来自`和风天气``空气质量`数据
4+
5+
### 🔄 Other Changes
6+
* `util``submodule` 更改为 `package`

arguments-builder.config.ts

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import { defineConfig } from "@iringo/arguments-builder";
2+
3+
export default defineConfig({
4+
output: {
5+
surge: {
6+
path: "./dist/iRingo.Weather.sgmodule",
7+
transformEgern: {
8+
enable: true,
9+
path: "./dist/iRingo.Weather.yaml",
10+
},
11+
},
12+
loon: {
13+
path: "./dist/iRingo.Weather.plugin",
14+
},
15+
customItems: [
16+
{
17+
path: "./dist/iRingo.Weather.snippet",
18+
template: "./template/quantumultx.handlebars",
19+
},
20+
{
21+
path: "./dist/iRingo.Weather.stoverride",
22+
template: "./template/stash.handlebars",
23+
},
24+
{
25+
path: "./dist/iRingo.Weather.srmodule",
26+
template: "./template/shadowrocket.handlebars",
27+
},
28+
],
29+
dts: {
30+
isExported: true,
31+
path: "./src/types.d.ts",
32+
},
33+
boxjsSettings: {
34+
path: "./template/boxjs.settings.json",
35+
scope: "@iRingo.Weather.Settings",
36+
},
37+
},
38+
args: [
39+
{
40+
key: "NextHour.Provider",
41+
name: "[未来一小时降水强度] 数据源",
42+
defaultValue: "ColorfulClouds",
43+
type: "string",
44+
options: [
45+
{ key: "WeatherKit", label: "WeatherKit (不进行替换)" },
46+
{ key: "ColorfulClouds", label: "彩云天气" },
47+
{ key: "QWeather", label: "和风天气" },
48+
],
49+
description: "始终会使用选定的数据源,填补无降水监测地区的数据。",
50+
},
51+
{
52+
key: "AQI.Provider",
53+
name: "[空气质量] 数据源",
54+
defaultValue: "ColorfulClouds",
55+
type: "string",
56+
options: [
57+
{ key: "WeatherKit", label: "WeatherKit (不进行替换)" },
58+
{ key: "ColorfulClouds", label: "彩云天气" },
59+
{ key: "QWeather", label: "和风天气" },
60+
{ key: "WAQI", label: "The World Air Quality Project" },
61+
],
62+
description: "始终会使用选定的数据源,填补无空气质量监测地区的数据。",
63+
},
64+
{
65+
key: "AQI.ReplaceProviders",
66+
name: "[空气质量] 需要替换的供应商",
67+
defaultValue: ["QWeather"],
68+
type: "array",
69+
description: "选中的空气质量数据源会被替换。",
70+
options: [
71+
{ key: "QWeather", label: "和风天气" },
72+
{ key: "BreezoMeter", label: "BreezoMeter" },
73+
{ key: "TWC", label: "The Weather Channel" },
74+
],
75+
},
76+
{
77+
key: "AQI.Local.Scale",
78+
type: "string",
79+
name: "[空气质量] 本地替换算法",
80+
description: "本地替换时使用的算法",
81+
defaultValue: "WAQI_InstantCast",
82+
options: [
83+
{ key: "NONE", label: "None (不进行替换)" },
84+
{ key: "WAQI_InstantCast", label: "WAQI InstantCast" },
85+
],
86+
},
87+
{
88+
key: "AQI.Local.ReplaceScales",
89+
type: "array",
90+
name: "[空气质量] 需要修改的标准",
91+
description: "选中的空气质量标准会被替换。请注意各国监测的污染物种类可能有所不同,转换算法或API未必适合当地。",
92+
defaultValue: ["HJ6332012"],
93+
options: [{ key: "HJ6332012", label: "中国 (HJ 633—2012)" }],
94+
},
95+
{
96+
key: "AQI.Local.ConvertUnits",
97+
name: "[空气质量] 转换污染物计量单位",
98+
defaultValue: false,
99+
type: "boolean",
100+
description: "将污染物数据替换为转换单位后的数据,方便对照转换后的标准。(不推荐。不同单位互转可能会损失精度,导致数值偏大)",
101+
},
102+
{
103+
key: "API.ColorfulClouds.Token",
104+
name: "[API] 彩云天气令牌",
105+
defaultValue: "",
106+
type: "string",
107+
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
108+
description: "彩云天气 API 令牌",
109+
},
110+
{
111+
key: "API.QWeather.Host",
112+
name: "[API] 和风天气主机",
113+
defaultValue: "devapi.qweather.com",
114+
type: "string",
115+
description: "和风天气 API 使用的主机名",
116+
options: [
117+
{ key: "devapi.qweather.com", label: "免费订阅 (devapi.qweather.com)" },
118+
{ key: "api.qweather.com", label: "付费订阅 (api.qweather.com)" },
119+
],
120+
},
121+
{
122+
key: "API.QWeather.Token",
123+
name: "[API] 和风天气令牌",
124+
defaultValue: "",
125+
type: "string",
126+
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
127+
description: "和风天气 API 令牌",
128+
},
129+
{
130+
key: "API.WAQI.Token",
131+
name: "[API] WAQI 令牌",
132+
defaultValue: "",
133+
type: "string",
134+
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
135+
description: "WAQI API 令牌,填写此字段将自动使用WAQI高级API",
136+
},
137+
],
138+
});

0 commit comments

Comments
 (0)