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
66 changes: 36 additions & 30 deletions .cursor/rules/CODE_STYLE.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ This project uses Prettier for code formatting. **Always use the project's Prett

```bash
# Format code
yarn prettier
yarn format

# Check formatting
yarn prettier:check
yarn format:check
```

### ESLint Configuration
Expand Down Expand Up @@ -109,12 +109,12 @@ export const editor = Shade(...) // Too generic
```typescript
// ✅ Good
export function getEnvironmentOptions() {}
export const isValidJson = true;
export const DEFAULT_THEME = 'dark';
export const isValidJson = true
export const DEFAULT_THEME = 'dark'

// ❌ Avoid
export function GetEnvironmentOptions() {}
export const IsValidJson = true;
export const IsValidJson = true
```

## Project Structure
Expand Down Expand Up @@ -176,18 +176,18 @@ components/

```typescript
// ✅ Good - organized imports
import { EventEmitter } from 'events';
import { EventEmitter } from 'events'

import { Shade } from '@furystack/shades';
import { Injector } from '@furystack/inject';
import { Shade } from '@furystack/shades'
import { Injector } from '@furystack/inject'

import { MonacoEditor } from '../components/monaco/monaco-editor.js';
import type { EditorOptions } from './types.js';
import { MonacoEditor } from '../components/monaco/monaco-editor.js'
import type { EditorOptions } from './types.js'

// ❌ Avoid - random ordering
import { MonacoEditor } from '../components/monaco/monaco-editor.js';
import { EventEmitter } from 'events';
import { Injector } from '@furystack/inject';
import { MonacoEditor } from '../components/monaco/monaco-editor.js'
import { EventEmitter } from 'events'
import { Injector } from '@furystack/inject'
```

### Import Grouping
Expand All @@ -196,10 +196,10 @@ Separate import groups with blank lines:

```typescript
// ✅ Good - separated groups
import { Injector } from '@furystack/inject';
import { Shade } from '@furystack/shades';
import { Injector } from '@furystack/inject'
import { Shade } from '@furystack/shades'

import { MonacoEditor } from './components/monaco/monaco-editor.js';
import { MonacoEditor } from './components/monaco/monaco-editor.js'
```

## Code Organization
Expand Down Expand Up @@ -228,27 +228,27 @@ export const MyComponent = Shade<MyComponentProps>({

```typescript
// 1. Imports
import { Injectable, Injected } from '@furystack/inject';
import { ObservableValue } from '@furystack/utils';
import { Injectable, Injected } from '@furystack/inject'
import { ObservableValue } from '@furystack/utils'

// 2. Types
type ServiceState = {
data: string;
};
data: string
}

// 3. Service class
@Injectable({ lifetime: 'singleton' })
export class MyService {
// Injected dependencies
@Injected(OtherService)
private declare otherService: OtherService;
declare private otherService: OtherService

// Observable state
public state = new ObservableValue<ServiceState | null>(null);
public state = new ObservableValue<ServiceState | null>(null)

// Public methods
public getData(): string {
return this.state.getValue()?.data ?? '';
return this.state.getValue()?.data ?? ''
}
}
```
Expand Down Expand Up @@ -278,18 +278,24 @@ export class MyService {

```tsx
// ✅ Good - logical AND for simple cases
{isLoading && <div>Loading...</div>}
{
isLoading && <div>Loading...</div>
}

// ✅ Good - ternary for if-else
{isLoading ? <div>Loading...</div> : <div>Content</div>}
{
isLoading ? <div>Loading...</div> : <div>Content</div>
}

// ✅ Good - early return for complex cases
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
return <div>Content</div>;
if (isLoading) return <div>Loading...</div>
if (error) return <div>Error: {error}</div>
return <div>Content</div>

// ❌ Avoid - nested ternaries
{isLoading ? <div>Loading...</div> : error ? <div>Error</div> : <div>Content</div>}
{
isLoading ? <div>Loading...</div> : error ? <div>Error</div> : <div>Content</div>
}
```

## Summary
Expand All @@ -308,7 +314,7 @@ return <div>Content</div>;

**Tools:**

- Prettier: `yarn prettier`
- Prettier: `yarn format`
- ESLint: `yarn lint`
- Type Check: `yarn build`
- Unit Tests: `yarn test:unit`
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Prettier check
run: yarn prettier:check
- name: Format check
run: yarn format:check
- name: Lint
run: yarn lint
- name: Build
Expand All @@ -28,7 +28,7 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Test
run: yarn test:unit
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
env:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Changelog checks
on:
push:
branches-ignore:
- 'release/**'
- 'master'
- 'develop'
pull_request:
branches:
- develop
jobs:
check:
name: Check changelog completion
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Check changelog entries
run: yarn changelog check
env:
CI: true
3 changes: 1 addition & 2 deletions .github/workflows/check-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [22.x]
node-version: [24.x]

steps:
- name: Checkout
Expand All @@ -25,7 +25,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Check version bumps
continue-on-error: true ## Set this to false once versioning has been set up
run: yarn version check
env:
CI: true
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release

on:
workflow_dispatch:
# No inputs - when you trigger, it releases

permissions:
contents: write # Push branches/tags

jobs:
release:
name: Release
runs-on: ubuntu-latest
# Only allow running from develop branch
if: github.ref == 'refs/heads/develop'

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0 # Full history for merging
token: ${{ steps.app-token.outputs.token }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'

- name: Install dependencies
run: yarn install --immutable

- name: Build
run: yarn build

- name: Lint
run: yarn lint

- name: Test
run: yarn test:unit

- name: Apply release changes
run: yarn applyReleaseChanges

- name: Get version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Release version: $VERSION"

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Commit changes if any
run: |
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: release v${{ steps.version.outputs.version }}"
fi

- name: Push develop branch
run: git push origin develop

- name: Merge to master
run: |
git checkout master
git merge develop --no-edit
git push origin master

- name: Create and push release tag
continue-on-error: true
run: |
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"

# Deployment is handled by Netlify automatically on push to master
# No manual deployment step needed - Netlify watches the master branch
# and auto-deploys when changes are detected
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ testresults

.pnp.*
.yarn/*
!.yarn/changelogs
!.yarn/patches
!.yarn/plugins
!.yarn/releases
Expand Down
Empty file added .yarn/changelogs/.gitkeep
Empty file.
Loading
Loading