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

General repository improvements #31

Merged
merged 14 commits into from
Feb 2, 2025
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
31 changes: 29 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,40 @@ jobs:

# Install dependencies
- name: 📦 Install dependencies
run: |
npm ci
run: npm ci

# Lint code
- name: 🧹 Lint code
run: npm run lint

# Check format
- name: 🧹 Check format
run: npm run format:check

# Run tests
- name: 🧪 Run unit tests
run: npm run test:unit

# Setup PocketBase
- name: 🗄️ Download and setup PocketBase
run: npm run test:e2e:setup

# Start PocketBase
- name: 🚀 Start PocketBase
run: ./.pocketbase/pocketbase serve &

# Wait for PocketBase to be ready
- name: ⏳ Wait for PocketBase
run: |
until curl -s --fail http://localhost:8090/api/health; do
echo 'Waiting for PocketBase...'
sleep 5
done

# Run tests
- name: 🧪 Run e2e tests
run: npm run test:e2e

# Create release
- name: 🚀 Create release
id: release
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 🧪 Test code
# Run this on every push except master and next
on:
push:
branches:
- "**"
- "!master"
- "!next"
permissions:
contents: read

jobs:
test:
# Use the latest version of Ubuntu
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
# Checkout repository
- name: 📥 Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false

# Setup Node
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"

# Install dependencies
- name: 📦 Install dependencies
run: npm ci

# Lint code
- name: 🧹 Lint code
run: npm run lint

# Check format
- name: 🧹 Check format
run: npm run format:check

# Run tests
- name: 🧪 Run unit tests
run: npm run test:unit

# Setup PocketBase
- name: 🗄️ Download and setup PocketBase
run: npm run test:e2e:setup

# Start PocketBase
- name: 🚀 Start PocketBase
run: ./.pocketbase/pocketbase serve &

# Wait for PocketBase to be ready
- name: ⏳ Wait for PocketBase
run: |
until curl -s --fail http://localhost:8090/api/health; do
echo 'Waiting for PocketBase...'
sleep 5
done

# Run tests
- name: 🧪 Run e2e tests
run: npm run test:e2e
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# build output
dist/
.eslintcache
coverage/
# generated types
.astro/

Expand All @@ -12,7 +14,6 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production
Expand All @@ -22,3 +23,6 @@ pnpm-debug.log*

# jetbrains setting folder
.idea/

# PocketBase folder
.pocketbase/
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run lint
npx lint-staged
30 changes: 30 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# build output
dist/
.eslintcache
CHANGELOG.md
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/

# misc
.husky/
.prettierignore
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "none",
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import eslint from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import prettier from "eslint-config-prettier";
import globals from "globals";
import tseslint from "typescript-eslint";

const config = tseslint.config({
files: ["**/*.{js,mjs,cjs,ts}"],
ignores: [".pocketbase/**/*"],
languageOptions: {
globals: { ...globals.browser, ...globals.node }
},
extends: [
eslint.configs.recommended,
prettier,
...tseslint.configs.recommended,
...tseslint.configs.stylistic
],
Expand Down
5 changes: 0 additions & 5 deletions index.ts

This file was deleted.

7 changes: 7 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @type {import('lint-staged').Configuration}
*/
export default {
"!(*.ts)": "prettier --write",
"*.ts": ["eslint --fix", "prettier --write"]
};
Loading