diff --git a/.npmrc b/.npmrc index 2073ac01..b39f8a8c 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ strict-peer-dependencies=false auto-install-peers=false registry="https://registry.npmjs.org/" +access=public diff --git a/README.md b/README.md index 1b518187..4dae9783 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ a subscription for gkd
gkd -- [gdk](https://raw.gitmirror.com/lisonge/gkd-subscription/main/dist/gkd.json) +- [gdk](https://raw.githubusercontent.com/gkd-kit/subscription/main/dist/gkd.json) -![image](https://github.com/lisonge/gkd/assets/38517192/e9adef4e-4e56-42e2-9d46-2123966467ec) +![image](https://github.com/lisonge/gkd/assets/38517192/cd25d007-f3ef-49bc-a930-6f0a7d0aded5)
@@ -18,8 +18,8 @@ a subscription for gkd
gkd -- [gkd](https://cdn.lisonge.com/gkd.json) +- [gkd](https://registry.npmmirror.com/@gkd-kit/subscription/latest/files) -![image](https://github.com/lisonge/gkd/assets/38517192/341aea22-9f48-4178-b94f-5d14868c70a3) +![image](https://github.com/lisonge/gkd/assets/38517192/a0f95072-881e-4157-9c6b-2fcab03a84c2)
diff --git a/dist/gkd.json b/dist/gkd.json index 3fc6eb43..3d3f654b 100644 --- a/dist/gkd.json +++ b/dist/gkd.json @@ -1,6 +1,6 @@ { "name": "GKD官方订阅", - "version": 4, + "version": 5, "author": "lisonge", "supportUrl": "https://github.com/lisonge/gkd-subscription", "apps": [ @@ -1073,6 +1073,15 @@ } ] }, + { + "id": "li.songe.gkd", + "groups": [ + { + "key": 0, + "name": "GKD-空规则组" + } + ] + }, { "id": "tv.danmaku.bili", "groups": [ diff --git a/package.json b/package.json index 72e26ba4..0d36c085 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@gkd-kit/subscription", "type": "module", - "version": "0.0.0", + "version": "0.0.5", "private": false, "main": "./dist/gkd.json", "files": [ diff --git a/scripts/sync.ps1 b/scripts/sync.ps1 new file mode 100644 index 00000000..be253345 --- /dev/null +++ b/scripts/sync.ps1 @@ -0,0 +1,7 @@ +pnpm build +git add '.' +git commit -m 'chore: sync' +git push +npm publish +sleep 1s +curl -I 'https://npmmirror.com/sync/@gkd-kit/subscription' diff --git a/scripts/sync_json.ps1 b/scripts/sync_json.ps1 deleted file mode 100644 index 927783f2..00000000 --- a/scripts/sync_json.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -pnpm build -git add './dist/*.json' -git commit -m 'chore: sync json' -git push diff --git a/src/apps/li.songe.gkd.ts b/src/apps/li.songe.gkd.ts new file mode 100644 index 00000000..89912a01 --- /dev/null +++ b/src/apps/li.songe.gkd.ts @@ -0,0 +1,11 @@ +import type { AppConfig } from '../types'; + +export default { + id: 'li.songe.gkd', + groups: [ + { + key: 0, + name: `GKD-空规则组`, + }, + ], +}; diff --git a/src/file.ts b/src/file.ts index eb211fbe..f39c526f 100644 --- a/src/file.ts +++ b/src/file.ts @@ -1,10 +1,10 @@ import dayjs from 'dayjs'; import _ from 'lodash'; import fs from 'node:fs/promises'; -import url from 'node:url'; import path from 'node:path'; -import { SubscriptionConfig } from './types'; -import { refreshUrls, uploadFile } from './upload_qiniu'; +import url from 'node:url'; +import selfPkg from '../package.json'; +import type { SubscriptionConfig } from './types'; export const relativePath = (p: string) => { return url.fileURLToPath(new URL(p, import.meta.url)); @@ -19,6 +19,7 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => { newConfig.version = oldConfig.version ?? 0; if (_.isEqual(newConfig, oldConfig)) { + console.log([oldConfig.name, `nothing changed, skip`]); return; } newConfig.version++; @@ -67,17 +68,19 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => { 'utf-8', ); await fs.writeFile(filePath, buffer); - const { key, hash } = await uploadFile(filePath); - await refreshUrls(key); - console.log( - [ - dayjs().format(`HH:mm:ss`), - (buffer.length / 1024).toFixed(3) + `KB`, - newConfig.version, - key, - hash, - ].join(` `), + + const newPkg = { ...selfPkg, version: `0.0.` + newConfig.version }; + await fs.writeFile( + relativePath('../package.json'), + JSON.stringify(newPkg, void 0, 2) + `\n`, ); + + console.log({ + mtime: dayjs().format(`HH:mm:ss`), + name: newConfig.name, + size: (buffer.length / 1024).toFixed(3) + `KB`, + version: newConfig.version, + }); }; export async function* walk(dirPath: string) {