Skip to content

Commit afbb297

Browse files
authored
test(e2e): add vite migration e2e (#359)
<!-- CURSOR_SUMMARY --> > [!NOTE] > - **E2E/CI:** Adds `rollipop` to the matrix with custom commands and `skip-install`, sets `GITHUB_TOKEN` in job env, and avoids incorrect `.gitignore` usage during migration. > - **Ecosystem helper:** `patch-project.ts` gains a `vite migrate` path using tgz via `VITE_PLUS_OVERRIDE_PACKAGES` and `VITE_PLUS_VERSION`; `repo.json` and `.gitignore` updated to include `rollipop`. > - **Migration tooling:** Replaces hardcoded override map with env-driven `VITE_PLUS_OVERRIDE_PACKAGES` and `VITE_PLUS_VERSION`, updating package.json and workspace rewrite logic across pnpm/yarn/npm. > - **Core package:** Fixes `exports["./lib"].default` to `./dist/tsdown/index.js` and adds `@babel/*` dependencies. > - **Lockfile:** Updated for new dependencies. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b6debb3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 78dbe56 commit afbb297

8 files changed

Lines changed: 86 additions & 19 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232

3333
e2e-test:
3434
name: ${{ matrix.project.name }} E2E test
35+
env:
36+
# For packing manager install from github package registry
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3538
permissions:
3639
contents: read
3740
packages: read
@@ -50,6 +53,19 @@ jobs:
5053
command: |
5154
pnpm run --filter="@skeletonlabs/*" --filter="!*skeleton.dev" --sequential build
5255
pnpm test
56+
- name: rollipop
57+
node-version: 22
58+
skip-install: true
59+
command: |
60+
vite install --no-frozen-lockfile
61+
vite run -r build
62+
vite run lint
63+
vite run -r typecheck
64+
vite run format
65+
vite run @rollipop/common#test
66+
vite run @rollipop/core#test
67+
vite run @rollipop/dev-server#test
68+
5369
steps:
5470
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5571
- uses: ./.github/actions/clone
@@ -97,7 +113,12 @@ jobs:
97113
- name: Install vite-plus from tgz in ${{ matrix.project.name }}
98114
working-directory: ecosystem-ci/${{ matrix.project.name }}
99115
run: |
116+
# avoid the vite migration using the wrong ignore file
117+
rm -f ../.gitignore
100118
node ../patch-project.ts ${{ matrix.project.name }}
119+
if [ -n "${{ matrix.project.skip-install }}" ]; then
120+
exit 0
121+
fi
101122
pnpm install --no-frozen-lockfile
102123
pnpm playwright install --with-deps
103124

ecosystem-ci/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vibe-dashboard
2-
skeleton
2+
skeleton
3+
rollipop

ecosystem-ci/patch-project.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { execSync } from 'node:child_process';
12
import fs from 'node:fs';
23
import { dirname, join } from 'node:path';
34
import { fileURLToPath } from 'node:url';
@@ -208,13 +209,35 @@ peerDependencyRules:
208209
}
209210
}
210211

212+
async function migrateProject(project: string) {
213+
const repoRoot = join(projectDir, project);
214+
// run vite migrate
215+
execSync('vite migrate', {
216+
cwd: repoRoot,
217+
stdio: 'inherit',
218+
env: {
219+
...process.env,
220+
VITE_PLUS_OVERRIDE_PACKAGES: JSON.stringify({
221+
vite: `file:${tgzPath}/voidzero-dev-vite-plus-core-0.0.0.tgz`,
222+
vitest: `file:${tgzPath}/voidzero-dev-vite-plus-test-0.0.0.tgz`,
223+
'@voidzero-dev/vite-plus-core': `file:${tgzPath}/voidzero-dev-vite-plus-core-0.0.0.tgz`,
224+
'@voidzero-dev/vite-plus-test': `file:${tgzPath}/voidzero-dev-vite-plus-test-0.0.0.tgz`,
225+
}),
226+
VITE_PLUS_VERSION: `file:${tgzPath}/voidzero-dev-vite-plus-0.0.0.tgz`,
227+
},
228+
});
229+
}
230+
211231
switch (project) {
212232
case 'vibe-dashboard':
213233
await patchVibeDashboard();
214234
break;
215235
case 'skeleton':
216236
await patchSkeleton();
217237
break;
238+
case 'rollipop':
239+
await migrateProject(project);
240+
break;
218241
default:
219242
console.error(`Project ${project} is not supported`);
220243
process.exit(1);

ecosystem-ci/repo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
"repository": "https://github.com/voidzero-dev/vibe-dashboard.git",
99
"branch": "main",
1010
"hash": "30c68c9ad65c1315abf4c69366b21bc63b5d0fb4"
11+
},
12+
"rollipop": {
13+
"repository": "https://github.com/leegeunhyeok/rollipop.git",
14+
"branch": "main",
15+
"hash": "9beb8dd8fb70ef298b3a18703a831d6d4d3c01a1"
1116
}
1217
}

