openapi-typesafe-migrate 1.0.0-rc.10 → 1.0.0-rc.11
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 +78 -0
- package/README.md +35 -9
- package/dist/cli/main.mjs +1178 -694
- package/dist/cli/main.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# openapi-typesafe-migrate
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A generator command appended to a variable that the file does not set before
|
|
8
|
+
(`H+="npx openapi-typescript -it"` in a shell script, `GEN += npx openapi-typescript` in a
|
|
9
|
+
Makefile) is migrated where it is written. Before, it was only reported. The flags after a later
|
|
10
|
+
`$H` are still reported, since the value from outside may start with another program.
|
|
11
|
+
|
|
12
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - bun's `trustedDependencies` in package.json is reported when it names an old package, as pnpm's
|
|
13
|
+
`onlyBuiltDependencies` already was.
|
|
14
|
+
|
|
15
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - The migration reads the parameters of more CI files as it reads GitHub Actions inputs: CircleCI
|
|
16
|
+
`parameters` with `<< parameters.gen >>`, GitLab `spec: inputs` with `$[[ inputs.gen ]]`, and Azure
|
|
17
|
+
Pipelines template `parameters` with `${{ parameters.gen }}`. A parameter's default is renamed, and
|
|
18
|
+
the old flags after or inside such a reference are reported. Each file kind reads only its own
|
|
19
|
+
parameters, and `${{ inputs['flags'] }}` is read like `${{ inputs.flags }}`. Before, the flags
|
|
20
|
+
after these references were kept without a word, and a GitLab input default was renamed while the
|
|
21
|
+
flags after `$[[ inputs.gen ]]` were not.
|
|
22
|
+
|
|
23
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - When a CI file sets a variable to the generator (GitLab `variables`, Compose `environment`,
|
|
24
|
+
CircleCI `environment`, Task `vars`, Azure `variables`, a workflow `env`), the migration now also
|
|
25
|
+
reads the scripts and other command files that expand it (`$GEN api.yaml -it` in
|
|
26
|
+
`scripts/gen.sh`), even when they name no old package, and reports the old flags after `$GEN`
|
|
27
|
+
there. Before, the variable was renamed and those flags were kept without a word.
|
|
28
|
+
|
|
29
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - The old flags that a container gives the generator through its command are renamed: a
|
|
30
|
+
Dockerfile `CMD ["api.yaml", "-it"]` after `ENTRYPOINT ["openapi-typescript"]` (also from an
|
|
31
|
+
earlier build stage), a Compose, GitLab or CircleCI `command` after an `entrypoint`, and
|
|
32
|
+
Kubernetes `args` after a `command`. Before, the entrypoint got the new name while the command
|
|
33
|
+
kept `-it`, and the container failed with a removed flag. An entrypoint script that may pass its
|
|
34
|
+
arguments on is reported.
|
|
35
|
+
|
|
36
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - The migration renames the `options` of a GitLab CI variable together with its `value`, and reads
|
|
37
|
+
each option as a value the variable can have. Before, only the value was renamed, so it was no
|
|
38
|
+
longer one of the options and GitLab rejected the pipeline.
|
|
39
|
+
|
|
40
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A YAML file that a Taskfile `includes`, a GitLab CI `include: local:` or an Azure Pipelines
|
|
41
|
+
`template:` names is now migrated as a file of the kind that includes it, whatever its name: its
|
|
42
|
+
`cmds`, `variables`, `$(gen)` macros and inputs are read as there. GitLab `*` and `**` patterns
|
|
43
|
+
are followed, and so are the files that included files include. Before, such a file was read as
|
|
44
|
+
plain YAML, and the report could say there was nothing to migrate.
|
|
45
|
+
|
|
46
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A Makefile call of a function with a hyphen in its name, such as
|
|
47
|
+
`$(filter-out x,npx openapi-typescript)`, is reported when its arguments name an old package.
|
|
48
|
+
Before, the file was neither changed nor reported ("Nothing to migrate").
|
|
49
|
+
|
|
50
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A shell variable whose value is written with a backslash or in several quoted parts
|
|
51
|
+
(`GEN=npx\ openapi-typescript`, `GEN="npx "openapi-typescript`) now gets the new generator name
|
|
52
|
+
too. Before, the flags after `$GEN` were renamed while the value kept `openapi-typescript`, and the
|
|
53
|
+
report said nothing about it.
|
|
54
|
+
|
|
55
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A variable that a step, a job or a stage written as a list item sets (an Azure Pipelines or
|
|
56
|
+
GitHub Actions step `env`, an Azure stage's `variables`) now counts for the commands of that item
|
|
57
|
+
only. Before, it counted for the whole file, so the flags after `$GEN` in another step were
|
|
58
|
+
renamed although `GEN` was not set there.
|
|
59
|
+
|
|
60
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A command line passed to a program as a variable is migrated:
|
|
61
|
+
`cross-env GEN="npx openapi-typescript -it" node gen.js`, `env GEN="…" make` and
|
|
62
|
+
`$(MAKE) -C api GEN="…"` get the new generator name and flags. A one-word value that names an
|
|
63
|
+
old package (`make GEN=openapi-typescript`) is reported. Before, both were left without a word.
|
|
64
|
+
|
|
65
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A command that runs the old generator from a Windows folder outside the project
|
|
66
|
+
(`C:\tools\openapi-typescript a.yaml`) is reported, as a POSIX path such as
|
|
67
|
+
`/usr/local/bin/openapi-typescript` already was.
|
|
68
|
+
|
|
69
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - The migration reads the command line of an exec-form shell in a YAML file as shell text:
|
|
70
|
+
`command: ["sh", "-c", "…"]` in a Compose file, and a Kubernetes `command: ["/bin/sh", "-c"]`
|
|
71
|
+
with the script in `args`. A Compose `entrypoint` list and `command` list, and a Kubernetes
|
|
72
|
+
`command` list and `args` list, are read as one command, and Compose's `$$GEN` is read as the
|
|
73
|
+
service's `$GEN`. Before, the generator and its old flags in these commands were kept without a
|
|
74
|
+
word, or `$GEN` was renamed while the flags after `$$GEN` were not.
|
|
75
|
+
|
|
76
|
+
- [#134](https://github.com/openapi-typesafe/openapi-typesafe/pull/134) [`e6bbda7`](https://github.com/openapi-typesafe/openapi-typesafe/commit/e6bbda77200c0888c387ec32b8fe6d774a071aeb) Thanks [@fedorello](https://github.com/fedorello)! - A renamed dependency whose spec is Yarn's `npm:` protocol with a bare range
|
|
77
|
+
(`"openapi-fetch": "npm:^0.13.0"`) gets the new version after the same protocol
|
|
78
|
+
(`"openapi-typesafe-fetch": "npm:^1.0.0"`). Before, it kept the old range, which no version of
|
|
79
|
+
the new package matches, and the report asked to fix it by hand.
|
|
80
|
+
|
|
3
81
|
## 1.0.0-rc.10
|
|
4
82
|
|
|
5
83
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -45,7 +45,15 @@ them (quotes, `\` line continuations, comments, `&&`, `|`,
|
|
|
45
45
|
own flags are renamed, and a script name (`npm run openapi-typescript`) is never changed. A
|
|
46
46
|
Dockerfile's exec form (`RUN ["npx",
|
|
47
47
|
"openapi-typescript", …]`, also after `RUN --mount=…`) is read word by word, and the command line of
|
|
48
|
-
`["sh", "-c", "…"]` as shell text.
|
|
48
|
+
`["sh", "-c", "…"]` as shell text. The items of an exec-form `CMD` are the arguments of the
|
|
49
|
+
exec-form `ENTRYPOINT` of its stage (or of the stage it starts `FROM`), so after
|
|
50
|
+
`ENTRYPOINT ["openapi-typescript"]` the old flags of `CMD ["api.yaml", "-it"]` are renamed, and an
|
|
51
|
+
entrypoint script that may pass them on is reported. A YAML `command` after an `entrypoint` of
|
|
52
|
+
the same map (Compose, GitLab, CircleCI) and Kubernetes `args` after a `command` are read the
|
|
53
|
+
same way; when both are lists, they are one exec-form command, the entrypoint first
|
|
54
|
+
(`entrypoint: ["npx"]` with `command: ["openapi-typescript", "-it"]`, or `command: ["/bin/sh",
|
|
55
|
+
"-c"]` with its script in `args`), and Compose's `$$GEN` there is the container's `$GEN`. A
|
|
56
|
+
Makefile variable that holds the generator (`OAT :=
|
|
49
57
|
openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed where it is set,
|
|
50
58
|
and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
|
|
51
59
|
of a workflow and the flags after `$GEN` or `${{ env.GEN }}` (also GitLab CI `variables`,
|
|
@@ -59,8 +67,14 @@ as a command line where it is written: in a value that just computes
|
|
|
59
67
|
(`env_var_or_default("GEN", "npx openapi-typescript")`, an `if`), in a recipe parameter default
|
|
60
68
|
(`types gen="npx openapi-typescript":`) and in an interpolation; such a value and a parameter (the
|
|
61
69
|
command line can set it) may run another program, so the flags after them are reported. A shell variable that a script, a `run` block or a package.json
|
|
62
|
-
script sets itself (`GEN="npx openapi-typescript"`, also after `export`, `local` or `readonly
|
|
63
|
-
|
|
70
|
+
script sets itself (`GEN="npx openapi-typescript"`, also after `export`, `local` or `readonly`,
|
|
71
|
+
and written with a backslash or in several quoted parts, `GEN=npx\ openapi-typescript`, which
|
|
72
|
+
is read as the shell reads it) is renamed where it is set, and the flags after `$GEN` where it
|
|
73
|
+
runs. A command line passed to a program as a variable (`cross-env GEN="npx openapi-typescript
|
|
74
|
+
-it" node gen.js`, `env GEN="…" make`, `$(MAKE) GEN="…"`) is migrated where it is written. Text
|
|
75
|
+
appended to a variable the file does not set before is the value when it runs the generator
|
|
76
|
+
itself (`H+="npx openapi-typescript"`, a Makefile `GEN += npx openapi-typescript`), so it is
|
|
77
|
+
migrated where it is written. Text appended to such a
|
|
64
78
|
variable (a Makefile `GEN += --immutable-types`, a shell `G+=" -it"`, a justfile
|
|
65
79
|
`"npx openapi-typescript" + " -it"`) holds arguments of the program its value runs, so its old
|
|
66
80
|
flags are renamed where they are written, or reported when the variable may run another program;
|
|
@@ -79,7 +93,8 @@ computes (`$(or $(GEN),npx openapi-typescript)`, `$(shell …)`) may run the gen
|
|
|
79
93
|
flags after it are reported; the arguments that `$(or …)`, `$(and …)` and `$(if …)` can give, and
|
|
80
94
|
the text of `$(strip …)`, are read as command lines where they are written, so the old name in
|
|
81
95
|
them is renamed. A call of any other make function whose arguments name an old package
|
|
82
|
-
(`$(firstword npx openapi-typescript)`, `$(call …)`, `$(shell …)`) is
|
|
96
|
+
(`$(firstword npx openapi-typescript)`, `$(filter-out …)`, `$(call …)`, `$(shell …)`) is
|
|
97
|
+
reported. A Makefile
|
|
83
98
|
variable set with `?=` (the environment can override it) or to a value that make computes is
|
|
84
99
|
reported the same way where it runs. The flags change only when every definition of the variable
|
|
85
100
|
in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
|
|
@@ -93,7 +108,14 @@ flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`, a justfile `{{fla
|
|
|
93
108
|
`${{ inputs.flags }}` with an input default `-it`, also as `${{ github.event.inputs.flags }}`,
|
|
94
109
|
through an `env` value `FL: ${{ inputs.flags }}`, or as a literal in an expression,
|
|
95
110
|
`${{ inputs.flags || '-it' }}`) may serve other commands too, so it
|
|
96
|
-
is reported, not changed.
|
|
111
|
+
is reported, not changed. A GitLab variable's `options` are values of the variable. A variable map in a list item
|
|
112
|
+
(a step's `env`) reaches only that item. The defaults of CircleCI `parameters`
|
|
113
|
+
(`<< parameters.gen >>`), GitLab `spec: inputs` (`$[[ inputs.gen ]]`) and Azure Pipelines
|
|
114
|
+
`parameters` (`${{ parameters.gen }}`) are read as input defaults are. A file that a Taskfile
|
|
115
|
+
`includes`, a GitLab local `include` (also with `*` and `**`) or an Azure `template` names is read
|
|
116
|
+
as a file of that kind. A variable that a YAML variable map sets to the generator may run it in
|
|
117
|
+
any file the tool reads (a script that a CI job runs), so the flags after `$GEN` there are
|
|
118
|
+
reported. YAML files are changed only in command
|
|
97
119
|
keys (`run`, `script`, `command`, `entrypoint`, …), in the values of the variable maps above and in input
|
|
98
120
|
defaults, in block and flow style, never in other values. An anchor that an alias uses under such
|
|
99
121
|
a key (`script: [*gen_scripts]`, `env: *common`) is migrated where it is written, once. A CI step whose `shell` is another program (`shell: python`) runs
|
|
@@ -165,10 +187,12 @@ The report and the log show a spec with credentials (`git+https://<token>@…`)
|
|
|
165
187
|
|
|
166
188
|
The report lists each of these with the file and line:
|
|
167
189
|
|
|
168
|
-
- a version spec it cannot replace (`latest`, a URL, a file, an npm alias
|
|
190
|
+
- a version spec it cannot replace (`latest`, a URL, a file, an npm alias of another package;
|
|
191
|
+
Yarn's `npm:^0.13.0` is a range and gets the new version), and `overrides` /
|
|
169
192
|
`resolutions` and every other package manager setting (`packageExtensions`,
|
|
170
|
-
`allowedDeprecatedVersions`, …, in `package.json`,
|
|
171
|
-
patches included) that names an old package, except an
|
|
193
|
+
`allowedDeprecatedVersions`, bun's `trustedDependencies`, …, in `package.json`,
|
|
194
|
+
`pnpm-workspace.yaml` or `.yarnrc.yml`, patches included) that names an old package, except an
|
|
195
|
+
override that aliases it to its
|
|
172
196
|
successor (`"openapi-fetch": "npm:openapi-typesafe-fetch@^1.0.0"`), which is the migration done;
|
|
173
197
|
- a dependency under an old name on a local package (`workspace:*`, `link:`, `file:`, `portal:`),
|
|
174
198
|
such as a fork in the workspace: it and the imports of it keep the old name, because the new
|
|
@@ -179,7 +203,9 @@ The report lists each of these with the file and line:
|
|
|
179
203
|
- a patch file of an old package (`patches/openapi-fetch+0.13.0.patch`): the new package has other
|
|
180
204
|
code, so check whether the fix is still needed;
|
|
181
205
|
- a word in a command that names an old package where the tool cannot tell what runs it (an
|
|
182
|
-
argument of a program it does not know, a script name
|
|
206
|
+
argument of a program it does not know, a script name, a one-word variable passed to a
|
|
207
|
+
program such as `make GEN=openapi-typescript`), a generator installed outside the project
|
|
208
|
+
(`/usr/local/bin/openapi-typescript`, `C:\tools\openapi-typescript`), and a Kubernetes `env` item
|
|
183
209
|
(`- name: GEN / value: npx openapi-typescript`), which no shell reads: migrate it by hand;
|
|
184
210
|
- a CI step whose `shell` is another program (`shell: python`), a justfile recipe with a shebang
|
|
185
211
|
for one, or inline code (`python3 -c '…'`) that names an old package: the tool does not read
|