Skip to content

Commit

Permalink
ci: prettier_action
Browse files Browse the repository at this point in the history
  • Loading branch information
olemathias committed Oct 11, 2024
1 parent e41e5ab commit 909a03f
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ on:
workflow_dispatch:

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Astro check
run: pnpm astro check
- name: Prettier check
run: pnpm exec prettier --check .
build-test:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npx lint-staged
pnpm astro check
7 changes: 4 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ For basic installation of backend repo see [backend repo](https://github.com/gat
1. Clone this repo
2. Make sure you have the correct node version installed (`nvm use` then `nvm install`)
3. Run `pnpm install`
4. Run `pnpm dev`
5. Frontend should now be available on `localhost:4321` serving content from `https://dev.tg.no`
4. Run `pnpm prepare` # Setup Husky for pre-commit
5. Run `pnpm dev`
6. Frontend should now be available on `localhost:4321` serving content from `https://dev.tg.no`

## Using local backend

Expand All @@ -24,7 +25,7 @@ Same procedure as above, but with a few extra steps:

## Using production backend

Identical to using local backend section above, but use `https://prod.tg.no/`/`https://tg.no/` instead of `http://localhost:8000/`
Identical to using local backend section above, but use `https://www.tg.no/` instead of `http://localhost:8000/`

## Common issues

Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"start": "astro dev",
"build": "astro check && export $(grep -v '^\\s*$\\|^\\s*\\#' .env.runtime) && astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"prepare": "husky"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
Expand All @@ -22,7 +23,12 @@
},
"devDependencies": {
"@types/dompurify": "^3.0.5",
"husky": ">=7",
"lint-staged": ">=10",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1"
},
"lint-staged": {
"*.{js,ts,mjs,css,md,astro,yaml,json}": "prettier --write"
}
}
Loading

0 comments on commit 909a03f

Please sign in to comment.