packages/core/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"types": "./dist/pluginutils/index.d.ts"
5050
},
5151
"./lib": {
52-
"default": "./dist/tsdown/index.mjs",
52+
"default": "./dist/tsdown/index.js",
5353
"types": "./dist/tsdown/index-types.d.ts"
5454
},
5555
"./types/*": {
@@ -82,6 +82,9 @@
8282
"dist"
8383
],
8484
"dependencies": {
85+
"@babel/generator": "^7.28.5",
86+
"@babel/parser": "^7.28.5",
87+
"@babel/types": "^7.28.5",
8588
"@oxc-project/runtime": "catalog:",
8689
"lightningcss": "^1.30.2",
8790
"postcss": "^8.5.6",

packages/global/src/migration/migrator.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ import {
2424
detectPackageMetadata,
2525
VITE_PLUS_NAME,
2626
VITE_PLUS_VERSION,
27+
VITE_PLUS_OVERRIDE_PACKAGES,
2728
} from '../utils/index.js';
2829
import { detectConfigs, type ConfigFiles } from './detector.js';
2930

30-
const OVERRIDE_PACKAGES = {
31-
vite: 'npm:@voidzero-dev/vite-plus-core@latest',
32-
vitest: 'npm:@voidzero-dev/vite-plus-test@latest',
33-
} as const;
3431
// packages that are replaced with vite-plus
3532
const REMOVE_PACKAGES = [
3633
'oxlint',
@@ -102,24 +99,24 @@ export function rewriteStandaloneProject(projectPath: string, workspaceInfo: Wor
10299
if (packageManager === PackageManager.yarn) {
103100
pkg.resolutions = {
104101
...pkg.resolutions,
105-
...OVERRIDE_PACKAGES,
102+
...VITE_PLUS_OVERRIDE_PACKAGES,
106103
};
107104
} else if (packageManager === PackageManager.npm) {
108105
pkg.overrides = {
109106
...pkg.overrides,
110-
...OVERRIDE_PACKAGES,
107+
...VITE_PLUS_OVERRIDE_PACKAGES,
111108
};
112109
} else if (packageManager === PackageManager.pnpm) {
113110
pkg.pnpm = {
114111
...pkg.pnpm,
115112
overrides: {
116113
...pkg.pnpm?.overrides,
117-
...OVERRIDE_PACKAGES,
114+
...VITE_PLUS_OVERRIDE_PACKAGES,
118115
},
119116
};
120117
// remove packages from `resolutions` field if they exist
121118
// https://pnpm.io/9.x/package_json#resolutions
122-
for (const key of [...Object.keys(OVERRIDE_PACKAGES), ...REMOVE_PACKAGES]) {
119+
for (const key of [...Object.keys(VITE_PLUS_OVERRIDE_PACKAGES), ...REMOVE_PACKAGES]) {
123120
if (pkg.resolutions?.[key]) {
124121
delete pkg.resolutions[key];
125122
}
@@ -220,7 +217,7 @@ function rewritePnpmWorkspaceYaml(projectPath: string): void {
220217
rewriteCatalog(doc);
221218

222219
// overrides
223-
for (const key of Object.keys(OVERRIDE_PACKAGES)) {
220+
for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
224221
doc.setIn(['overrides', scalarString(key)], scalarString('catalog:'));
225222
}
226223
// remove dependency selector from vite, e.g. "vite-plugin-svgr>vite": "npm:rolldown-vite@7.0.12"
@@ -240,7 +237,7 @@ function rewritePnpmWorkspaceYaml(projectPath: string): void {
240237
allowAny = new YAMLSeq<Scalar<string>>();
241238
}
242239
const existing = new Set(allowAny.items.map((n) => n.value));
243-
for (const key of Object.keys(OVERRIDE_PACKAGES)) {
240+
for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
244241
if (!existing.has(key)) {
245242
allowAny.add(scalarString(key));
246243
}
@@ -255,7 +252,7 @@ function rewritePnpmWorkspaceYaml(projectPath: string): void {
255252
if (!allowedVersions) {
256253
allowedVersions = new YAMLMap<Scalar<string>, Scalar<string>>();
257254
}
258-
for (const key of Object.keys(OVERRIDE_PACKAGES)) {
255+
for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
259256
// - vite: '*'
260257
allowedVersions.set(scalarString(key), scalarString('*'));
261258
}
@@ -325,7 +322,7 @@ function rewriteYarnrcYml(projectPath: string): void {
325322
* @param doc - The document to rewrite
326323
*/
327324
function rewriteCatalog(doc: YamlDocument): void {
328-
for (const [key, value] of Object.entries(OVERRIDE_PACKAGES)) {
325+
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
329326
doc.setIn(['catalog', key], scalarString(value));
330327
}
331328
doc.setIn(['catalog', VITE_PLUS_NAME], scalarString(VITE_PLUS_VERSION));
@@ -362,19 +359,19 @@ function rewriteRootWorkspacePackageJson(
362359
...pkg.resolutions,
363360
// FIXME: yarn don't support catalog on resolutions
364361
// https://github.com/yarnpkg/berry/issues/6979
365-
...OVERRIDE_PACKAGES,
362+
...VITE_PLUS_OVERRIDE_PACKAGES,
366363
};
367364
} else if (packageManager === PackageManager.npm) {
368365
pkg.overrides = {
369366
...pkg.overrides,
370-
...OVERRIDE_PACKAGES,
367+
...VITE_PLUS_OVERRIDE_PACKAGES,
371368
};
372369
} else if (packageManager === PackageManager.pnpm) {
373370
// pnpm use overrides field at pnpm-workspace.yaml
374371
// so we don't need to set overrides field at package.json
375372
// remove packages from `resolutions` field and `pnpm.overrides` field if they exist
376373
// https://pnpm.io/9.x/package_json#resolutions
377-
for (const key of [...Object.keys(OVERRIDE_PACKAGES), ...REMOVE_PACKAGES]) {
374+
for (const key of [...Object.keys(VITE_PLUS_OVERRIDE_PACKAGES), ...REMOVE_PACKAGES]) {
378375
if (pkg.pnpm?.overrides?.[key]) {
379376
delete pkg.pnpm.overrides[key];
380377
}
@@ -439,7 +436,7 @@ export function rewritePackageJson(
439436
}
440437
const supportCatalog = isMonorepo && packageManager !== PackageManager.npm;
441438
let needVitePlus = false;
442-
for (const [key, version] of Object.entries(OVERRIDE_PACKAGES)) {
439+
for (const [key, version] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
443440
const value = supportCatalog ? 'catalog:' : version;
444441
if (pkg.devDependencies?.[key]) {
445442
pkg.devDependencies[key] = value;
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
export const VITE_PLUS_NAME = '@voidzero-dev/vite-plus';
2-
export const VITE_PLUS_VERSION = 'latest';
2+
export const VITE_PLUS_VERSION = process.env.VITE_PLUS_VERSION || 'latest';
3+
4+
export const VITE_PLUS_OVERRIDE_PACKAGES: Record<string, string> = process.env
5+
.VITE_PLUS_OVERRIDE_PACKAGES
6+
? JSON.parse(process.env.VITE_PLUS_OVERRIDE_PACKAGES)
7+
: {
8+
vite: 'npm:@voidzero-dev/vite-plus-core@latest',
9+
vitest: 'npm:@voidzero-dev/vite-plus-test@latest',
10+
};

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)