-
-
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
0 parents
commit da10769
Showing
29 changed files
with
14,307 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,13 @@ | ||
# don't ever lint node_modules | ||
node_modules | ||
# don't lint build output (make sure it's set to your correct build folder name) | ||
dist | ||
# don't lint nyc coverage output | ||
coverage | ||
# don't lint the packages | ||
packages | ||
# don't line the docs | ||
docs | ||
.eslintrc.js | ||
reset.d.ts | ||
commitlint.config.js |
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,61 @@ | ||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
module.exports = { | ||
$schema: 'http://json.schemastore.org/eslintrc', | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'jest', 'prettier', 'deprecation', 'unused-imports'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'eslint:recommended', | ||
'plugin:prettier/recommended', | ||
'prettier', | ||
'plugin:jsonc/recommended-with-jsonc', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/consistent-type-imports': 'error', | ||
'no-unused-vars': 'off', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
endOfLine: 'auto', | ||
}, | ||
], | ||
'deprecation/deprecation': 'warn', | ||
'unused-imports/no-unused-imports': 'error', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.spec.js'], | ||
plugins: ['jest'], | ||
extends: ['plugin:jest/recommended'], | ||
rules: { | ||
'jest/prefer-expect-assertions': 0, | ||
}, | ||
}, | ||
{ | ||
files: ['*.json'], | ||
parser: 'jsonc-eslint-parser', | ||
extends: ['plugin:jsonc/recommended-with-jsonc'], | ||
rules: { | ||
'deprecation/deprecation': 'off', | ||
'@typescript-eslint/consistent-type-imports': 'off', | ||
}, | ||
}, | ||
], | ||
} |
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,58 @@ | ||
--- | ||
name: '☑️ Checks Pipeline' | ||
description: 'Checks the codebase health' | ||
|
||
inputs: | ||
run-tests-command: | ||
description: 'Run tests command, default is `npm test`' | ||
default: 'npm test' | ||
required: false | ||
|
||
run-tests: | ||
description: 'Run tests' | ||
default: 'true' | ||
required: false | ||
|
||
run-lint-command: | ||
description: 'Run linter command, default is `npm run lint`' | ||
default: 'npm run lint' | ||
required: false | ||
|
||
run-lint: | ||
description: 'Run lint' | ||
default: 'true' | ||
required: false | ||
|
||
run-build-command: | ||
description: 'Run build command, default is `npm run build`' | ||
default: 'npm run build' | ||
required: false | ||
|
||
run-build: | ||
description: 'Run build' | ||
default: 'true' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: 🖥️ Setup Env | ||
uses: ./.github/workflows/install | ||
|
||
- name: 🧪 Test | ||
if: ${{ inputs.run-tests == 'true' }} | ||
shell: bash | ||
run: | | ||
${{ inputs.run-tests-command }} | ||
- name: 🔨 Build | ||
if: ${{ inputs.run-build == 'true' }} | ||
shell: bash | ||
run: | | ||
${{ inputs.run-build-command }} | ||
- name: ✅ Lint | ||
if: ${{ inputs.run-lint == 'true' }} | ||
shell: bash | ||
run: | | ||
${{ inputs.run-lint-command }} |
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,16 @@ | ||
--- | ||
name: '☑️ Install deps' | ||
description: 'Install dependencies and setup node' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: 🖥️ Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: 🔗 Install Dependencies | ||
shell: bash | ||
run: | | ||
npm ci --no-fund --no-audit --no-progress --ignore-scripts |
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 @@ | ||
--- | ||
name: PR Health Checks 🐛 | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
PR-checks: | ||
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow | ||
runs-on: ubuntu-latest | ||
name: PR Health Checks 🐛 | ||
steps: | ||
- name: 📀 Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: 🧪 Check out repository code | ||
uses: ./.github/workflows/health-check |
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,77 @@ | ||
--- | ||
name: '📦 Create New Release' | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
issues: write | ||
deployments: write | ||
|
||
concurrency: | ||
group: release-master-${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
checks: | ||
name: ✅ Check for Release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: 🧪 Check out repository code | ||
uses: ./.github/workflows/health-check | ||
|
||
release: | ||
name: 📦 Release Version | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
needs: | ||
- checks | ||
|
||
env: | ||
HUSKY: 0 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Git Config | ||
run: | | ||
git config --global user.name "github-bot" | ||
git config --global user.email "[email protected]" | ||
- name: 🖥️ Setup Env | ||
uses: ./.github/workflows/install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Setup NPM | ||
run: | | ||
npm config -L user set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
GIT_AUTHOR_NAME: github-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: github-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: | | ||
npx semantic-release |
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,98 @@ | ||
--- | ||
name: Semantic Release Report 📝 | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
PR-checks: | ||
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow | ||
runs-on: ubuntu-latest | ||
name: Semantic Release Report 📝 | ||
steps: | ||
- name: 📀 Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 🖥️ Setup Env | ||
uses: ./.github/workflows/install | ||
|
||
- name: 🔬 Check Semantic Versioning | ||
id: semantic-release | ||
run: | | ||
GITHUB_REF=${{ github.head_ref }} | ||
npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator --branches ${{ github.head_ref }} > output.txt | ||
REPORT=$(cat output.txt | base64 -w 0) | ||
VERSION=$(cat output.txt | \ | ||
grep "The next release version is" | \ | ||
node -e "console.log(require('fs').readFileSync(0, 'utf-8').match(/The next release version is (\d+\.\d+\.\d+(-beta\.\d+)?)/)?.[1] ?? '')") | ||
echo "releaseNote=$REPORT" >> $GITHUB_OUTPUT | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- name: 📝 Report semantic versioning | ||
uses: actions/github-script@v7 | ||
if: ${{ steps.semantic-release.outputs.releaseNote != '' }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
// build release note | ||
const semanticReleaseOutput = Buffer.from('${{ steps.semantic-release.outputs.releaseNote }}', 'base64').toString('utf8'); | ||
const semanticReleaseLogMatch = /^[[0-9:\sAMPM]+\]\s\[semantic-release\].*$/; | ||
const lines = semanticReleaseOutput.split('\n'); | ||
const lastSemanticReleaseLogIndex = [...lines] | ||
.reverse() | ||
.findIndex((line) => line.match(semanticReleaseLogMatch)); | ||
const nextVersion = '${{ steps.semantic-release.outputs.version }}'; | ||
const releaseNoteIndex = lines.length - lastSemanticReleaseLogIndex; | ||
const releaseNote = lines.slice(releaseNoteIndex); | ||
let res = releaseNote.join('\n'); | ||
if (!releaseNote.length || !res) { | ||
res = '### No release note would be generated.'; | ||
} | ||
const SEMANTIC_RELEASE_BODY_HEADER = '## 📝 Semantic Release Report'; | ||
const NEXT_VERSION_HEADER = `### 🚀 Next Version: ${nextVersion}`; | ||
const body = [SEMANTIC_RELEASE_BODY_HEADER, NEXT_VERSION_HEADER, res].join('\n'); | ||
// get last comment | ||
const comments = await github.rest.issues.listComments({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
// find comments to delete | ||
const commentsToDelete = comments.data.filter((comment) => | ||
comment.body.startsWith(SEMANTIC_RELEASE_BODY_HEADER) | ||
); | ||
// delete comments | ||
const prms = commentsToDelete.map((comment) => | ||
github.rest.issues.deleteComment({ | ||
comment_id: comment.id, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}) | ||
); | ||
await Promise.all(prms); | ||
// create new comment for release note | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body | ||
}); |
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,5 @@ | ||
node_modules | ||
/lib | ||
.DS_Store | ||
coverage | ||
.eslintcache |
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 @@ | ||
npx --no -- 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 @@ | ||
npx lint-staged |
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 @@ | ||
module.exports = { | ||
'*.{ts,cjs,js,json}': 'npx eslint --cache --fix', | ||
'**/*': 'npx prettier --cache --write --ignore-unknown', | ||
} |
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,5 @@ | ||
test/**/* | ||
**/test/**/* | ||
**/mocks/**/* | ||
**/*.mock.* | ||
**/*.spec.* |
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,2 @@ | ||
registry=https://registry.npmjs.org/ | ||
|
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,2 @@ | ||
node_modules | ||
SECURITY.md |
Oops, something went wrong.