diff --git a/.claude/skills/add-ecosystem-ci/SKILL.md b/.claude/skills/add-ecosystem-ci/SKILL.md new file mode 100644 index 0000000000..34c99635de --- /dev/null +++ b/.claude/skills/add-ecosystem-ci/SKILL.md @@ -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 ` / `npm run ` / `yarn ` +- 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 diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 450dab1e99..5854b4c48c 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -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 @@ -253,7 +264,7 @@ 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 @@ -261,7 +272,7 @@ jobs: 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: diff --git a/CLAUDE.md b/CLAUDE.md index 110d18ee24..3039520c01 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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` 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 diff --git a/ecosystem-ci/patch-project.ts b/ecosystem-ci/patch-project.ts index 51c9e86e1b..b620c5f814 100644 --- a/ecosystem-ci/patch-project.ts +++ b/ecosystem-ci/patch-project.ts @@ -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, diff --git a/ecosystem-ci/repo.json b/ecosystem-ci/repo.json index b88aebfc5b..cd9062b039 100644 --- a/ecosystem-ci/repo.json +++ b/ecosystem-ci/repo.json @@ -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",