chore: add ci tool

This commit is contained in:
lisonge 2023-09-04 17:00:31 +08:00
parent a692d20940
commit c18b6a8c9c
13 changed files with 2354 additions and 25 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
dist
.eslintrc.cjs

22
.eslintrc.cjs Normal file
View File

@ -0,0 +1,22 @@
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-empty': 'off',
'prefer-const': 'off',
},
});

17
.gitignore vendored
View File

@ -1,3 +1,20 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules node_modules
.env .env
.vscode .vscode
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.eslintcache

4
.husky/commit-msg Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm exec commitlint --edit ${1}

4
.husky/pre-commit Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm exec lint-staged

4
.husky/pre-push Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm run check

View File

@ -3,3 +3,5 @@ pnpm-workspace.yaml
LICENCE LICENCE
dist dist
# README.md by pnpm build
README.md

View File

@ -5,5 +5,5 @@
export default { export default {
tabWidth: 2, tabWidth: 2,
singleQuote: true, singleQuote: true,
trailingComma: "all", trailingComma: 'all',
}; };

View File

@ -13,21 +13,32 @@
"./dist" "./dist"
], ],
"scripts": { "scripts": {
"prepare": "husky install",
"format": "prettier --cache --write .",
"lint": "eslint --cache --fix ./**/*.{js,ts,jsx,tsx}",
"build": "tsc --noEmit && tsx ./scripts/build.ts", "build": "tsc --noEmit && tsx ./scripts/build.ts",
"check": "tsc --noEmit && tsx ./scripts/check.ts", "check": "tsc --noEmit && tsx ./scripts/check.ts"
"sync": "tsx ./scripts/sync.ts"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@gkd-kit/selector": "0.0.11", "@gkd-kit/selector": "0.0.11",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",
"@types/node": "^20.4.2", "@types/node": "^20.4.2",
"@typescript-eslint/eslint-plugin": "6.5.0",
"@typescript-eslint/parser": "6.5.0",
"dayjs": "^1.11.9", "dayjs": "^1.11.9",
"eslint": "^8.48.0",
"eslint-config-prettier": "9.0.0",
"eslint-define-config": "1.23.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"picocolors": "^1.0.0",
"prettier": "^3.0.1", "prettier": "^3.0.1",
"tsx": "^3.12.7", "tsx": "^3.12.7",
"typescript": "^5.1.6", "typescript": "^5.1.6",
"undici": "^5.23.0", "undici": "^5.23.0"
"picocolors": "^1.0.0"
}, },
"author": "lisonge", "author": "lisonge",
"license": "MIT", "license": "MIT",
@ -42,5 +53,18 @@
"volta": { "volta": {
"node": "20.5.0" "node": "20.5.0"
}, },
"packageManager": "pnpm@8.7.1" "packageManager": "pnpm@8.7.1",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*": [
"prettier --cache --write --ignore-unknown"
],
"*.{js,ts,jsx,tsx}": [
"eslint --cache --fix"
]
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
const r = await fetch(
`https://registry-direct.npmmirror.com/@gkd-kit/subscription/sync`,
{
method: 'PUT',
},
);
console.log(await r.json());
console.log(`同步 npmmirror 成功`);
export {};

View File

@ -25,9 +25,7 @@ export default defineAppConfig({
enable: false, enable: false,
activityIds: 'com.douban.frodo.subject.activity.RatingActivity', activityIds: 'com.douban.frodo.subject.activity.RatingActivity',
rules: '[id="com.douban.frodo:id/check_status"][checked=true]', rules: '[id="com.douban.frodo:id/check_status"][checked=true]',
snapshotUrls: [ snapshotUrls: ['https://gkd-kit.gitee.io/import/12508777'],
'https://gkd-kit.gitee.io/import/12508777'
]
}, },
{ {
key: 2, key: 2,
@ -35,14 +33,16 @@ export default defineAppConfig({
activityIds: 'com.douban.frodo.baseproject.image.SociableImageActivity', activityIds: 'com.douban.frodo.baseproject.image.SociableImageActivity',
rules: [ rules: [
{ {
matches: 'TextView[id="com.douban.frodo:id/ad_not_interest"][text="广告"][visibleToUser=true]', matches:
'TextView[id="com.douban.frodo:id/ad_not_interest"][text="广告"][visibleToUser=true]',
snapshotUrls: 'https://gkd-kit.gitee.io/import/12509475', snapshotUrls: 'https://gkd-kit.gitee.io/import/12509475',
}, },
{ {
matches: 'TextView[id="com.douban.frodo:id/mainText"][text="不感兴趣"]', matches:
'TextView[id="com.douban.frodo:id/mainText"][text="不感兴趣"]',
snapshotUrls: 'https://gkd-kit.gitee.io/import/12509476', snapshotUrls: 'https://gkd-kit.gitee.io/import/12509476',
}, },
] ],
} },
], ],
}); });

View File

@ -83,7 +83,7 @@ export default defineAppConfig({
'TextView[text$=`的广告`] - Image[id=null]', 'TextView[text$=`的广告`] - Image[id=null]',
'TextView[text*=`广告`] +2 Image[id=null]', // 1687338556331 'TextView[text*=`广告`] +2 Image[id=null]', // 1687338556331
'TextView[text*=`点赞`][text*=`的回答`] +2 Image[id=null]', // 1687076663768 1686969672948 'TextView[text*=`点赞`][text*=`的回答`] +2 Image[id=null]', // 1687076663768 1686969672948
`TextView[text=''] + Image[text=''] + TextView[text=''] + Image[id=null][clickable=true]`, // 1687234636980 `TextView[text=''] + Image[text=''] + TextView[text='\u200b'] + Image[id=null][clickable=true]`, // 1687234636980
], ],
}, },
{ {