openapi-typesafe-migrate 1.0.0-rc.10 → 1.0.0-rc.12

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 CHANGED
@@ -1,5 +1,129 @@
1
1
  # openapi-typesafe-migrate
2
2
 
3
+ ## 1.0.0-rc.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - In a shell script that appends to a variable twice (`H+="npx openapi-typescript"`, then
8
+ `H+=" -it"`), the appended old flag is now reported. Before, the name was renamed and `-it` was
9
+ kept without a word, so `$H api.yaml` failed.
10
+
11
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - A Compose `entrypoint` or `command` that a merge key gives (`<<: *gen`) is paired with the
12
+ service's own keys, so the old flags of `command: ["api.yaml", "-it"]` after a merged generator
13
+ entrypoint are renamed. The service's own keys win over merged ones, and the first map of a
14
+ merge list wins over later ones. Before, the entrypoint was renamed and `-it` was kept.
15
+
16
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - The `args` of a GitHub Docker action (`runs.entrypoint` with `runs.args`) and of a `docker://`
17
+ step (`with.entrypoint` with `with.args`) are read as the arguments of the entrypoint, so the
18
+ old flags there are renamed. Before, they were kept and not reported.
19
+
20
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - Dockerfile `ENV` and `ARG` values are read as Docker reads them: escaped blanks
21
+ (`ENV GEN=node_modules/.bin/openapi-typescript\ --redoc\ r.yaml`), several quoted parts
22
+ (`ARG G2="npx "openapi-typescript`), escaped quotes, continued lines and the escape character
23
+ that `# escape=` sets. The generator command in them is migrated, and the old flags after
24
+ `$GEN` are renamed. Before, these values were neither changed nor reported.
25
+
26
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - A file that a Taskfile includes or an Azure Pipelines template now reports the old flags after
27
+ `{{.GEN}}` or `$(gen)` when the including file sets that variable to the generator. Before, only
28
+ `$GEN` was reported there and the other forms kept their flags silently.
29
+
30
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - A container command that runs the generator after an init program or an entrypoint script
31
+ (`entrypoint: ["tini", "--"]`, `["dumb-init", "--"]`, `["docker-entrypoint.sh"]`, a Dockerfile
32
+ `ENTRYPOINT ["/sbin/tini", "--"]`, a Kubernetes `command` with `args`) is migrated again: the
33
+ generator name and its old flags are renamed. Before, it was only reported as a name the tool
34
+ could not place. `tini`, `docker-init`, `dumb-init`, `catatonit`, `gosu` and `su-exec` are now
35
+ known wrappers in every command, also by their full path.
36
+
37
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - A Makefile argument written with `:=`, `::=`, `:::=`, `?=`, `!=` or `+=`
38
+ (`$(MAKE) -C api GEN:="npx openapi-typescript -it"`) is read as the variable it sets, as
39
+ `GEN="…"` already was, so its command is migrated.
40
+
41
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - The script of `sh -c` is read as the shell reads it however it is quoted
42
+ (`sh -c 'npx openapi-typescript '"'"'a.yaml'"'"' -it'`, `sh -c "X='…'; \$X b.yaml -it"`), so
43
+ the generator and its old flags are renamed. A flag in quotes (`"-it"`) is renamed too. A flag
44
+ that quotes split (`-i't'`) is reported with its new name instead of kept silently.
45
+
46
+ - [#142](https://github.com/openapi-typesafe/openapi-typesafe/pull/142) [`61181e9`](https://github.com/openapi-typesafe/openapi-typesafe/commit/61181e9ec62191cb119d1ba4f8348fd1f4fbb0ea) Thanks [@fedorello](https://github.com/fedorello)! - `openapiTS(spec, undefined)` and `openapiTS(spec, void 0)` are read as a call without options.
47
+ Before, the report asked to check the options by hand.
48
+
49
+ ## 1.0.0-rc.11
50
+
51
+ ### Patch Changes
52
+
53
+ - [#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
54
+ (`H+="npx openapi-typescript -it"` in a shell script, `GEN += npx openapi-typescript` in a
55
+ Makefile) is migrated where it is written. Before, it was only reported. The flags after a later
56
+ `$H` are still reported, since the value from outside may start with another program.
57
+
58
+ - [#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
59
+ `onlyBuiltDependencies` already was.
60
+
61
+ - [#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
62
+ `parameters` with `<< parameters.gen >>`, GitLab `spec: inputs` with `$[[ inputs.gen ]]`, and Azure
63
+ Pipelines template `parameters` with `${{ parameters.gen }}`. A parameter's default is renamed, and
64
+ the old flags after or inside such a reference are reported. Each file kind reads only its own
65
+ parameters, and `${{ inputs['flags'] }}` is read like `${{ inputs.flags }}`. Before, the flags
66
+ after these references were kept without a word, and a GitLab input default was renamed while the
67
+ flags after `$[[ inputs.gen ]]` were not.
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)! - When a CI file sets a variable to the generator (GitLab `variables`, Compose `environment`,
70
+ CircleCI `environment`, Task `vars`, Azure `variables`, a workflow `env`), the migration now also
71
+ reads the scripts and other command files that expand it (`$GEN api.yaml -it` in
72
+ `scripts/gen.sh`), even when they name no old package, and reports the old flags after `$GEN`
73
+ there. Before, the variable was renamed and those flags were kept without a word.
74
+
75
+ - [#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
76
+ Dockerfile `CMD ["api.yaml", "-it"]` after `ENTRYPOINT ["openapi-typescript"]` (also from an
77
+ earlier build stage), a Compose, GitLab or CircleCI `command` after an `entrypoint`, and
78
+ Kubernetes `args` after a `command`. Before, the entrypoint got the new name while the command
79
+ kept `-it`, and the container failed with a removed flag. An entrypoint script that may pass its
80
+ arguments on is reported.
81
+
82
+ - [#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
83
+ each option as a value the variable can have. Before, only the value was renamed, so it was no
84
+ longer one of the options and GitLab rejected the pipeline.
85
+
86
+ - [#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
87
+ `template:` names is now migrated as a file of the kind that includes it, whatever its name: its
88
+ `cmds`, `variables`, `$(gen)` macros and inputs are read as there. GitLab `*` and `**` patterns
89
+ are followed, and so are the files that included files include. Before, such a file was read as
90
+ plain YAML, and the report could say there was nothing to migrate.
91
+
92
+ - [#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
93
+ `$(filter-out x,npx openapi-typescript)`, is reported when its arguments name an old package.
94
+ Before, the file was neither changed nor reported ("Nothing to migrate").
95
+
96
+ - [#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
97
+ (`GEN=npx\ openapi-typescript`, `GEN="npx "openapi-typescript`) now gets the new generator name
98
+ too. Before, the flags after `$GEN` were renamed while the value kept `openapi-typescript`, and the
99
+ report said nothing about it.
100
+
101
+ - [#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
102
+ GitHub Actions step `env`, an Azure stage's `variables`) now counts for the commands of that item
103
+ only. Before, it counted for the whole file, so the flags after `$GEN` in another step were
104
+ renamed although `GEN` was not set there.
105
+
106
+ - [#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:
107
+ `cross-env GEN="npx openapi-typescript -it" node gen.js`, `env GEN="…" make` and
108
+ `$(MAKE) -C api GEN="…"` get the new generator name and flags. A one-word value that names an
109
+ old package (`make GEN=openapi-typescript`) is reported. Before, both were left without a word.
110
+
111
+ - [#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
112
+ (`C:\tools\openapi-typescript a.yaml`) is reported, as a POSIX path such as
113
+ `/usr/local/bin/openapi-typescript` already was.
114
+
115
+ - [#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:
116
+ `command: ["sh", "-c", "…"]` in a Compose file, and a Kubernetes `command: ["/bin/sh", "-c"]`
117
+ with the script in `args`. A Compose `entrypoint` list and `command` list, and a Kubernetes
118
+ `command` list and `args` list, are read as one command, and Compose's `$$GEN` is read as the
119
+ service's `$GEN`. Before, the generator and its old flags in these commands were kept without a
120
+ word, or `$GEN` was renamed while the flags after `$$GEN` were not.
121
+
122
+ - [#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
123
+ (`"openapi-fetch": "npm:^0.13.0"`) gets the new version after the same protocol
124
+ (`"openapi-typesafe-fetch": "npm:^1.0.0"`). Before, it kept the old range, which no version of
125
+ the new package matches, and the report asked to fix it by hand.
126
+
3
127
  ## 1.0.0-rc.10
4
128
 
5
129
  ### Patch Changes
package/README.md CHANGED
@@ -45,7 +45,19 @@ 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. A Makefile variable that holds the generator (`OAT :=
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
+ GitHub Docker action's `args` after its `entrypoint` are read the same way, and so are keys that
57
+ a merge key (`<<: *gen`) gives. After an init program or an entrypoint script that runs its
58
+ command (`["tini", "--"]`, `["dumb-init", "--"]`, `["docker-entrypoint.sh"]`), a command that
59
+ runs the generator itself is migrated as its own command. A
60
+ Makefile variable that holds the generator (`OAT :=
49
61
  openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed where it is set,
50
62
  and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
51
63
  of a workflow and the flags after `$GEN` or `${{ env.GEN }}` (also GitLab CI `variables`,
@@ -59,8 +71,16 @@ as a command line where it is written: in a value that just computes
59
71
  (`env_var_or_default("GEN", "npx openapi-typescript")`, an `if`), in a recipe parameter default
60
72
  (`types gen="npx openapi-typescript":`) and in an interpolation; such a value and a parameter (the
61
73
  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
- is renamed where it is set, and the flags after `$GEN` where it runs. Text appended to such a
74
+ script sets itself (`GEN="npx openapi-typescript"`, also after `export`, `local` or `readonly`,
75
+ and written with a backslash or in several quoted parts, `GEN=npx\ openapi-typescript`, which
76
+ is read as the shell reads it; the same holds for a Dockerfile `ENV` value with Docker's escape
77
+ character and for the script of `sh -c` however it is quoted; a flag in quotes, `"-it"`, is
78
+ renamed, and a name or flag that quotes split, `-i't'`, is reported) is renamed where it is set, and the flags after `$GEN` where it
79
+ runs. A command line passed to a program as a variable (`cross-env GEN="npx openapi-typescript
80
+ -it" node gen.js`, `env GEN="…" make`, `$(MAKE) GEN="…"` or `GEN:="…"`) is migrated where it is written. Text
81
+ appended to a variable the file does not set before is the value when it runs the generator
82
+ itself (`H+="npx openapi-typescript"`, a Makefile `GEN += npx openapi-typescript`), so it is
83
+ migrated where it is written. Text appended to such a
64
84
  variable (a Makefile `GEN += --immutable-types`, a shell `G+=" -it"`, a justfile
65
85
  `"npx openapi-typescript" + " -it"`) holds arguments of the program its value runs, so its old
66
86
  flags are renamed where they are written, or reported when the variable may run another program;
@@ -79,7 +99,8 @@ computes (`$(or $(GEN),npx openapi-typescript)`, `$(shell …)`) may run the gen
79
99
  flags after it are reported; the arguments that `$(or …)`, `$(and …)` and `$(if …)` can give, and
80
100
  the text of `$(strip …)`, are read as command lines where they are written, so the old name in
81
101
  them is renamed. A call of any other make function whose arguments name an old package
82
- (`$(firstword npx openapi-typescript)`, `$(call …)`, `$(shell …)`) is reported. A Makefile
102
+ (`$(firstword npx openapi-typescript)`, `$(filter-out …)`, `$(call …)`, `$(shell …)`) is
103
+ reported. A Makefile
83
104
  variable set with `?=` (the environment can override it) or to a value that make computes is
84
105
  reported the same way where it runs. The flags change only when every definition of the variable
85
106
  in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
@@ -93,7 +114,14 @@ flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`, a justfile `{{fla
93
114
  `${{ inputs.flags }}` with an input default `-it`, also as `${{ github.event.inputs.flags }}`,
94
115
  through an `env` value `FL: ${{ inputs.flags }}`, or as a literal in an expression,
95
116
  `${{ inputs.flags || '-it' }}`) may serve other commands too, so it
96
- is reported, not changed. YAML files are changed only in command
117
+ is reported, not changed. A GitLab variable's `options` are values of the variable. A variable map in a list item
118
+ (a step's `env`) reaches only that item. The defaults of CircleCI `parameters`
119
+ (`<< parameters.gen >>`), GitLab `spec: inputs` (`$[[ inputs.gen ]]`) and Azure Pipelines
120
+ `parameters` (`${{ parameters.gen }}`) are read as input defaults are. A file that a Taskfile
121
+ `includes`, a GitLab local `include` (also with `*` and `**`) or an Azure `template` names is read
122
+ as a file of that kind. A variable that a YAML variable map sets to the generator may run it in
123
+ any file the tool reads (a script that a CI job runs), so the flags after `$GEN` there are
124
+ reported. YAML files are changed only in command
97
125
  keys (`run`, `script`, `command`, `entrypoint`, …), in the values of the variable maps above and in input
98
126
  defaults, in block and flow style, never in other values. An anchor that an alias uses under such
99
127
  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 +193,12 @@ The report and the log show a spec with credentials (`git+https://<token>@…`)
165
193
 
166
194
  The report lists each of these with the file and line:
167
195
 
168
- - a version spec it cannot replace (`latest`, a URL, a file, an npm alias), and `overrides` /
196
+ - a version spec it cannot replace (`latest`, a URL, a file, an npm alias of another package;
197
+ Yarn's `npm:^0.13.0` is a range and gets the new version), and `overrides` /
169
198
  `resolutions` and every other package manager setting (`packageExtensions`,
170
- `allowedDeprecatedVersions`, …, in `package.json`, `pnpm-workspace.yaml` or `.yarnrc.yml`,
171
- patches included) that names an old package, except an override that aliases it to its
199
+ `allowedDeprecatedVersions`, bun's `trustedDependencies`, …, in `package.json`,
200
+ `pnpm-workspace.yaml` or `.yarnrc.yml`, patches included) that names an old package, except an
201
+ override that aliases it to its
172
202
  successor (`"openapi-fetch": "npm:openapi-typesafe-fetch@^1.0.0"`), which is the migration done;
173
203
  - a dependency under an old name on a local package (`workspace:*`, `link:`, `file:`, `portal:`),
174
204
  such as a fork in the workspace: it and the imports of it keep the old name, because the new
@@ -179,7 +209,9 @@ The report lists each of these with the file and line:
179
209
  - a patch file of an old package (`patches/openapi-fetch+0.13.0.patch`): the new package has other
180
210
  code, so check whether the fix is still needed;
181
211
  - 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), and a Kubernetes `env` item
212
+ argument of a program it does not know, a script name, a one-word variable passed to a
213
+ program such as `make GEN=openapi-typescript`), a generator installed outside the project
214
+ (`/usr/local/bin/openapi-typescript`, `C:\tools\openapi-typescript`), and a Kubernetes `env` item
183
215
  (`- name: GEN / value: npx openapi-typescript`), which no shell reads: migrate it by hand;
184
216
  - a CI step whose `shell` is another program (`shell: python`), a justfile recipe with a shebang
185
217
  for one, or inline code (`python3 -c '…'`) that names an old package: the tool does not read