forked from hmarr/openai-chat-tokens
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* π Setup the project * π Rename LICENSE.txt * π Update GitHub Actions badges in README.md * π§ Enforce modern tsconfig.json * π¦Ί Use `readonly` * π§ Update permissions in pnpm-publish.yaml and pnpm-version-patch.yaml workflows
- Loading branch information
Showing
30 changed files
with
3,551 additions
and
2,836 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,5 @@ | ||
dist/ | ||
docs/ | ||
node_modules/ | ||
package-lock.json | ||
pnpm-lock.yaml |
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,43 @@ | ||
root: true | ||
env: | ||
browser: true | ||
es2021: true | ||
node: true | ||
extends: | ||
- plugin:@typescript-eslint/strict-type-checked | ||
- plugin:@typescript-eslint/stylistic-type-checked | ||
- prettier | ||
parser: "@typescript-eslint/parser" | ||
parserOptions: | ||
ecmaVersion: latest | ||
sourceType: module | ||
project: "./tsconfig.eslint.json" | ||
plugins: | ||
- "@typescript-eslint" | ||
rules: | ||
"@typescript-eslint/class-methods-use-this": error | ||
"@typescript-eslint/consistent-type-exports": error | ||
"@typescript-eslint/consistent-type-imports": error | ||
"@typescript-eslint/default-param-last": error | ||
"@typescript-eslint/explicit-member-accessibility": | ||
- error | ||
- accessibility: no-public | ||
"@typescript-eslint/method-signature-style": error | ||
"@typescript-eslint/no-import-type-side-effects": error | ||
"@typescript-eslint/no-unnecessary-qualifier": error | ||
"@typescript-eslint/no-useless-empty-export": error | ||
"@typescript-eslint/prefer-nullish-coalescing": | ||
- error | ||
- ignorePrimitives: true | ||
"@typescript-eslint/prefer-readonly": error | ||
"@typescript-eslint/prefer-regexp-exec": error | ||
"@typescript-eslint/promise-function-async": | ||
- error | ||
- checkArrowFunctions: false | ||
"@typescript-eslint/require-array-sort-compare": error | ||
"@typescript-eslint/return-await": error | ||
"@typescript-eslint/sort-type-constituents": error | ||
|
||
func-style: | ||
- error | ||
- declaration |
Validating CODEOWNERS rules β¦
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 @@ | ||
* @coderabbitai/typescript-reviewers |
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 @@ | ||
41898282+github-actions[bot]@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKOzgFi8S4xZHCSjGi3u0T2OZYvefkFu8px+bLncFhq8 41898282+github-actions[bot]@users.noreply.github.com |
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,45 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
timezone: America/Toronto | ||
commit-message: | ||
prefix: "β¬οΈ " | ||
groups: | ||
patch-development: | ||
dependency-type: development | ||
update-types: | ||
- patch | ||
patch-production: | ||
dependency-type: production | ||
update-types: | ||
- patch | ||
|
||
eslint: | ||
patterns: | ||
- "*eslint*" | ||
prettier: | ||
patterns: | ||
- "*prettier*" | ||
openai: | ||
patterns: | ||
- "*openai*" | ||
- "*tiktoken*" | ||
vite: | ||
patterns: | ||
- vite | ||
- vitest | ||
typescript: | ||
patterns: | ||
- "*typescript*" | ||
- tslib | ||
|
||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
timezone: America/Toronto | ||
commit-message: | ||
prefix: "β¬οΈ " |
This file was deleted.
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,41 @@ | ||
name: GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
build_pages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: latest | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 21 | ||
cache: pnpm | ||
- run: pnpm install --frozen-lockfile | ||
- run: pnpm run docs | ||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: docs | ||
|
||
deploy_pages: | ||
needs: build_pages | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- id: deployment | ||
uses: actions/deploy-pages@v1 |
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,25 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: latest | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 21 | ||
cache: pnpm | ||
- run: pnpm install --frozen-lockfile | ||
- run: pnpm run build --noEmit | ||
- run: pnpm run lint | ||
- run: pnpm 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Node.js Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: latest | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: 21 | ||
- run: pnpm install | ||
- run: pnpm build | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: https://npm.pkg.github.com | ||
scope: "@coderabbitai" | ||
- run: pnpm publish --access public --no-git-checks --provenance | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: https://registry.npmjs.org | ||
scope: "@coderabbitai" | ||
- run: pnpm publish --access public --no-git-checks --provenance | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.CODERABBIT_NPMTOKEN }} | ||
|
||
- run: pnpm pack --pack-gzip-level 9 | ||
- name: Sign | ||
run: | | ||
eval `ssh-agent -s` | ||
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}' | ||
echo '${{ vars.DEPLOY_KEY_PUBLIC }}' > '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub' | ||
ssh-keygen -Y sign -f '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub' -n file coderabbitai-openai-chat-tokens-*.tgz | ||
ssh-keygen -Y verify -f ./.github/authorized_keys -I '41898282+github-actions[bot]@users.noreply.github.com' -n file -s coderabbitai-openai-chat-tokens-*.tgz.sig < coderabbitai-openai-chat-tokens-*.tgz | ||
- run: gh release upload ${{ github.ref_name }} coderabbitai-openai-chat-tokens-*.tgz coderabbitai-openai-chat-tokens-*.tgz.sig | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,44 @@ | ||
name: Node.js Patch | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
patch: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY_PRIVATE }} | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: latest | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: 21 | ||
- name: Configure Git, patch, release and push | ||
run: | | ||
git config user.name 'github-actions[bot]' | ||
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
git config commit.gpgsign true | ||
git config gpg.format ssh | ||
git config user.signingkey 'key::${{ vars.DEPLOY_KEY_PUBLIC }}' | ||
eval `ssh-agent -s` | ||
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}' | ||
VERSION=$(pnpm version patch --no-git-tag-version) | ||
git commit --all --message "π $VERSION" | ||
git tag --annotate --message "π $VERSION" --sign $VERSION | ||
git push | ||
git push --tags | ||
gh release create $VERSION --generate-notes --title $VERSION --verify-tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.