Skip to content
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
35 changes: 35 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read

# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
- name: Install dependencies
run: npm install
- name: Enable pre-commit hooks
run: npm run prepare
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release DYA Studio

on:
workflow_dispatch:
workflow_dispatch:

jobs:
build:
Expand All @@ -27,4 +27,4 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN_RELEASE }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID_RELEASE }}
environment: release
wranglerVersion: '4.58.0'
wranglerVersion: "4.58.0"
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload --assets dist --name dya-studio --compatibility-date 2026-01-11
wranglerVersion: '4.58.0'
wranglerVersion: "4.58.0"

- name: Comment PR with deployment URL
uses: actions/github-script@v7
Expand Down Expand Up @@ -123,4 +123,4 @@ jobs:
issue_number: context.issue.number,
body: comment
});
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ coverage
*.njsproj
*.sln
*.sw?
_codeql_detected_source_root
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
npm test
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist
node_modules
coverage
*.min.js
*.min.css
pnpm-lock.yaml
package-lock.json
src/proto
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}
56 changes: 56 additions & 0 deletions docs/PRECOMMIT_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Pre-commit Hooks Setup

This project uses [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/lint-staged/lint-staged) to ensure code quality before commits.

## What runs on pre-commit?

1. **Formatting**: Prettier formats staged files (`.ts`, `.tsx`, `.json`, `.md`, `.yml`, `.yaml`)
2. **Linting**: ESLint checks and auto-fixes staged TypeScript files
3. **Testing**: Full test suite runs to ensure nothing is broken

## How it works

When you run `git commit`, the pre-commit hook automatically:

- Runs `lint-staged` to format and lint only the staged files
- Runs `npm test` to verify all tests pass
- If any step fails, the commit is aborted

## Manual commands

You can also run these checks manually:

```bash
# Format all files
npm run format

# Check formatting without changing files
npm run format:check

# Run linting
npm run lint

# Run tests
npm test
```

## First-time setup

If you clone this repository, run:

```bash
npm install
```

This will automatically set up Husky hooks via the `prepare` script.

## GitHub Actions

The project includes a Copilot workflow (`.github/workflows/copilot.yml`) that runs:

- Format check
- Lint
- Tests
- Build

This ensures all code quality checks pass in CI/CD.
18 changes: 9 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import { defineConfig, globalIgnores } from "eslint/config";

export default defineConfig([
globalIgnores(['dist']),
globalIgnores(["dist"]),
{
files: ['**/*.{ts,tsx}'],
files: ["**/*.{ts,tsx}"],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
Expand All @@ -20,4 +20,4 @@ export default defineConfig([
globals: globals.browser,
},
},
])
]);
Loading