Skip to content

Commit 39be88f

Browse files
authored
πŸŽ‰ Setup the project (#2)
* πŸŽ‰ 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
1 parent d9719c3 commit 39be88f

30 files changed

+3551
-2836
lines changed

β€Ž.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist/
2+
docs/
3+
node_modules/
4+
package-lock.json
5+
pnpm-lock.yaml

β€Ž.eslintrc.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
root: true
2+
env:
3+
browser: true
4+
es2021: true
5+
node: true
6+
extends:
7+
- plugin:@typescript-eslint/strict-type-checked
8+
- plugin:@typescript-eslint/stylistic-type-checked
9+
- prettier
10+
parser: "@typescript-eslint/parser"
11+
parserOptions:
12+
ecmaVersion: latest
13+
sourceType: module
14+
project: "./tsconfig.eslint.json"
15+
plugins:
16+
- "@typescript-eslint"
17+
rules:
18+
"@typescript-eslint/class-methods-use-this": error
19+
"@typescript-eslint/consistent-type-exports": error
20+
"@typescript-eslint/consistent-type-imports": error
21+
"@typescript-eslint/default-param-last": error
22+
"@typescript-eslint/explicit-member-accessibility":
23+
- error
24+
- accessibility: no-public
25+
"@typescript-eslint/method-signature-style": error
26+
"@typescript-eslint/no-import-type-side-effects": error
27+
"@typescript-eslint/no-unnecessary-qualifier": error
28+
"@typescript-eslint/no-useless-empty-export": error
29+
"@typescript-eslint/prefer-nullish-coalescing":
30+
- error
31+
- ignorePrimitives: true
32+
"@typescript-eslint/prefer-readonly": error
33+
"@typescript-eslint/prefer-regexp-exec": error
34+
"@typescript-eslint/promise-function-async":
35+
- error
36+
- checkArrowFunctions: false
37+
"@typescript-eslint/require-array-sort-compare": error
38+
"@typescript-eslint/return-await": error
39+
"@typescript-eslint/sort-type-constituents": error
40+
41+
func-style:
42+
- error
43+
- declaration

β€Ž.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @coderabbitai/typescript-reviewers

β€Ž.github/authorized_keys

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
41898282+github-actions[bot]@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKOzgFi8S4xZHCSjGi3u0T2OZYvefkFu8px+bLncFhq8 41898282+github-actions[bot]@users.noreply.github.com

β€Ž.github/dependabot.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
timezone: America/Toronto
8+
commit-message:
9+
prefix: "⬆️ "
10+
groups:
11+
patch-development:
12+
dependency-type: development
13+
update-types:
14+
- patch
15+
patch-production:
16+
dependency-type: production
17+
update-types:
18+
- patch
19+
20+
eslint:
21+
patterns:
22+
- "*eslint*"
23+
prettier:
24+
patterns:
25+
- "*prettier*"
26+
openai:
27+
patterns:
28+
- "*openai*"
29+
- "*tiktoken*"
30+
vite:
31+
patterns:
32+
- vite
33+
- vitest
34+
typescript:
35+
patterns:
36+
- "*typescript*"
37+
- tslib
38+
39+
- package-ecosystem: github-actions
40+
directory: /
41+
schedule:
42+
interval: monthly
43+
timezone: America/Toronto
44+
commit-message:
45+
prefix: "⬆️ "

β€Ž.github/workflows/ci.yml

-20
This file was deleted.
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: GitHub Pages
2+
3+
on:
4+
push:
5+
branches: main
6+
7+
jobs:
8+
build_pages:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: pnpm/action-setup@v2
14+
with:
15+
version: latest
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 21
19+
cache: pnpm
20+
- run: pnpm install --frozen-lockfile
21+
- run: pnpm run docs
22+
- uses: actions/upload-pages-artifact@v1
23+
with:
24+
path: docs
25+
26+
deploy_pages:
27+
needs: build_pages
28+
29+
permissions:
30+
pages: write
31+
id-token: write
32+
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- id: deployment
41+
uses: actions/deploy-pages@v1

β€Ž.github/workflows/node.js.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: pnpm/action-setup@v2
16+
with:
17+
version: latest
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 21
21+
cache: pnpm
22+
- run: pnpm install --frozen-lockfile
23+
- run: pnpm run build --noEmit
24+
- run: pnpm run lint
25+
- run: pnpm run test
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Node.js Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
id-token: write
15+
packages: write
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: pnpm/action-setup@v2
20+
with:
21+
version: latest
22+
- uses: actions/setup-node@v3
23+
with:
24+
cache: pnpm
25+
node-version: 21
26+
- run: pnpm install
27+
- run: pnpm build
28+
29+
- uses: actions/setup-node@v4
30+
with:
31+
registry-url: https://npm.pkg.github.com
32+
scope: "@coderabbitai"
33+
- run: pnpm publish --access public --no-git-checks --provenance
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- uses: actions/setup-node@v4
38+
with:
39+
registry-url: https://registry.npmjs.org
40+
scope: "@coderabbitai"
41+
- run: pnpm publish --access public --no-git-checks --provenance
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.CODERABBIT_NPMTOKEN }}
44+
45+
- run: pnpm pack --pack-gzip-level 9
46+
- name: Sign
47+
run: |
48+
eval `ssh-agent -s`
49+
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}'
50+
echo '${{ vars.DEPLOY_KEY_PUBLIC }}' > '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub'
51+
ssh-keygen -Y sign -f '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub' -n file coderabbitai-openai-chat-tokens-*.tgz
52+
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
53+
- run: gh release upload ${{ github.ref_name }} coderabbitai-openai-chat-tokens-*.tgz coderabbitai-openai-chat-tokens-*.tgz.sig
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Node.js Patch
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
patch:
7+
runs-on: ubuntu-latest
8+
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
ssh-key: ${{ secrets.DEPLOY_KEY_PRIVATE }}
16+
- uses: pnpm/action-setup@v2
17+
with:
18+
version: latest
19+
- uses: actions/setup-node@v3
20+
with:
21+
cache: pnpm
22+
node-version: 21
23+
- name: Configure Git, patch, release and push
24+
run: |
25+
git config user.name 'github-actions[bot]'
26+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
27+
28+
git config commit.gpgsign true
29+
git config gpg.format ssh
30+
git config user.signingkey 'key::${{ vars.DEPLOY_KEY_PUBLIC }}'
31+
32+
eval `ssh-agent -s`
33+
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}'
34+
35+
VERSION=$(pnpm version patch --no-git-tag-version)
36+
37+
git commit --all --message "πŸ”– $VERSION"
38+
git tag --annotate --message "πŸ”– $VERSION" --sign $VERSION
39+
git push
40+
git push --tags
41+
42+
gh release create $VERSION --generate-notes --title $VERSION --verify-tag
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

β€Ž.github/workflows/publish.yml

-21
This file was deleted.

0 commit comments

Comments
Β (0)