Skip to content

Commit fec6e9e

Browse files
authored
docs: add migration guide for 0.7 (#121)
1 parent ced1916 commit fec6e9e

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export function devframeNav(prefix = ''): DefaultTheme.NavItem[] {
132132
{ text: 'Contributing', link: `${repo}/blob/main/CONTRIBUTING.md` },
133133
{
134134
items: [
135+
{ text: 'Migrating to 0.7', link: `${prefix}/guide/migration-0.7` },
135136
{ text: 'Migrating to 0.6', link: `${prefix}/guide/migration-0.6` },
136137
],
137138
},

docs/guide/migration-0.7.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Migrating to 0.7
6+
7+
0.7's one breaking change moves the `cac` CLI framework out of `devframe`'s bundled dependencies and renames the adapter that wraps it. This page covers the change between 0.6.x and 0.7.
8+
9+
## `cac` is now an optional peer dependency
10+
11+
`devframe` no longer depends on [`cac`](https://github.com/cacjs/cac) directly — it moved to an optional `peerDependency`. Any project that calls into the CLI adapter (formerly `createCli`, now `createCac`) needs to install `cac` itself:
12+
13+
```sh
14+
npm install devframe cac
15+
```
16+
17+
Tools that don't use the CLI adapter — a Vite-hosted plugin, an embedded devframe, anything built from the [lower-level factories](./standalone-cli#use-your-own-cli-framework) — are unaffected and never need `cac` installed.
18+
19+
## `devframe/adapters/cli``devframe/adapters/cac`
20+
21+
The adapter itself is renamed, and its factory with it:
22+
23+
| 0.6.x | 0.7 |
24+
|-------|-----|
25+
| `import { createCli } from 'devframe/adapters/cli'` | `import { createCac } from 'devframe/adapters/cac'` |
26+
| `CreateCliOptions` | `CreateCacOptions` |
27+
| `CliHandle` | `CacHandle` |
28+
29+
```ts
30+
// 0.6.x
31+
import { createCli } from 'devframe/adapters/cli'
32+
33+
await createCli(devframe).parse()
34+
```
35+
36+
```ts
37+
// 0.7
38+
import { createCac } from 'devframe/adapters/cac'
39+
40+
await createCac(devframe).parse()
41+
```
42+
43+
`devframe/adapters/cli` still exports `createCli` as a deprecated alias of `createCac` (same for `CreateCliOptions` and `CliHandle`), so existing imports keep compiling — but the underlying `cac` peer dependency still needs installing per above, and the alias will be removed in a future major release. Move call sites over now rather than waiting for that removal.
44+
45+
See [CLI (cac)](/adapters/cac) for the full adapter reference.

0 commit comments

Comments
 (0)