openapi-typesafe-migrate 1.0.0-rc.4 → 1.0.0-rc.6
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 +141 -0
- package/README.md +62 -26
- package/dist/cli/main.mjs +2762 -1460
- package/dist/cli/main.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,146 @@
|
|
|
1
1
|
# openapi-typesafe-migrate
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - An OpenAPI, Swagger or AsyncAPI document in YAML is no longer changed: an example value under a
|
|
8
|
+
`command` or `script` key that mentions the generator stays as written.
|
|
9
|
+
|
|
10
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - `openapi-typesafe-migrate | head` (or any reader that closes the pipe early) no longer crashes with
|
|
11
|
+
an `EPIPE` stack trace and exit code 1: the rest of the report is dropped and the run ends as it
|
|
12
|
+
would have.
|
|
13
|
+
|
|
14
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A constant or an import that an `export { … }` list names is no longer removed with the old
|
|
15
|
+
`transform` returns, so the file still compiles.
|
|
16
|
+
|
|
17
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - An exported function that `transform` names is no longer rewritten: other modules may call it
|
|
18
|
+
and expect TypeScript nodes. It is kept and reported as a manual step, like options that other
|
|
19
|
+
code uses.
|
|
20
|
+
|
|
21
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A justfile variable that holds the generator (`gen := "npx openapi-typescript"`) now has its old
|
|
22
|
+
flags renamed where it runs: `{{gen}} api.yaml -it` kept `-it`. A variable of old flags that the
|
|
23
|
+
generator gets (`{{flags}}`) is reported.
|
|
24
|
+
|
|
25
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A dependency under an old name on a local package (`workspace:*`, `link:`, `file:`, `portal:`),
|
|
26
|
+
such as a fork named `openapi-fetch` in the workspace, is no longer renamed: the new name pointed
|
|
27
|
+
at a package the workspace does not have, and the install failed. The dependency and the imports
|
|
28
|
+
of it keep their name, and the report lists it as a manual step.
|
|
29
|
+
|
|
30
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A CI step whose `shell` is another program (`shell: python` in GitHub Actions, or a CircleCI
|
|
31
|
+
`shell` next to `command`) runs code of that language, not commands. Its script is now left as it
|
|
32
|
+
is and reported when it names an old package; it was skipped without a word.
|
|
33
|
+
|
|
34
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A shell variable that holds the generator is migrated now. A script, a CI `run` block or a
|
|
35
|
+
`package.json` script that sets `GEN="npx openapi-typescript"` (also after `export`, `local` or
|
|
36
|
+
`readonly`) and then runs `$GEN api.yaml -it` was left as it was, and nothing was reported, so
|
|
37
|
+
the build went on downloading the old generator. The value is renamed where it is set and the
|
|
38
|
+
flags after `$GEN` where it runs, and a variable of old flags that the generator gets is reported.
|
|
39
|
+
|
|
40
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - Once `openapi-fetch` is aliased to `openapi-typesafe-fetch` in the overrides (as the docs ask for
|
|
41
|
+
swr-openapi), the report no longer says to update that override or to add the alias again, so a
|
|
42
|
+
second run is clean. The alias counts in the `package.json` itself and in a workspace above it.
|
|
43
|
+
|
|
44
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - A path in the `typesVersions` of `package.json` into the installed files of an old package
|
|
45
|
+
(`node_modules/openapi-fetch/dist/index.d.ts`) is reported, as such paths in a tsconfig are: the
|
|
46
|
+
new package has its own files there.
|
|
47
|
+
|
|
48
|
+
- [#93](https://github.com/openapi-typesafe/openapi-typesafe/pull/93) [`25f631d`](https://github.com/openapi-typesafe/openapi-typesafe/commit/25f631d8dabed24e18a859b08e8395496e145118) Thanks [@fedorello](https://github.com/fedorello)! - The `command` of a wireit script in `package.json` is migrated like the other scripts. It was
|
|
49
|
+
neither changed nor reported.
|
|
50
|
+
|
|
51
|
+
## 1.0.0-rc.5
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [#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
|
|
56
|
+
new package name and keeps its query. Before, a query right after the package name hid the package,
|
|
57
|
+
and the specifier was left as it was.
|
|
58
|
+
|
|
59
|
+
- [#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
|
|
60
|
+
workspace) keeps its name and is reported as a manual step: the entry above the root cannot be
|
|
61
|
+
renamed, and renaming only the dependency failed the install with
|
|
62
|
+
`ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC`. At a workspace root, where no catalog is above, such a
|
|
63
|
+
dependency is reported as one whose entry is missing. `catalog: ` with a space is the default
|
|
64
|
+
catalog, as pnpm reads it.
|
|
65
|
+
|
|
66
|
+
- [#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`,
|
|
67
|
+
`exec -a`, `dotenvx run --`, `doppler run --`, `nx exec --`, `yarn workspace <name>`, a bare `bun`,
|
|
68
|
+
`corepack`, and `tsx` or `ts-node` before the path of its binary; `yarn global add` renames its
|
|
69
|
+
packages. Any other word of a command that names an old package or a path to its binary (a
|
|
70
|
+
script name after `npm run`, an argument of an unknown program, `$(npm bin)/openapi-typescript`)
|
|
71
|
+
is reported as a manual step. Such commands were left without a word, and
|
|
72
|
+
`dotenvx run -- npx openapi-typescript` kept downloading the old generator.
|
|
73
|
+
|
|
74
|
+
- [#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: |`
|
|
75
|
+
blocks and Dockerfiles: an apostrophe in it (`Don't edit`) opened a quote to the end of the file,
|
|
76
|
+
and no command after it was migrated. A here-document that a shell runs (`bash <<EOF`,
|
|
77
|
+
Dockerfile `RUN <<EOF` and `RUN <<EOT bash`, `cat <<EOF | sh`) is read as the script it is, so its
|
|
78
|
+
commands are migrated. A shift in an arithmetic expansion (`$((1 << 2))`) is not a here-document.
|
|
79
|
+
|
|
80
|
+
- [#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
|
|
81
|
+
`OpenAPITSOptions` (`const options: OpenAPITSOptions`, `satisfies` or `as OpenAPITSOptions`, a
|
|
82
|
+
`transform` const typed `OpenAPITSOptions["transform"]`) name `OpenAPITSIrOptions` instead, with its
|
|
83
|
+
import; the rewritten file did not compile. Options typed with a type built from `OpenAPITSOptions`
|
|
84
|
+
(`Partial<OpenAPITSOptions>`) keep their `transform`, reported as a manual step. The type is found
|
|
85
|
+
in the other forms it is written in too: `import("openapi-typescript").OpenAPITSOptions`, a local
|
|
86
|
+
alias or an interface that extends it, and the JSDoc `@type` and `@satisfies` of a JavaScript file.
|
|
87
|
+
Options that take keys from another object (`{ ...base, transform }`) keep their `transform`,
|
|
88
|
+
reported as a manual step: the tool cannot see the callbacks and type of `base`. A `transform`
|
|
89
|
+
written as a shorthand property (`{ transform }`) is rewritten too.
|
|
90
|
+
|
|
91
|
+
- [#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$": … }`,
|
|
92
|
+
`transformIgnorePatterns`) are reported as manual steps, in `jest.config.*` files and in the `jest`
|
|
93
|
+
field of `package.json`. A pattern is not a module specifier, so the tool does not change it. A
|
|
94
|
+
value of a JSON config that is just a package name (`"^@api$": "openapi-fetch"`) is reported too;
|
|
95
|
+
a string of a config script that names a package (`"openapi-fetch/$1"`) is reported once.
|
|
96
|
+
|
|
97
|
+
- [#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
|
|
98
|
+
code fences of the page stay as written.
|
|
99
|
+
|
|
100
|
+
- [#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:
|
|
101
|
+
- Task's `Taskfile.yml` (`cmds`, `cmd`, `sh`, `status`, `defer`, `preconditions`);
|
|
102
|
+
- pre-commit's `.pre-commit-config.yaml`: the `entry` and `args` of a hook as one command, and the
|
|
103
|
+
old packages in `additional_dependencies`;
|
|
104
|
+
- the `simple-git-hooks`, `lint-staged` and `nx.targets` commands of `package.json` and
|
|
105
|
+
`package.yaml`;
|
|
106
|
+
- `.lintstagedrc` (JSON or YAML), `.lintstagedrc.json`, `.lintstagedrc.yaml`, `.simple-git-hooks.json`;
|
|
107
|
+
- the `targetDefaults` commands of `nx.json`, and the commands of Nx `configurations`.
|
|
108
|
+
|
|
109
|
+
A YAML command written with escapes (`"openapi-typescript \"$SPEC\""`) is migrated by its value,
|
|
110
|
+
and the whole string is written again with its escapes.
|
|
111
|
+
|
|
112
|
+
- [#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
|
|
113
|
+
`import_map.json`, and its imports count as declared for the files under that config. An import map
|
|
114
|
+
named by a URL or by a path outside the project is reported as a manual step.
|
|
115
|
+
|
|
116
|
+
- [#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
|
|
117
|
+
(`"../node_modules/openapi-fetch/dist/index.js"`) is reported as a manual step: the old package is no
|
|
118
|
+
longer installed after the migration, so the path stops resolving.
|
|
119
|
+
|
|
120
|
+
- [#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
|
|
121
|
+
`openapi-fetch@0.13.0.patch`, Yarn `openapi-fetch-npm-0.13.0-<hash>.patch`) is reported as a manual
|
|
122
|
+
step: the new package has other code, so the patch cannot be carried over.
|
|
123
|
+
|
|
124
|
+
- [#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
|
|
125
|
+
`overrides` and `patchedDependencies`: `packageExtensions`, `allowedDeprecatedVersions`,
|
|
126
|
+
`onlyBuiltDependencies` and the rest, in `pnpm-workspace.yaml`, in the `pnpm` field of
|
|
127
|
+
`package.json` and in `.yarnrc.yml`. Values count too (`"x": "npm:openapi-fetch@0.13.0"` in
|
|
128
|
+
`overrides`). A setting under the `pnpm` field is reported by its own key (`pnpm.overrides`).
|
|
129
|
+
|
|
130
|
+
- [#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`),
|
|
131
|
+
so a file name cannot forge CI commands or erase the lines before it.
|
|
132
|
+
|
|
133
|
+
- [#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" }`,
|
|
134
|
+
also under conditions and fallback lists) get the new package names, so they still resolve once the
|
|
135
|
+
dependencies are renamed. So do the keys and values of the `browser` field
|
|
136
|
+
(`"browser": { "openapi-fetch": false }`). A target or `browser` key that reaches into a file of
|
|
137
|
+
the package is reported as a manual step.
|
|
138
|
+
|
|
139
|
+
- [#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`
|
|
140
|
+
keys of an old package (`"openapi-fetch"`, `"openapi-fetch/*"`) and its name in
|
|
141
|
+
`compilerOptions.types` get the new names, so the paths still match the renamed imports. A path into
|
|
142
|
+
`node_modules` of an old package is reported as a manual step.
|
|
143
|
+
|
|
3
144
|
## 1.0.0-rc.4
|
|
4
145
|
|
|
5
146
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -18,35 +18,49 @@ 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
|
|
22
|
-
|
|
|
23
|
-
| Every `package.json` and pnpm's `package.yaml`
|
|
24
|
-
| `pnpm-workspace.yaml`, `.yarnrc.yml`
|
|
25
|
-
| `deno.json`, `deno.jsonc`, `import_map.json`
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
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:` stays; a dependency on a local package (`workspace:`, `link:`, `file:`) keeps its name and is reported. 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; options or a named `transform` function that other code can reach (another use, or an export) are kept and reported. Module constants and imports that only the old returns used are removed; exported ones stay. 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. |
|
|
30
31
|
|
|
31
32
|
Commands are read in `package.json` scripts, shell scripts (`.sh`, `.bash`, `.zsh`), husky hooks,
|
|
32
|
-
`Makefile`, `justfile`, `Dockerfile`, CI and other YAML files, Nx `project.json` targets
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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`,
|
|
37
|
+
`nx.targets` and wireit `command` 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",
|
|
37
45
|
"openapi-typescript", …]`, also after `RUN --mount=…`) is read word by word, and the command line of
|
|
38
46
|
`["sh", "-c", "…"]` as shell text. A Makefile variable that holds the generator (`OAT :=
|
|
39
47
|
openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed where it is set,
|
|
40
48
|
and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
|
|
41
49
|
of a workflow and the flags after `$GEN` or `${{ env.GEN }}`, and a Dockerfile `ARG` or `ENV`
|
|
42
|
-
variable and the flags after `$GEN
|
|
50
|
+
variable and the flags after `$GEN`, and a justfile variable (`gen := "npx openapi-typescript"`)
|
|
51
|
+
and the flags after `{{gen}}`. A shell variable that a script, a `run` block or a package.json
|
|
52
|
+
script sets itself (`GEN="npx openapi-typescript"`, also after `export`, `local` or `readonly`)
|
|
53
|
+
is renamed where it is set, and the flags after `$GEN` where it runs. The flags change only when every definition of the variable
|
|
43
54
|
in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
|
|
44
|
-
later Makefile line sets to another program is reported with its old flags. A variable of old
|
|
55
|
+
later Makefile line or shell assignment sets to another program is reported with its old flags. A variable of old
|
|
45
56
|
flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`) may serve other commands too, so it
|
|
46
57
|
is reported, not changed. YAML files are changed only in command
|
|
47
58
|
keys (`run`, `script`, `command`, `entrypoint`, …) and in the values of `env`, in block and flow
|
|
48
|
-
style, never in other values
|
|
49
|
-
|
|
59
|
+
style, never in other values. A CI step whose `shell` is another program (`shell: python`) runs
|
|
60
|
+
code of that language, so its script is not changed, and it is reported when it names an old
|
|
61
|
+
package. An API description (a YAML document with a top-level `openapi`,
|
|
62
|
+
`swagger` or `asyncapi` key) is data, so it is never changed, not even an example `command`; a
|
|
63
|
+
YAML file that names no old package is not even parsed. A config that cannot be parsed and names an old package is reported with the
|
|
50
64
|
line and column, not changed. `Makefile`, `justfile` and `Dockerfile` are read only under the names
|
|
51
65
|
make, just and docker look for (also `makefile`, `GNUmakefile`, `Justfile`, `.justfile`,
|
|
52
66
|
`Containerfile` and `*.mk`), so `Dockerfile.dev` is not changed.
|
|
@@ -102,8 +116,23 @@ The report and the log show a spec with credentials (`git+https://<token>@…`)
|
|
|
102
116
|
The report lists each of these with the file and line:
|
|
103
117
|
|
|
104
118
|
- a version spec it cannot replace (`latest`, a URL, a file, an npm alias), and `overrides` /
|
|
105
|
-
`resolutions`
|
|
106
|
-
|
|
119
|
+
`resolutions` and every other package manager setting (`packageExtensions`,
|
|
120
|
+
`allowedDeprecatedVersions`, …, in `package.json`, `pnpm-workspace.yaml` or `.yarnrc.yml`,
|
|
121
|
+
patches included) that names an old package, except an override that aliases it to its
|
|
122
|
+
successor (`"openapi-fetch": "npm:openapi-typesafe-fetch@^1.0.0"`), which is the migration done;
|
|
123
|
+
- a dependency under an old name on a local package (`workspace:*`, `link:`, `file:`, `portal:`),
|
|
124
|
+
such as a fork in the workspace: it and the imports of it keep the old name, because the new
|
|
125
|
+
name would point at a package the project does not have;
|
|
126
|
+
- a `catalog:` dependency whose catalog entry is outside the folder it migrates (`--root` of one
|
|
127
|
+
package of a workspace), or missing from the workspace: it keeps its old name, because the
|
|
128
|
+
entry is not edited;
|
|
129
|
+
- a patch file of an old package (`patches/openapi-fetch+0.13.0.patch`): the new package has other
|
|
130
|
+
code, so check whether the fix is still needed;
|
|
131
|
+
- a word in a command that names an old package where the tool cannot tell what runs it (an
|
|
132
|
+
argument of a program it does not know, a script name): migrate it by hand;
|
|
133
|
+
- a CI step whose `shell` is another program (`shell: python`) and whose script names an old
|
|
134
|
+
package: the tool does not read code of other languages, so migrate it by hand;
|
|
135
|
+
- an import map that a Deno config names by a URL or a path outside the folder;
|
|
107
136
|
- a renamed peer dependency: users of your package must switch too;
|
|
108
137
|
- a pnpm `package.json5` that names an old package: the tool does not read JSON5, so rename the
|
|
109
138
|
packages and the command there by hand, or write it as `package.json` and run the tool again;
|
|
@@ -114,7 +143,13 @@ The report lists each of these with the file and line:
|
|
|
114
143
|
- strings in sources that run `openapi-typescript` (`execSync("npx openapi-typescript …")`, also
|
|
115
144
|
a template such as `` `npx openapi-typescript ${spec}` ``),
|
|
116
145
|
with the command they should become;
|
|
117
|
-
- deep imports such as `openapi-fetch/dist
|
|
146
|
+
- deep imports such as `openapi-fetch/dist/...` (also subpath import targets and `browser` keys):
|
|
147
|
+
check that the file exists in the new package;
|
|
148
|
+
- imports from the `node_modules` folder of an old package (`../node_modules/openapi-fetch/x.js`),
|
|
149
|
+
and such paths in a tsconfig or in `typesVersions`: import from the new package instead, or
|
|
150
|
+
point the path at its files;
|
|
151
|
+
- Jest patterns that name an old package (`moduleNameMapper`, `transformIgnorePatterns`): make
|
|
152
|
+
them match the new name where they mean the package;
|
|
118
153
|
- a module name built at run time right after an old package name
|
|
119
154
|
(``import(`openapi-fetch${suffix}`)``): the rest may go on with the name, so only you know what
|
|
120
155
|
to write;
|
|
@@ -125,12 +160,13 @@ The report lists each of these with the file and line:
|
|
|
125
160
|
- strings that equal an old package name outside a module specifier (an object key, a label, a
|
|
126
161
|
bundler option such as `external: ["openapi-fetch"]`): they are kept, because only you know
|
|
127
162
|
whether they mean the package. Comments are not changed or reported;
|
|
128
|
-
- `swr-openapi` in your dependencies: it takes its client type from
|
|
129
|
-
dependency), so alias `openapi-fetch` to `openapi-typesafe-fetch` with
|
|
130
|
-
`resolutions` (see
|
|
163
|
+
- `swr-openapi` in your dependencies, until the alias is in place: it takes its client type from
|
|
164
|
+
`openapi-fetch` (a peer dependency), so alias `openapi-fetch` to `openapi-typesafe-fetch` with
|
|
165
|
+
`overrides` or `resolutions` (see
|
|
131
166
|
[Libraries built on openapi-fetch](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md#libraries-built-on-openapi-fetch));
|
|
132
|
-
- `transform` callbacks it cannot rewrite
|
|
133
|
-
|
|
167
|
+
- `transform` callbacks it cannot rewrite (also when their options use a type built from
|
|
168
|
+
`OpenAPITSOptions`, such as `Partial<OpenAPITSOptions>`), and `postTransform` /
|
|
169
|
+
`transformProperty`, also in options that other code shares, and `openapiTS()` calls whose options it cannot see (a
|
|
134
170
|
parameter, a function call): they keep working with a deprecation warning; see
|
|
135
171
|
[IR callbacks](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks).
|
|
136
172
|
|