Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup git hooks and init CI pipeline #1

Merged
merged 8 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Twitch API
PLASMO_PUBLIC_TWITCH_CLIENT_ID=
PLASMO_PUBLIC_TWITCH_API_URL=https://api.twitch.tv/helix

# Rust Consumer API
PLASMO_PUBLIC_API_URL=

# App Environment
PLASMO_PUBLIC_ENVIRONMENT=development
PLASMO_PUBLIC_STAGE=local
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check lint
run: pnpm run check:ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*
!.env.example

out/
build/
Expand Down
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/biome.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/extension.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ensures exact versions are installed and saved in package.json
save-exact=true

# Disables caching of side effects to avoid issues with post-install scripts
side-effects-cache=false
8 changes: 7 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"enabled": true
},
"files": {
"ignore": [".plasmo", "node_modules", "build"]
"ignore": [".plasmo", "node_modules", "build"],
"ignoreUnknown": true
},
"linter": {
"enabled": true,
Expand All @@ -22,5 +23,10 @@
"enabled": true
// Add here things that aren't default
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
17 changes: 17 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://json.schemastore.org/lefthook.json

# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md

assert_lefthook_installed: true

pre-commit:
parallel: false
commands:
lint:
run: pnpx @biomejs/biome check --no-errors-on-unmatched --files-ignore-unknown=true -- {staged_files}
pre-push:
parallel: false
commands:
lint:
run: pnpx @biomejs/biome check --no-errors-on-unmatched --files-ignore-unknown=true -- {push_files}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"dev:chrome": "plasmo dev --target=chrome-mv3",
"package": "plasmo package",
"check": "biome check",
"check:fix": "biome check --write"
"check:fix": "biome check --write",
"check:ci": "biome ci ."
},
"dependencies": {
"@plasmohq/messaging": "^0.6.2",
Expand Down Expand Up @@ -44,12 +45,12 @@
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@ianvs/prettier-plugin-sort-imports": "4.1.1",
"@types/chrome": "0.0.258",
"@types/node": "20.11.5",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"@types/webextension-polyfill": "^0.10.7",
"lefthook": "1.7.12",
"postcss": "8.4.33",
"rimraf": "6.0.1",
"typescript": "5.3.3",
Expand Down
Loading