Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mutec authored Nov 3, 2024
0 parents commit 9f9fb05
Show file tree
Hide file tree
Showing 25 changed files with 7,076 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/diff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"problemMatcher": [
{
"owner": "diff",
"pattern": [
{
"regexp": "--- a/(.*)",
"file": 1,
"message": 1
}
]
}
]
}
15 changes: 15 additions & 0 deletions .github/javascript-syntax.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"owner": "node -c",
"pattern": [
{
"regexp": "^(./\\S+):(\\d+) - (.*)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}
32 changes: 32 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Code Style

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
ts:
name: TS Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- run: npm install
- name: Run prettier
run: |
shopt -s globstar
npx prettier -w src/**/*.ts
- run: echo "::add-matcher::.github/diff.json"
- name: Show diff
run: |
git checkout -- package-lock.json
git diff --exit-code
32 changes: 32 additions & 0 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: JavaScript

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
syntax:
name: "Check Syntax"
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- uses: actions/checkout@v4
- run: echo "::add-matcher::.github/javascript-syntax.json"
- name: Remove files to be ignored
run: |
true
- run: |
! find dist/ -type f -name '*.js' -exec node -c '{}' \; 2>&1 \
|awk 'BEGIN {m=0} /(.js):[0-9]+$/ {m=1; printf "%s - ",$0} m==1 && /^SyntaxError/ { m=0; print }' \
|sed "s@$(pwd)@.@" \
|grep '^'
40 changes: 40 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Pull Requests

on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
- review_requested

permissions:
contents: read
pull-requests: read

jobs:
commit_message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Check for GitHub's default message.
uses: gsactions/commit-message-checker@8c8c0d18ba9b1fcfed6e7385fd2bf357dfc8dccb
with:
pattern: '^(?!Update\s+\S*$).*$'
error: "Please use a meaningful commit message."
excludeDescription: "true"
excludeTitle: "true"
checkAllCommitMessages: "true"
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check for unsquashed `fixup!` commits.
if: ${{ ! github.event.pull_request.draft }}
uses: gsactions/commit-message-checker@8c8c0d18ba9b1fcfed6e7385fd2bf357dfc8dccb
with:
pattern: '^(?!fixup!(\s|$))'
error: "A `fixup!` commit was found."
excludeDescription: "true"
excludeTitle: "true"
checkAllCommitMessages: "true"
accessToken: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
tags: [ '*' ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.com/"
- run: npm ci
- name: Publish to npmjs.com
if: startsWith(github.ref, 'refs/tags/')
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Pack
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "*.tar.gz"
- name: Create package
if: startsWith(github.ref, 'refs/tags/')
run: |
rm -rf *.tgz
npm pack
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "*.tgz"
- name: On Build Failure
if: steps.check_files.outputs.files_exists == 'false'
run: |
echo "Packaging FAILED" && exit 1
63 changes: 63 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: TypeScript

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
tsc:
name: "TSC"
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- run: npm install
- run: |
npx tsc --noEmit
eslint:
name: "eslint"
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- run: npm install
- run: npx eslint .
javascript_sync:
name: "Check for outdated JavaScript"
needs: tsc
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- run: npm install
- run: rm -R dist/**/*.js
- run: |
npx tsc
- run: echo "::add-matcher::.github/diff.json"
- name: Show diff
run: |
git checkout -- package-lock.json
git diff --exit-code
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trailingComma: all
printWidth: 120
Loading

0 comments on commit 9f9fb05

Please sign in to comment.