openapi-typesafe-migrate 1.0.0-rc.3 → 1.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,127 @@
1
+ # openapi-typesafe-migrate
2
+
3
+ ## 1.0.0-rc.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - A module specifier with a bundler query (`"openapi-fetch?url"`, `"openapi-fetch/x.js?raw"`) gets the
8
+ new package name and keeps its query. Before, a query right after the package name hid the package,
9
+ and the specifier was left as it was.
10
+
11
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - A `catalog:` dependency whose catalog entry is not in the project (`--root packages/api` of a pnpm
12
+ workspace) keeps its name and is reported as a manual step: the entry above the root cannot be
13
+ renamed, and renaming only the dependency failed the install with
14
+ `ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`. At a workspace root, where no catalog is above, such a
15
+ dependency is reported as one whose entry is missing. `catalog: ` with a space is the default
16
+ catalog, as pnpm reads it.
17
+
18
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The generator is renamed after more programs that run it: `nice`, `timeout`, `xargs`, `command`,
19
+ `exec -a`, `dotenvx run --`, `doppler run --`, `nx exec --`, `yarn workspace <name>`, a bare `bun`,
20
+ `corepack`, and `tsx` or `ts-node` before the path of its binary; `yarn global add` renames its
21
+ packages. Any other word of a command that names an old package or a path to its binary (a
22
+ script name after `npm run`, an argument of an unknown program, `$(npm bin)/openapi-typescript`)
23
+ is reported as a manual step. Such commands were left without a word, and
24
+ `dotenvx run -- npx openapi-typescript` kept downloading the old generator.
25
+
26
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The body of a here-document (`<<NOTE`, `<<'NOTE'`, `<<-NOTE`) is read as data in scripts, `run: |`
27
+ blocks and Dockerfiles: an apostrophe in it (`Don't edit`) opened a quote to the end of the file,
28
+ and no command after it was migrated. A here-document that a shell runs (`bash <<EOF`,
29
+ Dockerfile `RUN <<EOF` and `RUN <<EOT bash`, `cat <<EOF | sh`) is read as the script it is, so its
30
+ commands are migrated. A shift in an arithmetic expansion (`$((1 << 2))`) is not a here-document.
31
+
32
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - When `transform` is rewritten to type text with `irCallbacks: true`, the options declared with
33
+ `OpenAPITSOptions` (`const options: OpenAPITSOptions`, `satisfies` or `as OpenAPITSOptions`, a
34
+ `transform` const typed `OpenAPITSOptions["transform"]`) name `OpenAPITSIrOptions` instead, with its
35
+ import; the rewritten file did not compile. Options typed with a type built from `OpenAPITSOptions`
36
+ (`Partial<OpenAPITSOptions>`) keep their `transform`, reported as a manual step. The type is found
37
+ in the other forms it is written in too: `import("openapi-typescript").OpenAPITSOptions`, a local
38
+ alias or an interface that extends it, and the JSDoc `@type` and `@satisfies` of a JavaScript file.
39
+ Options that take keys from another object (`{ ...base, transform }`) keep their `transform`,
40
+ reported as a manual step: the tool cannot see the callbacks and type of `base`. A `transform`
41
+ written as a shorthand property (`{ transform }`) is rewritten too.
42
+
43
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The Jest patterns that name an old package (`moduleNameMapper: { "^openapi-fetch$": … }`,
44
+ `transformIgnorePatterns`) are reported as manual steps, in `jest.config.*` files and in the `jest`
45
+ field of `package.json`. A pattern is not a module specifier, so the tool does not change it. A
46
+ value of a JSON config that is just a package name (`"^@api$": "openapi-fetch"`) is reported too;
47
+ a string of a config script that names a package (`"openapi-fetch/$1"`) is reported once.
48
+
49
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The `import` and `export` blocks of `.mdx` files are migrated like those of a source file. Prose and
50
+ code fences of the page stay as written.
51
+
52
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - More files that run the generator are migrated:
53
+ - Task's `Taskfile.yml` (`cmds`, `cmd`, `sh`, `status`, `defer`, `preconditions`);
54
+ - pre-commit's `.pre-commit-config.yaml`: the `entry` and `args` of a hook as one command, and the
55
+ old packages in `additional_dependencies`;
56
+ - the `simple-git-hooks`, `lint-staged` and `nx.targets` commands of `package.json` and
57
+ `package.yaml`;
58
+ - `.lintstagedrc` (JSON or YAML), `.lintstagedrc.json`, `.lintstagedrc.yaml`, `.simple-git-hooks.json`;
59
+ - the `targetDefaults` commands of `nx.json`, and the commands of Nx `configurations`.
60
+
61
+ A YAML command written with escapes (`"openapi-typescript \"$SPEC\""`) is migrated by its value,
62
+ and the whole string is written again with its escapes.
63
+
64
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The import map file that a Deno config names (`"importMap": "./deps.json"`) is migrated like
65
+ `import_map.json`, and its imports count as declared for the files under that config. An import map
66
+ named by a URL or by a path outside the project is reported as a manual step.
67
+
68
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - An import of a path into the installed files of an old package
69
+ (`"../node_modules/openapi-fetch/dist/index.js"`) is reported as a manual step: the old package is no
70
+ longer installed after the migration, so the path stops resolving.
71
+
72
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - A patch file of an old package (patch-package `patches/openapi-fetch+0.13.0.patch`, pnpm
73
+ `openapi-fetch@0.13.0.patch`, Yarn `openapi-fetch-npm-0.13.0-<hash>.patch`) is reported as a manual
74
+ step: the new package has other code, so the patch cannot be carried over.
75
+
76
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - Every package manager setting that names an old package is reported as a manual step, not only
77
+ `overrides` and `patchedDependencies`: `packageExtensions`, `allowedDeprecatedVersions`,
78
+ `onlyBuiltDependencies` and the rest, in `pnpm-workspace.yaml`, in the `pnpm` field of
79
+ `package.json` and in `.yarnrc.yml`. Values count too (`"x": "npm:openapi-fetch@0.13.0"` in
80
+ `overrides`). A setting under the `pnpm` field is reported by its own key (`pnpm.overrides`).
81
+
82
+ - [#66](https://github.com/openapi-typesafe/openapi-typesafe/pull/66) [`15344bf`](https://github.com/openapi-typesafe/openapi-typesafe/commit/15344bfb803ff9872a6d3f79b8279fbbbbfd14ea) Thanks [@fedorello](https://github.com/fedorello)! - The report shows control characters of file names and project text as escapes (`\n`, `\u001b`),
83
+ so a file name cannot forge CI commands or erase the lines before it.
84
+
85
+ - [#69](https://github.com/openapi-typesafe/openapi-typesafe/pull/69) [`1296bd7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/1296bd79e83c39598a471b9bfabf34ffcd71a83e) Thanks [@fedorello](https://github.com/fedorello)! - The targets of Node subpath imports in `package.json` (`"imports": { "#client": "openapi-fetch" }`,
86
+ also under conditions and fallback lists) get the new package names, so they still resolve once the
87
+ dependencies are renamed. So do the keys and values of the `browser` field
88
+ (`"browser": { "openapi-fetch": false }`). A target or `browser` key that reaches into a file of
89
+ the package is reported as a manual step.
90
+
91
+ - [#77](https://github.com/openapi-typesafe/openapi-typesafe/pull/77) [`decc2e2`](https://github.com/openapi-typesafe/openapi-typesafe/commit/decc2e2ae056f8a9b191d7f838056487760df530) Thanks [@fedorello](https://github.com/fedorello)! - `tsconfig.json`, `tsconfig.*.json` and `jsconfig.json` are migrated: the `compilerOptions.paths`
92
+ keys of an old package (`"openapi-fetch"`, `"openapi-fetch/*"`) and its name in
93
+ `compilerOptions.types` get the new names, so the paths still match the renamed imports. A path into
94
+ `node_modules` of an old package is reported as a manual step.
95
+
96
+ ## 1.0.0-rc.4
97
+
98
+ No changes in this release.
99
+
100
+ ## 1.0.0-rc.3
101
+
102
+ No changes in this release.
103
+
104
+ ## 1.0.0-rc.2
105
+
106
+ No changes in this release.
107
+
108
+ ## 1.0.0-rc.1
109
+
110
+ No changes in this release.
111
+
112
+ ## 1.0.0-rc.0
113
+
114
+ ### Minor Changes
115
+
116
+ - [`730de95`](https://github.com/openapi-typesafe/openapi-typesafe/commit/730de95d814cf9b1ec70d2b8fac6b84b17106a29) Thanks [@fedorello](https://github.com/fedorello)! - New package `openapi-typesafe-migrate`: run `npx openapi-typesafe-migrate` in a project to move it from openapi-typescript, openapi-fetch, openapi-react-query and openapi-typescript-helpers. It renames the packages in `package.json` files and pnpm catalogs, module specifiers in sources, and the generator command and its renamed flags in scripts, CI files and Makefiles. A legacy `transform` callback that returns plain `ts.factory` types is rewritten to return type text with `irCallbacks: true`. Everything it cannot change safely is listed as a manual step. It only reports until you add `--write`, and logs every finding to a JSON Lines file.
117
+
118
+ ### Patch Changes
119
+
120
+ - [`e57d12b`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e57d12b11b023258100cbabc5cac1d276ba5ae1f) Thanks [@fedorello](https://github.com/fedorello)! - `--help` lists the exit codes: `0` done, `1` the migration failed, `2` unknown option or argument.
121
+
122
+ - [`f0a93e4`](https://github.com/openapi-typesafe/openapi-typesafe/commit/f0a93e4094b3c69dfa8aeb229339f7d622f5cb06) Thanks [@fedorello](https://github.com/fedorello)! - The report now names only the package an override key targets: `openapi-typescript-helpers` no
123
+ longer also reports `openapi-typescript`, and `app>openapi-fetch`, `**/openapi-fetch` and
124
+ `openapi-fetch@0.13` keys are read as `openapi-fetch`. `overrides:` and `patchedDependencies:` in
125
+ `pnpm-workspace.yaml` that name an old package are reported like those of `package.json`; before,
126
+ they were neither rewritten nor reported. The output folders `.next`, `.nuxt`, `.output`,
127
+ `.svelte-kit`, `.turbo` and `coverage` are skipped like `dist`.
package/README.md CHANGED
@@ -18,16 +18,61 @@ Run it with `npx` (or `pnpm dlx`, `yarn dlx`, `bunx`), not as a dependency: it u
18
18
 
19
19
  ## What it changes
20
20
 
21
- | Where | Change |
22
- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
- | Every `package.json` | `dependencies`, `devDependencies`, `peerDependencies` and `optionalDependencies` get the new names, with the version of this tool; `^`, `~` and exact ranges keep their style. `catalog:` and `workspace:` stay. |
24
- | `pnpm-workspace.yaml` | Entries of `catalog:` and `catalogs:`. Comments, formatting and line endings stay. |
25
- | `package.json` scripts, shell scripts, YAML (CI), `Makefile`, `justfile`, `Dockerfile` | The `openapi-typescript` command, and the flags it renamed: `--immutable-types` / `-it` → `--immutable`, `--support-array-length` → `--array-length`, `--redoc` → `--redocly`, `-ap` → `--additional-properties`. |
26
- | Sources (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.vue`, `.svelte`, `.astro`, …) | Module specifiers only: `import` / `export … from`, `import()`, `require()`, `require.resolve()`, `import("…")` types and `@import` tags in JSDoc (every block), `declare module`, `/// <reference types>`, and module mocks: `vi.mock()` and the other `vi` / `jest` module methods (`jest.setMock()`, `jest.requireActual()`, …), bun's `mock.module()`. Components: their `<script>` blocks and Astro's frontmatter. |
27
- | `openapiTS(source, { transform })` calls | When `transform` is the only callback and returns plain `ts.factory` types (or the helper constants), the returns become type text and `irCallbacks: true` is added. |
28
-
29
- `Makefile`, `justfile` and `Dockerfile` are read only under exactly these names, so
30
- `Dockerfile.dev` is not changed.
21
+ | Where | Change |
22
+ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | Every `package.json` and pnpm's `package.yaml` | `dependencies`, `devDependencies`, `peerDependencies` and `optionalDependencies` get the new names, with the version of this tool, in the style of the old range (see below). `catalog:` and `workspace:` stay. An `npm:` alias of an original package (`"my-fetch": "npm:openapi-fetch@^0.13"`) points at the new package. The keys of `peerDependenciesMeta` and `dependenciesMeta` and the names in `bundleDependencies` get the new names too, and so do bun's `catalog` and `catalogs`. The targets of subpath `imports` (`"#client": "openapi-fetch"`, under any conditions) get the new names; the `#` keys stay. So do the keys and values of the `browser` field (`"openapi-fetch": false`). |
24
+ | `pnpm-workspace.yaml`, `.yarnrc.yml` | Entries of `catalog:` and `catalogs:` (pnpm, Yarn 4.10 and newer), ranges with spaces included. |
25
+ | `deno.json`, `deno.jsonc`, `import_map.json` | Keys of `imports` and `scopes` that name an original package (`openapi-fetch`, `openapi-fetch/`), and their `npm:` values, also in the file a config names as its `importMap` (`"importMap": "./deps.json"`). |
26
+ | `tsconfig.json`, `tsconfig.*.json`, `jsconfig.json` | The `compilerOptions.paths` keys of an original package (`"openapi-fetch/*"`) and its name in `compilerOptions.types`. |
27
+ | Commands (the files are listed below the table) | The `openapi-typescript` command (also as `npx`, `pnpm exec`, `node_modules/.bin/…` or `npm:openapi-typescript`), and the flags it renamed, in that command only: `--immutable-types` / `-it` → `--immutable`, `--support-array-length` → `--array-length`, `--redoc` → `--redocly`, `-ap` → `--additional-properties`. The old package names in install commands (`npm i`, `pnpm add`, `npx -p`, …). |
28
+ | `.github/dependabot.yml` | Every old package name in `dependency-name` and `patterns`. |
29
+ | Sources (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.vue`, `.svelte`, `.astro`, `.mdx`, …) | Module specifiers only: `import` / `export … from`, `import()`, `require()`, `require.resolve()`, `import("…")` types and `@import` tags in JSDoc (every block), `declare module`, `/// <reference types>`, and module mocks: `vi.mock()` and the other `vi` / `jest` module methods (`jest.setMock()`, `jest.requireActual()`, …), bun's `mock.module()`. Components: their `<script>` blocks and Astro's frontmatter; MDX: its `import` / `export` blocks. A bundler query stays (`openapi-fetch?url`). |
30
+ | `openapiTS(source, { transform })` calls | When `transform` is the only callback and returns plain `ts.factory` types (or the helper constants), the returns become type text and `irCallbacks: true` is added. The options may also be a `const` of the same file that only this call uses. Module constants and imports that only the old returns used are removed. Names are resolved by scope, so a local constant is never taken for a module one. Options declared as `OpenAPITSOptions` are declared as `OpenAPITSIrOptions` then. |
31
+
32
+ Commands are read in `package.json` scripts, shell scripts (`.sh`, `.bash`, `.zsh`), husky hooks,
33
+ `Makefile`, `justfile`, `Dockerfile`, CI and other YAML files, Nx `project.json` targets and
34
+ `nx.json` target defaults (also their `configurations`), `deno.json` tasks, pnpm `package.yaml`
35
+ scripts, Task's `Taskfile.yml` (`cmds`, `cmd`, `sh`, `status`, `defer`, `preconditions`),
36
+ pre-commit hooks (`entry` with its `args`), and the `simple-git-hooks`, `lint-staged` and
37
+ `nx.targets` commands of a manifest, also in `.lintstagedrc*` and `.simple-git-hooks.json`. The
38
+ generator is found behind the usual wrappers too (`npx`, `pnpm exec`, `yarn workspace <name>`,
39
+ `dotenvx run`, `nx exec`, `tsx`, `timeout`, `xargs`, …). A here-document is data, except the one a
40
+ shell runs (`bash <<EOF`, `cat <<EOF | sh`). They are read word by word, the way the shell splits
41
+ them (quotes, `\` line continuations, comments, `&&`, `|`,
42
+ `sh -c "…"`, and the commands inside `if`, `while`, `for` and `{ … }`), so only the generator's
43
+ own flags are renamed, and a script name (`npm run openapi-typescript`) is never changed. A
44
+ Dockerfile's exec form (`RUN ["npx",
45
+ "openapi-typescript", …]`, also after `RUN --mount=…`) is read word by word, and the command line of
46
+ `["sh", "-c", "…"]` as shell text. A Makefile variable that holds the generator (`OAT :=
47
+ openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed where it is set,
48
+ and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
49
+ of a workflow and the flags after `$GEN` or `${{ env.GEN }}`, and a Dockerfile `ARG` or `ENV`
50
+ variable and the flags after `$GEN`. The flags change only when every definition of the variable
51
+ in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
52
+ later Makefile line sets to another program is reported with its old flags. A variable of old
53
+ flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`) may serve other commands too, so it
54
+ is reported, not changed. YAML files are changed only in command
55
+ keys (`run`, `script`, `command`, `entrypoint`, …) and in the values of `env`, in block and flow
56
+ style, never in other values such as an OpenAPI `description`; a YAML file that names no old package
57
+ is not even parsed. A config that cannot be parsed and names an old package is reported with the
58
+ line and column, not changed. `Makefile`, `justfile` and `Dockerfile` are read only under the names
59
+ make, just and docker look for (also `makefile`, `GNUmakefile`, `Justfile`, `.justfile`,
60
+ `Containerfile` and `*.mk`), so `Dockerfile.dev` is not changed.
61
+
62
+ A range keeps its style: `^` and `>=` give `^1.0.0`, `~` gives `~1.0.0`, an exact version stays
63
+ exact, and a partial version keeps what it fixes (`7`, `7.x` and `0.x` give `^1.0.0`; `0.13` and
64
+ `0.13.x` give `~1.0.0`). A range of several comparators (`>=0.13 <0.18`, `^0.13 || ^0.17`) takes
65
+ the style of its first one. Anything else (`*`, `latest`, an upper bound only, a URL or a file) is
66
+ kept and reported.
67
+
68
+ Manifests, catalogs and import maps are edited in place: only the renamed keys and the new values
69
+ change, and comments, formatting, key order and line endings stay. A byte order mark is kept. An
70
+ entry whose new name is already in the same map is left and reported, and so is an entry the tool
71
+ does not edit (a YAML alias, anchor or block value). A catalog entry and the `catalog:` dependencies
72
+ on it keep one name: an entry stays while a dependency that was left or an override
73
+ (`"openapi-fetch": "catalog:"` under `overrides`, which are reported, not changed) still uses it,
74
+ and a dependency stays while its entry does, so the install never misses a catalog entry; both are
75
+ reported. Sources also get `npm:` specifiers renamed (`import x from "npm:openapi-fetch@^0.13"`).
31
76
 
32
77
  In a git repository the tool reads the files git lists: tracked files, and untracked files that
33
78
  `.gitignore` does not ignore, so ignored build output (`cjs/`, `esm/`, `types/`, …) stays out. A
@@ -38,12 +83,25 @@ repository around it ignores, it reads the whole tree of that folder. Either way
38
83
  `coverage` are skipped, and links are not followed. The log names the folders and how each one
39
84
  was read.
40
85
 
41
- The tool does not trust the folder it migrates. Git runs with `core.fsmonitor` turned off, so a
42
- nested repository's `.git/config` cannot make it run a command, and it does not open a bare
43
- repository that is not named explicitly. A path that git lists but that leads outside the folder
44
- (`../`, an absolute path, or a linked parent folder) is not read or written; the report lists it
45
- under "Skipped". A file is written as a new file that replaces the old one (same mode), so a hard
46
- link to a file elsewhere keeps its old text; the log notes it.
86
+ The tool does not trust the folder it migrates. Git is the `git` of an absolute folder on `PATH`
87
+ outside the project and outside every `node_modules` (as written and after links, in any case,
88
+ since macOS and Windows ignore case in folder names), so neither a `git` at the project root nor
89
+ one in a `node_modules/.bin` that `npx` puts on `PATH` runs (npx adds those of the project and of
90
+ every folder above it, such as a workspace root), and it runs with `core.fsmonitor` turned off and every transport refused
91
+ (`GIT_ALLOW_PROTOCOL` set to an empty list, which no `protocol.*` key of a repository's config can
92
+ undo), so a nested repository's `.git/config` cannot make it run a command, not even through a
93
+ partial clone that fetches a missing object. It does not open a bare repository that is not named
94
+ explicitly, and the folder whose `.git` git takes as the repository is the work tree, so a
95
+ `core.worktree` in the config cannot point the listing at another folder; `GIT_DIR` and the other
96
+ variables that name a repository are not passed on. A path that git lists but that leads outside the
97
+ folder (`../`, an absolute path, a linked parent folder or a link to a file elsewhere) is not read
98
+ or written; the report lists it under "Skipped". A file is written as a new file that replaces the
99
+ old one (same mode), so a hard link to a file elsewhere keeps its old text; the log notes it.
100
+ A file whose bytes are not UTF-8 (a Latin-1 source, for example) is not changed, because its
101
+ text cannot be written back without changing other characters; neither is a file that cannot be
102
+ read. The report lists both under "Skipped". Every file is read and migrated before the first one
103
+ is written. If a write fails, the writing stops, the command exits with `1`, and the report names
104
+ the files written before it and the ones that were not.
47
105
  The report and the log show a spec with credentials (`git+https://<token>@…`) as
48
106
  `git+https://***@…`; the file keeps it as written.
49
107
 
@@ -52,11 +110,41 @@ The report and the log show a spec with credentials (`git+https://<token>@…`)
52
110
  The report lists each of these with the file and line:
53
111
 
54
112
  - a version spec it cannot replace (`latest`, a URL, a file, an npm alias), and `overrides` /
55
- `resolutions` / `pnpm` settings (in `package.json` or `pnpm-workspace.yaml`, patches included)
56
- that name an old package;
113
+ `resolutions` and every other package manager setting (`packageExtensions`,
114
+ `allowedDeprecatedVersions`, …, in `package.json`, `pnpm-workspace.yaml` or `.yarnrc.yml`,
115
+ patches included) that names an old package;
116
+ - a `catalog:` dependency whose catalog entry is outside the folder it migrates (`--root` of one
117
+ package of a workspace), or missing from the workspace: it keeps its old name, because the
118
+ entry is not edited;
119
+ - a patch file of an old package (`patches/openapi-fetch+0.13.0.patch`): the new package has other
120
+ code, so check whether the fix is still needed;
121
+ - a word in a command that names an old package where the tool cannot tell what runs it (an
122
+ argument of a program it does not know, a script name): migrate it by hand;
123
+ - an import map that a Deno config names by a URL or a path outside the folder;
57
124
  - a renamed peer dependency: users of your package must switch too;
58
- - `npx openapi-typescript@<version>`: the old package is pinned, change it by hand;
59
- - deep imports such as `openapi-fetch/dist/...`: check that the file exists in the new package;
125
+ - a pnpm `package.json5` that names an old package: the tool does not read JSON5, so rename the
126
+ packages and the command there by hand, or write it as `package.json` and run the tool again;
127
+ - `npx openapi-typescript@<version>`, and pinned old packages in install commands
128
+ (`npm i openapi-fetch@0.13`): change them by hand;
129
+ - a command that runs a file inside the old package
130
+ (`node node_modules/openapi-typescript/bin/cli.js`): run `openapi-typesafe` instead;
131
+ - strings in sources that run `openapi-typescript` (`execSync("npx openapi-typescript …")`, also
132
+ a template such as `` `npx openapi-typescript ${spec}` ``),
133
+ with the command they should become;
134
+ - deep imports such as `openapi-fetch/dist/...` (also subpath import targets and `browser` keys):
135
+ check that the file exists in the new package;
136
+ - imports from the `node_modules` folder of an old package (`../node_modules/openapi-fetch/x.js`),
137
+ and such paths in a tsconfig: import from the new package instead, or point the path at its
138
+ files;
139
+ - Jest patterns that name an old package (`moduleNameMapper`, `transformIgnorePatterns`): make
140
+ them match the new name where they mean the package;
141
+ - a module name built at run time right after an old package name
142
+ (``import(`openapi-fetch${suffix}`)``): the rest may go on with the name, so only you know what
143
+ to write;
144
+ - imports of `openapi-typesafe-helpers` that no `package.json` or Deno import map at or above the
145
+ file lists, also imports that an earlier run renamed: openapi-fetch and openapi-react-query
146
+ installed `openapi-typescript-helpers` with them, the openapi-typesafe packages do not. Add it to the dependencies, or import the types from
147
+ `openapi-typesafe-fetch/helpers`;
60
148
  - strings that equal an old package name outside a module specifier (an object key, a label, a
61
149
  bundler option such as `external: ["openapi-fetch"]`): they are kept, because only you know
62
150
  whether they mean the package. Comments are not changed or reported;
@@ -64,8 +152,10 @@ The report lists each of these with the file and line:
64
152
  dependency), so alias `openapi-fetch` to `openapi-typesafe-fetch` with `overrides` or
65
153
  `resolutions` (see
66
154
  [Libraries built on openapi-fetch](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md#libraries-built-on-openapi-fetch));
67
- - `transform` callbacks it cannot rewrite, and `postTransform` / `transformProperty`: they keep
68
- working with a deprecation warning; see
155
+ - `transform` callbacks it cannot rewrite (also when their options use a type built from
156
+ `OpenAPITSOptions`, such as `Partial<OpenAPITSOptions>`), and `postTransform` /
157
+ `transformProperty`, also in options that other code shares, and `openapiTS()` calls whose options it cannot see (a
158
+ parameter, a function call): they keep working with a deprecation warning; see
69
159
  [IR callbacks](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks).
70
160
 
71
161
  Then install, regenerate your types and commit them once (the file header names openapi-typesafe
@@ -84,8 +174,9 @@ now, so `--check` fails until you do), and run your type check and tests.
84
174
  The default log folder is new for each run and only you can open it (mode 0700). A `--log` file
85
175
  that exists gets the new lines appended, and missing parent folders are created.
86
176
 
87
- Exit codes: `0` done, `1` the migration failed (the message and the log say why) or the log could
88
- not be created (nothing is changed then), `2` unknown option or argument.
177
+ Exit codes: `0` done, `1` the migration failed (the message and the log say why), a file could not
178
+ be written (the report names what was written), the project folder does not exist or is a file,
179
+ or the log could not be created (nothing is changed then), `2` unknown option or argument.
89
180
 
90
181
  ## Versioning
91
182