-
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
23 changed files
with
8,771 additions
and
2,985 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
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,41 @@ | ||
# 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 | ||
|
||
# project | ||
/test/example-dest | ||
|
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,52 @@ | ||
const { defineConfig } = require('eslint-define-config'); | ||
|
||
/** | ||
* eslint config | ||
* @ref https://eslint.org/ | ||
*/ | ||
module.exports = defineConfig({ | ||
root: true, | ||
|
||
env: { | ||
browser: true, | ||
node: true, | ||
es2022: true, | ||
}, | ||
|
||
ignorePatterns: ['!.*rc.*'], | ||
|
||
overrides: [ | ||
{ | ||
files: ['*.cjs'], | ||
extends: [ | ||
// | ||
'eslint:recommended', | ||
'plugin:import/recommended', | ||
], | ||
rules: { | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
{ | ||
files: ['*.ts', '*.mts'], | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
// | ||
'eslint:recommended', | ||
'plugin:import/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
rules: { | ||
'prettier/prettier': 'error', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: true, | ||
typescript: 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,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,29 @@ | ||
# 代码格式检查 | ||
|
||
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@v4 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run test |
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 |
---|---|---|
|
@@ -3,33 +3,52 @@ | |
name: release please | ||
|
||
on: | ||
push: | ||
branches: | ||
- v*.x | ||
push: | ||
branches: | ||
- v*.x | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
major: ${{ steps.release.outputs.major }} | ||
minor: ${{ steps.release.outputs.minor }} | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: node | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-nvm | ||
- run: npm ci | ||
- run: npm run build | ||
- uses: peter-evans/create-pull-request@v4 | ||
id: pr | ||
with: | ||
committer: github-actions[bot] <[email protected]> | ||
author: github-actions[bot] <[email protected]> | ||
commit-message: 'chore: build dist' | ||
title: 机器人自动创建的拉取请求,将会自动合并,请勿手动处理! | ||
body: 机器人自动创建的拉取请求,将会自动合并,请勿手动处理! | ||
- run: gh pr merge ${{ steps.pr.outputs.pull-request-number }} --merge --auto --delete-branch | ||
if: ${{ steps.pr.outputs.pull-request-number }} | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
major: ${{ steps.release.outputs.major }} | ||
minor: ${{ steps.release.outputs.minor }} | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: node | ||
|
||
create-version: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: needs.release.outputs.release_created | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: jacobsvante/tag-major-minor-action@v0 | ||
with: | ||
major: ${{ needs.release.outputs.major }} | ||
minor: ${{ needs.release.outputs.minor }} | ||
create-version: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: needs.release.outputs.release_created | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: jacobsvante/tag-major-minor-action@v0 | ||
with: | ||
major: ${{ needs.release.outputs.major }} | ||
minor: ${{ needs.release.outputs.minor }} |
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ pnpm-debug.log* | |
!.vscode/extensions.json | ||
|
||
# dist and cache | ||
/dist | ||
# /dist | ||
/dist-* | ||
/dist_* | ||
.cache | ||
|
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/** | ||
* lint-staged config | ||
* @ref https://www.npmjs.com/package/lint-staged | ||
*/ | ||
module.exports = { | ||
'*': 'prettier --ignore-unknown --write', | ||
'*.{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 |
---|---|---|
@@ -1 +1 @@ | ||
18 | ||
20 |
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
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/** | ||
* prettier.config | ||
* @ref https://prettier.io/ | ||
* @type {import('prettier').Config} | ||
*/ | ||
module.exports = { | ||
tabWidth: 2, | ||
singleQuote: true, | ||
printWith: 120, | ||
tabWidth: 4, | ||
singleQuote: true, | ||
printWidth: 160, | ||
}; |
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
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,22 @@ | ||
"use strict"; | ||
const mapWorkspaces = require("@npmcli/map-workspaces"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
async function rewritePkgJSON(cwd, context) { | ||
var _a; | ||
const owner = (_a = context.payload.repository) == null ? void 0 : _a.owner.login; | ||
if (!owner) { | ||
throw new Error("No owner found in context"); | ||
} | ||
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "/package.json"), "utf-8")); | ||
const workspaces = await mapWorkspaces({ pkg, cwd }); | ||
Object.values(workspaces).forEach((workspace) => { | ||
const file = path.join(workspace, "/package.json"); | ||
const pkg2 = JSON.parse(fs.readFileSync(file, "utf-8")); | ||
const underlineName = pkg2.name.replace(/@(.*)\/(.*)/, "$1__$2"); | ||
pkg2.name = "@" + owner + "/" + underlineName; | ||
fs.writeFileSync(file, JSON.stringify(pkg2), "utf-8"); | ||
}); | ||
} | ||
module.exports = rewritePkgJSON; | ||
//# sourceMappingURL=index.cjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 @@ | ||
import { Context } from '@actions/github/lib/context'; | ||
|
||
export default function rewritePkgJSON(cwd: string, context: Context): Promise<void>; |
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,23 @@ | ||
import mapWorkspaces from "@npmcli/map-workspaces"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
async function rewritePkgJSON(cwd, context) { | ||
var _a; | ||
const owner = (_a = context.payload.repository) == null ? void 0 : _a.owner.login; | ||
if (!owner) { | ||
throw new Error("No owner found in context"); | ||
} | ||
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "/package.json"), "utf-8")); | ||
const workspaces = await mapWorkspaces({ pkg, cwd }); | ||
Object.values(workspaces).forEach((workspace) => { | ||
const file = path.join(workspace, "/package.json"); | ||
const pkg2 = JSON.parse(fs.readFileSync(file, "utf-8")); | ||
const underlineName = pkg2.name.replace(/@(.*)\/(.*)/, "$1__$2"); | ||
pkg2.name = "@" + owner + "/" + underlineName; | ||
fs.writeFileSync(file, JSON.stringify(pkg2), "utf-8"); | ||
}); | ||
} | ||
export { | ||
rewritePkgJSON as default | ||
}; | ||
//# sourceMappingURL=index.mjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.