-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
6,406 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* commitlint.config | ||
* @ref http://commitlint.js.org/ | ||
* @type {import('@commitlint/types').UserConfig} | ||
*/ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
max_line_length = 120 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Macos | ||
.DS_Store | ||
|
||
# Windows | ||
$RECYCLE.BIN/ | ||
Desktop.ini | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Node | ||
node_modules | ||
package-lock.json | ||
pnpm-lock.yaml | ||
yarn.lock | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
/logs | ||
*.log | ||
*.log.* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
!.vscode/extensions.json | ||
|
||
# dist and cache | ||
/dist | ||
/dist-* | ||
/dist_* | ||
.cache | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
.next | ||
/out | ||
/build | ||
|
||
# nuxt.js | ||
.nuxt | ||
.nitro | ||
.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { defineConfig } = require('eslint-define-config'); | ||
|
||
/** | ||
* eslint config | ||
* @ref https://eslint.org/ | ||
*/ | ||
module.exports = defineConfig({ | ||
root: true, | ||
|
||
env: { | ||
browser: true, | ||
node: true, | ||
es2022: true, | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ['*.cjs'], | ||
extends: [ | ||
// | ||
'eslint:recommended', | ||
], | ||
rules: { | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['*.mjs'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
extends: [ | ||
// | ||
'eslint:recommended', | ||
], | ||
rules: { | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['*.ts'], | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
// | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
rules: { | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: setup nvm | ||
description: 依照 nvmrc 创建 node 环境 | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- run: sudo timedatectl set-timezone Asia/Shanghai | ||
shell: bash | ||
- run: timedatectl | ||
shell: bash | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
cache-dependency-path: '**/package-lock.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 代码格式、基本质量检查 | ||
|
||
name: code review | ||
|
||
on: | ||
push: | ||
branches: | ||
- v*.x | ||
pull_request: | ||
schedule: | ||
# 19:00(UTC) 每天,相当于 03:00(GMT+8) | ||
- cron: '0 19 * * *' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run test:coverage | ||
- uses: codacy/codacy-coverage-reporter-action@v1 | ||
if: github.actor != 'dependabot[bot]' | ||
with: | ||
api-token: ${{ secrets.CODACY_API_TOKEN }} | ||
coverage-reports: coverage/lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 此操作会扫描您的拉取请求以查找依赖项更改,如果引入任何漏洞或无效许可证,则会引发错误 | ||
|
||
name: dependency review | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/dependency-review-action@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 如果 devPR 到主干,则会根据约定式提交创建一个 releasePR,是一个新版本合并请求 | ||
# 如果 releasePR 到主干,则会触发新版本发布到 npm/github 等仓库 | ||
|
||
name: release please | ||
|
||
on: | ||
push: | ||
branches: | ||
- v*.x | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
bump-minor-pre-major: true | ||
|
||
test-coverage: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: needs.release.outputs.release_created | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run test:coverage | ||
- uses: codacy/codacy-coverage-reporter-action@v1 | ||
with: | ||
api-token: ${{ secrets.CODACY_API_TOKEN }} | ||
coverage-reports: coverage/lcov.info | ||
|
||
publish-npm: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
needs: test-coverage | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run build | ||
- uses: FrontEndDev-org/publish-node-package-action@v1 | ||
with: | ||
target: npm | ||
token: ${{ secrets.NPM_TOKEN }} | ||
- uses: FrontEndDev-org/npm-mirror-sync-action@v1 | ||
|
||
publish-github: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
needs: test-coverage | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run build | ||
- uses: FrontEndDev-org/publish-node-package-action@v1 | ||
with: | ||
target: github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Macos | ||
.DS_Store | ||
|
||
# Windows | ||
$RECYCLE.BIN/ | ||
Desktop.ini | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Node | ||
node_modules | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
/logs | ||
*.log | ||
*.log.* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
!.vscode/extensions.json | ||
|
||
# dist and cache | ||
/dist | ||
/dist-* | ||
/dist_* | ||
.cache | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
.next | ||
/out | ||
/build | ||
|
||
# nuxt.js | ||
.nuxt | ||
.nitro | ||
.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```shell | ||
chmod +x commit-msg | ||
chmod +x pre-commit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
echo "node version = $(node -v)" | ||
echo "npm version = $(npm -v)" | ||
npx lint-staged --allow-empty | ||
npx tsc --noEmit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* lint-staged config | ||
* @ref https://www.npmjs.com/package/lint-staged | ||
*/ | ||
module.exports = { | ||
'*.{cjs,mjs,ts,tsx}': 'eslint --fix', | ||
'*.{cjs,mjs,ts,tsx,html,css,scss}': 'prettier --write', | ||
'(package|tsconfig*).json': 'prettier --write', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmmirror.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Macos | ||
.DS_Store | ||
|
||
# Windows | ||
$RECYCLE.BIN/ | ||
Desktop.ini | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Node | ||
node_modules | ||
package-lock.json | ||
pnpm-lock.yaml | ||
yarn.lock | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
/logs | ||
*.log | ||
*.log.* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
!.vscode/extensions.json | ||
|
||
# dist and cache | ||
/dist | ||
/dist-* | ||
/dist_* | ||
.cache | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
.next | ||
/out | ||
/build | ||
|
||
# nuxt.js | ||
.nuxt | ||
.nitro | ||
.output |
Oops, something went wrong.