Skip to content

Commit 8f92021

Browse files
committed
test(snapshot): vp pack auto-select via tsdown default entry
Locks in the corrected pack-runnable rule: an app's vite.config.ts without a pack block does not count, so bare vp pack at the root auto-selects the library whose only signal is tsdown's default src/index.ts entry and packs it with no pack config at all.
1 parent 7c6fa30 commit 8f92021

9 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<h1>web</h1>
5+
</body>
6+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "name": "web", "private": true }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "name": "pack-default-entry", "private": true, "workspaces": ["apps/*", "packages/*"] }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "name": "lib", "private": true, "type": "module" }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function lib(name: string): string {
2+
return `lib ${name}`;
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[[case]]
2+
name = "pack_default_entry"
3+
vp = ["local", "global"]
4+
comment = """
5+
Bare vp pack at the root auto-selects the only pack-runnable package: the
6+
library whose sole signal is tsdown's default src/index.ts entry. The app's
7+
vite.config.ts has no pack block, so it does not count as pack-runnable
8+
(rfcs/cwd-flag.md, "The likely-runnable heuristic"); tsdown then packs via
9+
its default entry with no pack config at all.
10+
"""
11+
steps = [
12+
["vp", "pack"],
13+
{ argv = ["vpt", "list-dir", "packages/lib/dist"], comment = "output lands in the auto-selected library" },
14+
]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# pack_default_entry
2+
3+
Bare vp pack at the root auto-selects the only pack-runnable package: the
4+
library whose sole signal is tsdown's default src/index.ts entry. The app's
5+
vite.config.ts has no pack block, so it does not count as pack-runnable
6+
(rfcs/cwd-flag.md, "The likely-runnable heuristic"); tsdown then packs via
7+
its default entry with no pack config at all.
8+
9+
## `vp pack`
10+
11+
```
12+
VITE+ - The Unified Toolchain for the Web
13+
14+
Selected package: lib (packages/lib)
15+
Tip: run this directly with `vp -C packages/lib pack`
16+
ℹ entry: src/index.ts
17+
ℹ Build start
18+
ℹ dist/index.mjs 0.10 kB │ gzip: 0.11 kB
19+
ℹ 1 files, total: 0.10 kB
20+
✔ Build complete in <duration>
21+
```
22+
23+
## `vpt list-dir packages/lib/dist`
24+
25+
output lands in the auto-selected library
26+
27+
```
28+
index.mjs
29+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# pack_default_entry
2+
3+
Bare vp pack at the root auto-selects the only pack-runnable package: the
4+
library whose sole signal is tsdown's default src/index.ts entry. The app's
5+
vite.config.ts has no pack block, so it does not count as pack-runnable
6+
(rfcs/cwd-flag.md, "The likely-runnable heuristic"); tsdown then packs via
7+
its default entry with no pack config at all.
8+
9+
## `vp pack`
10+
11+
```
12+
Selected package: lib (packages/lib)
13+
Tip: run this directly with `vp -C packages/lib pack`
14+
ℹ entry: src/index.ts
15+
ℹ Build start
16+
ℹ dist/index.mjs 0.10 kB │ gzip: 0.11 kB
17+
ℹ 1 files, total: 0.10 kB
18+
✔ Build complete in <duration>
19+
```
20+
21+
## `vpt list-dir packages/lib/dist`
22+
23+
output lands in the auto-selected library
24+
25+
```
26+
index.mjs
27+
```

0 commit comments

Comments
 (0)