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
113 changes: 113 additions & 0 deletions .claude/skills/add-ecosystem-ci/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
name: add-ecosystem-ci
description: Add a new ecosystem-ci test case for testing real-world projects against vite-plus
allowed-tools: Bash, Read, Edit, Write, WebFetch, AskUserQuestion
---

# Add Ecosystem-CI Test Case

Add a new ecosystem-ci test case following this process:

## Step 1: Get Repository Information

Ask the user for the GitHub repository URL if not provided as argument: $ARGUMENTS

Use GitHub CLI to get repository info:

```bash
gh api repos/OWNER/REPO --jq '.default_branch'
gh api repos/OWNER/REPO/commits/BRANCH --jq '.sha'
```

## Step 2: Auto-detect Project Configuration

### 2.1 Check for Subdirectory

Fetch the repository's root to check if the main package.json is in a subdirectory (like `web/`, `app/`, `frontend/`).

### 2.2 Auto-detect Commands from GitHub Workflows

Fetch the project's GitHub workflow files to detect available commands:

```bash
# List workflow files
gh api repos/OWNER/REPO/contents/.github/workflows --jq '.[].name'

# Fetch workflow content (for each .yml/.yaml file)
gh api repos/OWNER/REPO/contents/.github/workflows/ci.yml --jq '.content' | base64 -d
```

Look for common patterns in workflow files:

- `pnpm run <command>` / `npm run <command>` / `yarn <command>`
- Commands like: `lint`, `build`, `test`, `type-check`, `typecheck`, `format`, `format:check`
- Map detected commands to vite equivalents: `vite run lint`, `vite run build`, etc.

### 2.3 Ask User to Confirm

Present the auto-detected configuration and ask user to confirm or modify:

- Which directory contains the main package.json? (auto-detected or manual)
- What Node.js version to use? (22 or 24, try to detect from workflow)
- Which commands to run? (show detected commands as multi-select options)
- Which OS to run on? (both, ubuntu-only, windows-only) - default: both

## Step 3: Update Files

1. **Add to `ecosystem-ci/repo.json`**:

```json
{
"project-name": {
"repository": "https://github.com/owner/repo.git",
"branch": "main",
"hash": "full-commit-sha",
"directory": "web" // only if subdirectory is needed
}
}
```

2. **Add to `.github/workflows/e2e-test.yml`** matrix:
```yaml
- name: project-name
node-version: 24
directory: web # only if subdirectory is needed
command: |
vite run lint
vite run build
```

## Step 4: Verify

Test the clone locally:

```bash
node ecosystem-ci/clone.ts project-name
```

3. **Add OS exclusion to `.github/workflows/e2e-test.yml`** (if not running on both):

For ubuntu-only:

```yaml
exclude:
- os: windows-latest
project:
name: project-name
```

For windows-only:

```yaml
exclude:
- os: ubuntu-latest
project:
name: project-name
```

## Important Notes

- The `directory` field is optional - only add it if the package.json is not in the project root
- If `directory` is specified in repo.json, it must also be specified in the workflow matrix
- `patch-project.ts` automatically handles running `vite migrate` in the correct directory
- OS exclusions are added to the existing `exclude` section in the workflow matrix
15 changes: 13 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,22 @@ jobs:
vite run lint
vite run test:run
npx tsc --noEmit
- name: dify
node-version: 24
directory: web
command: |
vite run type-check:tsgo
vite run build
vite run test navigation-utils.test.ts real-browser-flicker.test.tsx workflow-parallel-limit.test.tsx
exclude:
# frm-stack uses Docker (testcontainers) which doesn't work the same way on Windows
- os: windows-latest
project:
name: frm-stack
# dify only runs on Linux for now
- os: windows-latest
project:
name: dify

steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
Expand All @@ -253,15 +264,15 @@ jobs:
path: tmp/tgz

- name: Install vite-plus from tgz in ${{ matrix.project.name }}
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
run: |
# install global CLI first
npm install -g $GITHUB_WORKSPACE/tmp/tgz/vite-plus-cli-0.0.0.tgz
node $GITHUB_WORKSPACE/ecosystem-ci/patch-project.ts ${{ matrix.project.name }}
vite install --no-frozen-lockfile

- name: Run vite-plus commands in ${{ matrix.project.name }}
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
run: ${{ matrix.project.command }}

notify-failure:
Expand Down
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ vite dev # runs dev script from package.json
- Only convert to std paths when interfacing with std library functions, and this should be implicit in most cases thanks to `AsRef<Path>` implementations
- Add necessary methods in `vite_path` instead of falling back to std path types

## Git Workflow

- Run `vite fmt` before committing to format code

## Quick Reference

- **Compound Commands**: `"build": "tsc && rollup"` splits into subtasks
Expand Down
5 changes: 4 additions & 1 deletion ecosystem-ci/patch-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ if (!projects.includes(project)) {

async function migrateProject(project: string) {
const repoRoot = join(ecosystemCiDir, project);
const repoConfig = repos[project as keyof typeof repos];
const directory = 'directory' in repoConfig ? repoConfig.directory : undefined;
const cwd = directory ? join(repoRoot, directory) : repoRoot;
// run vite migrate
execSync('vite migrate --no-agent', {
cwd: repoRoot,
cwd,
stdio: 'inherit',
env: {
...process.env,
Expand Down
6 changes: 6 additions & 0 deletions ecosystem-ci/repo.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"dify": {
"repository": "https://github.com/langgenius/dify.git",
"branch": "main",
"hash": "356a156f365a3c762f29303176defb28cbed3710",
"directory": "web"
},
"skeleton": {
"repository": "https://github.com/skeletonlabs/skeleton.git",
"branch": "main",
Expand Down
Loading