Skip to content

Commit

Permalink
chore: 初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Jul 9, 2024
0 parents commit d0a7fd9
Show file tree
Hide file tree
Showing 22 changed files with 7,206 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- '@commitlint/config-conventional'
67 changes: 67 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Lint

on: [push]

jobs:
git-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | pnpm exec commitlint --verbose
type-checking:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ts: [5.4.x, 5.5.x]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- name: Use Typescript@${{ matrix.ts }} & @types/node@${{ matrix.node-dts }}
run: |
pnpm install
pnpm install typescript@${{ matrix.ts }} -w
- run: pnpm exec tsc
code-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- run: pnpm exec prettier --cache --check .
bundle:
needs: [git-commit, type-checking, code-format]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20, 22]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: ${{ matrix.node }}
- run: pnpm install
- run: pnpm build
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
push:
branches:
- main

env:
CI: true

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- run: npx lerna version --force-publish --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm --recursive publish
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on: [push]

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20, 22]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm test
- if: github.ref == 'refs/heads/main' && strategy.job-index == 0
uses: codecov/codecov-action@v4
with:
verbose: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
.idea/
TODO
dist/
.npmrc
coverage/
.DS_Store
*.log
.tsbuildinfo
.nx/
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

npx --no-install prettier --cache --check .
npx --no-install tsc
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist/
pnpm-lock.yaml
CHANGELOG.md
coverage/
openapi.json
/.nx/workspace-data
16 changes: 16 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
semi: true
singleQuote: true
# Change when properties in objects are quoted.
# If at least one property in an object requires quotes, quote all properties.
quoteProps: consistent
tabWidth: 2
printWidth: 90
endOfLine: lf
trailingComma: all
bracketSpacing: true
# Include parentheses around a sole arrow function parameter.
arrowParens: always
proseWrap: preserve
jsxSingleQuote: false
# Put > on the last line instead of at a new line.
bracketSameLine: false
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
},
"editor.tabSize": 2,
"editor.inlayHints.fontSize": 9,
"typescript.inlayHints.parameterNames.enabled": "all",
"typescript.inlayHints.enumMemberValues.enabled": true,
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.quoteStyle": "single",
"typescript.suggest.autoImports": true,
"cSpell.words": ["openapi"]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 geekact

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "1.6.0",
"npmClient": "pnpm",
"command": {
"version": {
"allowBranch": "main",
"conventionalCommits": true,
"message": "chore(release): 发布版本%s",
"createRelease": "github",
"private": false,
"exact": false
}
},
"access": "public"
}
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "aomex",
"private": true,
"repository": "git@github.com:aomex/aomex.git",
"homepage": "https://aomex.js.org",
"author": "geekact <fanwenhua1990@gmail.com>",
"license": "MIT",
"type": "module",
"scripts": {
"test": "vitest",
"build": "pnpm --recursive --workspace-concurrency 1 prepublishOnly",
"preinstall": "only-allow pnpm",
"prepare": "husky",
"deploy:main": "sh scripts/develop-deploy-main.sh",
"sync:main": "sh scripts/develop-sync-main.sh"
},
"volta": {
"node": "20.13.0",
"pnpm": "9.5.0"
},
"packageManager": "pnpm@9.5.0",
"engines": {
"node": ">=18"
},
"dependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@types/node": "^18",
"@vitest/coverage-v8": "^1.5.2",
"husky": "^9.0.11",
"lerna": "^8.1.5",
"only-allow": "^1.2.1",
"prettier": "^3.2.5",
"ts-expect": "^1.3.0",
"tsup": "^8.0.2",
"tsx": "^4.15.6",
"typescript": "^5.5.3",
"vitest": "^1.5.2"
}
}
Loading

0 comments on commit d0a7fd9

Please sign in to comment.