Skip to content

Commit 562365d

Browse files
authored
feat(migrate/create): add TypeScript shim for Vue and Astro component files (#1411)
resolves #1278
1 parent 6bfcbdb commit 562365d

File tree

21 files changed

+539
-1
lines changed

21 files changed

+539
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
> vp create astro --no-interactive -- my-astro-app --yes --skip-houston --template basics # create Astro app
2+
> cat my-astro-app/src/env.d.ts # check Astro shim
3+
/// <reference types="astro/client" />
4+
5+
> cd my-astro-app && vp install -- --no-frozen-lockfile # install dependencies
6+
> cd my-astro-app && vp check --fix # fix generated formatting and ensure no errors
7+
VITE+ - The Unified Toolchain for the Web
8+
9+
pass: Formatting completed for checked files (<variable>ms)
10+
pass: Found no warnings, lint errors, or type errors in 6 files (<variable>ms, <variable> threads)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
{
5+
"command": "vp create astro --no-interactive -- my-astro-app --yes --skip-houston --template basics # create Astro app",
6+
"ignoreOutput": true
7+
},
8+
"cat my-astro-app/src/env.d.ts # check Astro shim",
9+
{
10+
"command": "cd my-astro-app && vp install -- --no-frozen-lockfile # install dependencies",
11+
"ignoreOutput": true
12+
},
13+
"cd my-astro-app && vp check --fix # fix generated formatting and ensure no errors"
14+
]
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
> vp create vite:application --no-interactive -- --template vue-ts # create Vue+TS app
2+
> cat vite-plus-application/src/env.d.ts # check Vue shim was added
3+
declare module '*.vue' {
4+
import type { DefineComponent } from 'vue';
5+
const component: DefineComponent<{}, {}, unknown>;
6+
export default component;
7+
}
8+
9+
> cd vite-plus-application && vp install # install dependencies
10+
> cd vite-plus-application && vp check --fix # fix generated formatting and ensure no errors
11+
VITE+ - The Unified Toolchain for the Web
12+
13+
pass: Formatting completed for checked files (<variable>ms)
14+
pass: Found no warnings, lint errors, or type errors in 5 files (<variable>ms, <variable> threads)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
{
5+
"command": "vp create vite:application --no-interactive -- --template vue-ts # create Vue+TS app",
6+
"ignoreOutput": true
7+
},
8+
"cat vite-plus-application/src/env.d.ts # check Vue shim was added",
9+
{
10+
"command": "cd vite-plus-application && vp install # install dependencies",
11+
"ignoreOutput": true
12+
},
13+
"cd vite-plus-application && vp check --fix # fix generated formatting and ensure no errors"
14+
]
15+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "migration-framework-shim-astro-vue",
3+
"devDependencies": {
4+
"astro": "^4.0.0",
5+
"vite": "^7.0.0",
6+
"vue": "^3.0.0"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
> vp migrate --no-interactive --no-hooks # migration should add both Vue and Astro shims
2+
VITE+ - The Unified Toolchain for the Web
3+
4+
◇ Migrated . to Vite+<repeat>
5+
• Node <semver> pnpm <semver>
6+
✓ Dependencies installed in <variable>ms
7+
• 1 config update applied
8+
• TypeScript shim added for framework component files
9+
10+
> cat src/env.d.ts # check both shims were written
11+
declare module '*.vue' {
12+
import type { DefineComponent } from 'vue';
13+
const component: DefineComponent<{}, {}, unknown>;
14+
export default component;
15+
}
16+
17+
/// <reference types="astro/client" />

packages/cli/snap-tests-global/migration-framework-shim-astro-vue/src/.gitkeep

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"env": {
4+
"VITE_DISABLE_AUTO_INSTALL": "1",
5+
"CI": "",
6+
"VP_SKIP_INSTALL": ""
7+
},
8+
"commands": [
9+
"vp migrate --no-interactive --no-hooks # migration should add both Vue and Astro shims",
10+
"cat src/env.d.ts # check both shims were written"
11+
]
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "migration-framework-shim-astro",
3+
"devDependencies": {
4+
"astro": "^4.0.0",
5+
"vite": "^7.0.0"
6+
}
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
> vp migrate --no-interactive --no-hooks # migration should add Astro shim when astro dependency is detected
2+
VITE+ - The Unified Toolchain for the Web
3+
4+
◇ Migrated . to Vite+<repeat>
5+
• Node <semver> pnpm <semver>
6+
✓ Dependencies installed in <variable>ms
7+
• 1 config update applied
8+
• TypeScript shim added for framework component files
9+
10+
> cat src/env.d.ts # check Astro shim was written
11+
/// <reference types="astro/client" />

0 commit comments

Comments
 (0)