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

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/LICENSE CHANGED
@@ -1,6 +1,5 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Drew Powers
4
3
  Copyright (c) 2026 Fedor Chishchin and openapi-typesafe contributors
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -10,21 +10,42 @@ npx openapi-typesafe-migrate --write # change the files
10
10
 
11
11
  Run it in the project root, with a clean git tree, so you can review the diff.
12
12
 
13
+ > **Release candidate.** The current version is a 1.0.0 release candidate (`1.0.0-rc.N`);
14
+ > names and output can still change before 1.0.0.
15
+
13
16
  Run it with `npx` (or `pnpm dlx`, `yarn dlx`, `bunx`), not as a dependency: it uses TypeScript 6
14
17
  (`@typescript/typescript6`), and an npm install of it links the project's `tsc` to TypeScript 6.
15
18
 
16
19
  ## What it changes
17
20
 
18
- | Where | Change |
19
- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
- | 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. |
21
- | `pnpm-workspace.yaml` | Entries of `catalog:` and `catalogs:`. Comments and formatting stay. |
22
- | `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`. |
23
- | Sources (`.ts`, `.tsx`, `.js`, `.mjs`, `.cjs`, `.vue`, `.svelte`, `.astro`, …) | Quoted module specifiers: imports, `require()`, `import()`, `vi.mock()`, `declare module`, tool configs. |
24
- | `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. |
25
-
26
- `node_modules`, `.git`, `dist` and the output folders `.next`, `.nuxt`, `.output`, `.svelte-kit`,
27
- `.turbo` and `coverage` are skipped; links are not followed.
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.
31
+
32
+ In a git repository the tool reads the files git lists: tracked files, and untracked files that
33
+ `.gitignore` does not ignore, so ignored build output (`cjs/`, `esm/`, `types/`, …) stays out. A
34
+ submodule or a nested repository is read the same way, with its own git and its own `.gitignore`.
35
+ Outside a git repository, without `git` (or with git older than 2.31), and in a folder that the
36
+ repository around it ignores, it reads the whole tree of that folder. Either way `node_modules`,
37
+ `.git`, `dist` and the output folders `.next`, `.nuxt`, `.output`, `.svelte-kit`, `.turbo` and
38
+ `coverage` are skipped, and links are not followed. The log names the folders and how each one
39
+ was read.
40
+
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.
47
+ The report and the log show a spec with credentials (`git+https://<token>@…`) as
48
+ `git+https://***@…`; the file keeps it as written.
28
49
 
29
50
  ## What it leaves to you
30
51
 
@@ -36,6 +57,13 @@ The report lists each of these with the file and line:
36
57
  - a renamed peer dependency: users of your package must switch too;
37
58
  - `npx openapi-typescript@<version>`: the old package is pinned, change it by hand;
38
59
  - deep imports such as `openapi-fetch/dist/...`: check that the file exists in the new package;
60
+ - strings that equal an old package name outside a module specifier (an object key, a label, a
61
+ bundler option such as `external: ["openapi-fetch"]`): they are kept, because only you know
62
+ whether they mean the package. Comments are not changed or reported;
63
+ - `swr-openapi` in your dependencies: it takes its client type from `openapi-fetch` (a peer
64
+ dependency), so alias `openapi-fetch` to `openapi-typesafe-fetch` with `overrides` or
65
+ `resolutions` (see
66
+ [Libraries built on openapi-fetch](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/fetch/index.md#libraries-built-on-openapi-fetch));
39
67
  - `transform` callbacks it cannot rewrite, and `postTransform` / `transformProperty`: they keep
40
68
  working with a deprecation warning; see
41
69
  [IR callbacks](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/node.md#ir-callbacks).
@@ -45,14 +73,25 @@ now, so `--check` fails until you do), and run your type check and tests.
45
73
 
46
74
  ## Options
47
75
 
48
- | Option | Default |
49
- | -------------- | ---------------------------------------------------------------------------- |
50
- | `--write` | Dry run: nothing is written |
51
- | `--root <dir>` | The current directory |
52
- | `--log <file>` | A new JSON Lines file in the system temporary directory; its path is printed |
76
+ | Option | Default |
77
+ | ----------------- | --------------------------------------------------------------------------------------------- |
78
+ | `--write` | Dry run: nothing is written |
79
+ | `--root <dir>` | The current directory |
80
+ | `--log <file>` | A new JSON Lines file in a new private folder in the temporary directory; its path is printed |
81
+ | `--help`, `-h` | Show the help |
82
+ | `--version`, `-v` | Show the version |
83
+
84
+ The default log folder is new for each run and only you can open it (mode 0700). A `--log` file
85
+ that exists gets the new lines appended, and missing parent folders are created.
86
+
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.
89
+
90
+ ## Versioning
53
91
 
54
- Exit codes: `0` done, `1` the migration failed (the message and the log say why), `2` unknown
55
- option.
92
+ Semantic versioning from 1.0.0, with one version for all openapi-typesafe packages. What the
93
+ version promises, and what may grow in a minor release, is listed under
94
+ [Versioning](https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/compatibility.md#versioning).
56
95
 
57
96
  ## License
58
97