Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint", "prettier"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
"env": {
"node": true,
"es2022": true
Expand All @@ -18,8 +15,8 @@
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-constant-condition": ["error", { "checkLoops": false }]
"no-constant-condition": ["error", { "checkLoops": false }],
"prettier/prettier": "error"
},
"ignorePatterns": ["dist", "node_modules", "*.js"]
}

18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: npm run lint

- name: Test (unit tests only)
run: npm run test -- --testPathPattern="unittests"
run: make coverage

- name: Build
run: npm run build
Expand All @@ -44,7 +44,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整历史用于增量覆盖率检查
fetch-depth: 0 # 获取完整历史用于增量覆盖率检查

- name: Use Node.js 18.x
uses: actions/setup-node@v4
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- '**'
tags-ignore:
- '**' # 忽略 tag push,避免与 release 事件重复触发
- '**' # 忽略 tag push,避免与 release 事件重复触发

# GitHub Release 触发正式发布
release:
Expand All @@ -21,8 +21,8 @@ on:
default: 'test'
type: choice
options:
- official # 正式发布
- test # 测试发布
- official # 正式发布
- test # 测试发布
version:
description: '版本号(留空则自动递增)/ Version (leave empty for auto-increment)'
required: false
Expand All @@ -33,9 +33,9 @@ on:
default: 'patch'
type: choice
options:
- patch # 0.0.1 -> 0.0.2
- minor # 0.0.1 -> 0.1.0
- major # 0.0.1 -> 1.0.0
- patch # 0.0.1 -> 0.0.2
- minor # 0.0.1 -> 0.1.0
- major # 0.0.1 -> 1.0.0

jobs:
# 等待 CI 测试通过(仅 push 触发时)
Expand Down Expand Up @@ -104,20 +104,20 @@ jobs:
# 获取包名
PACKAGE_NAME=$(node -p "require('./package.json').name")
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_OUTPUT

# 获取基础版本号
BASE_VERSION=$(node -p "require('./package.json').version")

# 生成唯一标识符:优先使用 run_id,否则使用时间戳
if [ -n "${{ github.run_id }}" ]; then
UNIQUE_ID="${{ github.run_id }}"
else
UNIQUE_ID=$(date +%Y%m%d%H%M%S)
fi

# 生成 prerelease 版本号
VERSION="${BASE_VERSION}-test.${UNIQUE_ID}"

echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Test version: ${VERSION}"

Expand Down Expand Up @@ -148,12 +148,12 @@ jobs:
PACKAGE_NAME="${{ steps.version.outputs.PACKAGE_NAME }}"
VERSION="${{ steps.version.outputs.VERSION }}"
echo "Publishing ${PACKAGE_NAME}@${VERSION} with tag=test"

# Remove any .npmrc that might interfere with OIDC
rm -f ~/.npmrc
rm -f .npmrc
rm -f /home/runner/work/_temp/.npmrc

# Publish using Trusted Publishers (OIDC)
npm publish --tag test --access public --provenance
env:
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_OUTPUT

# 确定版本号
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
VERSION="${MAJOR}.${MINOR}.${PATCH}"
fi
fi

echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Official version: ${VERSION}"

Expand Down Expand Up @@ -297,12 +297,12 @@ jobs:
PACKAGE_NAME="${{ steps.config.outputs.PACKAGE_NAME }}"
VERSION="${{ steps.config.outputs.VERSION }}"
echo "Publishing ${PACKAGE_NAME}@${VERSION} with tag=latest"

# Remove any .npmrc that might interfere with OIDC
rm -f ~/.npmrc
rm -f .npmrc
rm -f /home/runner/work/_temp/.npmrc

# Publish using Trusted Publishers (OIDC)
npm publish --tag latest --access public --provenance
env:
Expand Down Expand Up @@ -357,7 +357,7 @@ jobs:
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_OUTPUT

VERSION="${{ inputs.version }}"
if [ -z "$VERSION" ]; then
# 自动生成测试版本号
Expand All @@ -372,7 +372,7 @@ jobs:

VERSION="${BASE_VERSION}-test.${UNIQUE_ID}"
fi

echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Test version: ${VERSION}"

Expand Down Expand Up @@ -401,12 +401,12 @@ jobs:
PACKAGE_NAME="${{ steps.version.outputs.PACKAGE_NAME }}"
VERSION="${{ steps.version.outputs.VERSION }}"
echo "Publishing ${PACKAGE_NAME}@${VERSION} with tag=test"

# Remove any .npmrc that might interfere with OIDC
rm -f ~/.npmrc
rm -f .npmrc
rm -f /home/runner/work/_temp/.npmrc

# Publish using Trusted Publishers (OIDC)
npm publish --tag test --access public --provenance
env:
Expand Down
131 changes: 131 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Dependencies
node_modules/
bun.lock

# Build outputs
dist/
coverage/
*.tsbuildinfo

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/
*.lcov

# nyc test coverage
.nyc_output

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
public

# Storybook build outputs
.out
.storybook-out

# Temporary folders
tmp/
temp/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# OS generated files
Thumbs.db
ehthumbs.db
Desktop.ini

# Jest coverage
coverage/

# TypeScript
*.tsbuildinfo

# Optional stylelint cache
.stylelintcache

# VS Code
.vscode/settings.json
.vscode/launch.json

# Local development
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
.pytest_cache/
__pycache__/
*.pyc

# Build artifacts
build/
out/

# Lock files (keep package-lock.json)
yarn.lock
pnpm-lock.yaml

# Generated files
codegen/
scripts/inject-version-check.mjs
29 changes: 29 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf",
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"overrides": [
{
"files": "*.json",
"options": {
"printWidth": 200
}
},
{
"files": "*.md",
"options": {
"printWidth": 80,
"proseWrap": "preserve"
}
}
]
}
Loading