# Upgrade from 0.1.0-rc.3 (https://effetch.pages.dev/docs/upgrading)

This page shows how to move a project written for 0.1.0-rc.3 or earlier to
the `Fetch` export, with the `effetch-migrate` command.

Before 0.1.0-rc.4, the main entry exported each API by name, and you
imported it with `import * as Fetch`. Since 0.1.0-rc.4, everything in the
main entry is under one export, `Fetch` (see
[Installation](https://effetch.pages.dev/docs/installation)).

## Before you begin

Upgrade the project's `@monarcode/effetch` dependency first. Then run the
commands on this page in the directory of the package that depends on
Effetch. The commands use `npx`; with pnpm, run `pnpm exec effetch-migrate`
instead.

## Preview the changes

To list the files the migration would change, without changing them, run
the following command:

```bash
npx -p @monarcode/effetch effetch-migrate --dry-run
```

## Run the migration

To change the files, run the following command:

```bash
npx -p @monarcode/effetch effetch-migrate
```

The migration makes these changes:

- `import * as Fetch from "@monarcode/effetch"` becomes
  `import { Fetch } from "@monarcode/effetch"`.
- Named imports, such as `import { HttpError, type Client }`, become
  `import { Fetch }`, and each use becomes `Fetch.HttpError` or
  `Fetch.Client`.
- `export … from "@monarcode/effetch"` re-exports from
  `@monarcode/effetch/Fetch`, and `import("@monarcode/effetch").Client`
  types become `import("@monarcode/effetch").Fetch.Client`.
- Code that already imports `Fetch` is left as it is.

## Choose the files it reads

The migration reads `.ts`, `.tsx`, `.js` and similar files, and uses the
project's own TypeScript. Which files it reads depends on where it runs:

- In a git repository, it reads the files git sees, so it skips what
  `.gitignore` does.
- Elsewhere, it skips `node_modules`, `dist`, `build`, `coverage` and hidden
  directories, and lists the build output it skipped.

To choose what it reads, pass paths, such as `effetch-migrate src test`.

## Change the rest by hand

The migration lists, with their lines, what it can't rewrite. Change these
by hand:

- a dynamic `import()`;
- a `vi.mock("@monarcode/effetch")`;
- an import inside a `declare module` block;
- JSDoc comments that use the old names.

The migration doesn't read Markdown.

## Finish the migration

After the migration, run your formatter and type checker.

## What's next

- [Installation](https://effetch.pages.dev/docs/installation): see the entry points Effetch has now
  and how to import from them.
- [Getting started](https://effetch.pages.dev/docs/getting-started): write a complete program with
  the `Fetch` export.