openapi-typesafe-migrate 1.0.0-rc.8 → 1.0.0-rc.9

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,51 @@
1
1
  # openapi-typesafe-migrate
2
2
 
3
+ ## 1.0.0-rc.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - A shell default around a GitHub Actions expression (`${GEN:-${{ inputs.gen || 'npx
8
+ openapi-typescript' }}} api.yaml`, also with `:+`, `:=` and in `G=${G:-…}`) is migrated: the old
9
+ name in it is renamed once, and old flags after it are listed as a manual step. Before, the tool
10
+ skipped the whole file with "edits overlap" and exited with `1`. A report whose only findings were
11
+ in such a skipped file no longer also says "Nothing to migrate".
12
+
13
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Old flags in the default of an action or workflow input (`inputs.flags.default: --immutable-types`)
14
+ are listed as a manual step where a command gets them as `${{ inputs.flags }}`, as for an `env`
15
+ value used as `$FLAGS`. Before, they were not reported, and the migrated step failed.
16
+
17
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Old flags in an exported justfile variable are listed as a manual step where a recipe line uses it
18
+ as a shell variable: `export FLAGS := "-it"` used as `$FLAGS`, a parameter `$OPTS="-it"` used as
19
+ `$OPTS`, and every variable with `set export`. Before, only `{{flags}}` was reported, and the
20
+ migrated recipe failed.
21
+
22
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The old generator inside a make function is renamed: `$(or $(GEN),npx openapi-typescript)`,
23
+ `$(if $(GEN),$(GEN),npx openapi-typescript)` and `$(and …)`, in a recipe line or in a variable's
24
+ value. The function may give another program, so old flags after it are still listed as a manual
25
+ step. Before, the old name stayed, and with no flags after it the report said "Nothing to migrate".
26
+
27
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The migration keeps the old flags after a variable whose program is decided when the job runs,
28
+ and lists them as a manual step: a workflow `env` set by an expression
29
+ (`GEN: ${{ vars.GEN || 'npx openapi-typescript' }}` or `GEN: ${{ vars.GEN }}`, used as `$GEN`), a
30
+ Makefile `GEN ?= npx openapi-typescript`, which the environment can override, and a Makefile value
31
+ that make computes (`GEN := $(or $(X),npx openapi-typescript)`). Before, the flags after `$GEN`
32
+ were renamed without a word, or kept without a word, though `$GEN` may run another program.
33
+
34
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - A `transform` that returns an array of a one-member union (`createArrayTypeNode(
35
+ createUnionTypeNode([DATE_OR_NULL]))`, where `DATE_OR_NULL` is `Date | null`) is rewritten to
36
+ `"(Date | null)[]"`. Before, the parentheses were lost and the type text was `"Date | null[]"`, a
37
+ different type that still compiled.
38
+
39
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - The generator bin written with a Windows suffix is migrated: `openapi-typescript.cmd`,
40
+ `openapi-typescript.ps1`, `openapi-typescript.exe` and `node_modules\.bin\openapi-typescript.cmd`
41
+ become the same names of `openapi-typesafe`, and the old flags after them are renamed. Before, they
42
+ were neither changed nor reported, so the script called a bin that the migration had removed.
43
+
44
+ - [#116](https://github.com/openapi-typesafe/openapi-typesafe/pull/116) [`600dd3a`](https://github.com/openapi-typesafe/openapi-typesafe/commit/600dd3afd7148146a4ec06c9400dae98a17ef3e1) Thanks [@fedorello](https://github.com/fedorello)! - Commands that a YAML anchor shares are migrated where they are written, when an alias uses them
45
+ under a command key: a GitLab `.gen_scripts: &gen_scripts` list used as
46
+ `script: [*gen_scripts]`, an anchored `env` map, a Taskfile command. Before, such a file was
47
+ neither changed nor reported ("Nothing to migrate"), and the job kept running the old generator.
48
+
3
49
  ## 1.0.0-rc.8
4
50
 
5
51
  ### Patch Changes
package/README.md CHANGED
@@ -36,7 +36,8 @@ scripts, Task's `Taskfile.yml` (`cmds`, `cmd`, `sh`, `status`, `defer`, `precond
36
36
  pre-commit hooks (`entry` with its `args`), and the `simple-git-hooks`, `lint-staged`,
37
37
  `nx.targets` and wireit `command` commands of a manifest, also in `.lintstagedrc*` and `.simple-git-hooks.json`. The
38
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
39
+ `dotenvx run`, `nx exec`, `tsx`, `timeout`, `xargs`, …), and under its Windows names
40
+ (`openapi-typescript.cmd`, `.ps1`, `.exe`, `node_modules\.bin\openapi-typescript.cmd`). A here-document is data, except the one a
40
41
  shell runs (`bash <<EOF`, `cat <<EOF | sh`). They are read word by word, the way the shell splits
41
42
  them (quotes, `\` line continuations, comments, `&&`, `|`,
42
43
  `sh -c "…"`, and the commands inside `if`, `while`, `for` and `{ … }`), so only the generator's
@@ -48,7 +49,8 @@ openapi-typescript`, also for some targets only, and `GEN := $(OAT)`) is renamed
48
49
  and the flags after `$(OAT)` (or `$G` for a one-letter name) where it runs; so is an `env` variable
49
50
  of a workflow and the flags after `$GEN` or `${{ env.GEN }}`, and a Dockerfile `ARG` or `ENV`
50
51
  variable and the flags after `$GEN`, and a justfile variable (`gen := "npx openapi-typescript"`)
51
- and the flags after `{{gen}}`. In a justfile every string and backtick of an expression is read
52
+ and the flags after `{{gen}}` (or `$gen`, when `export`, a `$gen` parameter or `set export` gives
53
+ it to the recipe's shell). In a justfile every string and backtick of an expression is read
52
54
  as a command line where it is written: in a value that just computes
53
55
  (`env_var_or_default("GEN", "npx openapi-typescript")`, an `if`), in a recipe parameter default
54
56
  (`types gen="npx openapi-typescript":`) and in an interpolation; such a value and a parameter (the
@@ -62,20 +64,26 @@ of a GitHub Actions expression (`${{ inputs.gen || 'npx openapi-typescript' }}`)
62
64
  puts into the script before the shell runs, and for the default of an input
63
65
  (`inputs.command.default` of an `action.yml`, `workflow_call` and `workflow_dispatch` inputs):
64
66
  the old name in them is renamed, and the flags after an expression are reported, because its value
65
- comes from the run. A Makefile program that make computes (`$(or $(GEN),npx
66
- openapi-typescript)`, `$(shell …)`) may run the generator too, so the flags after it are
67
- reported. The flags change only when every definition of the variable
67
+ comes from the run; so are the flags after a variable that an expression sets
68
+ (`GEN: ${{ vars.GEN || 'npx openapi-typescript' }}`, then `$GEN`). A Makefile program that make
69
+ computes (`$(or $(GEN),npx openapi-typescript)`, `$(shell …)`) may run the generator too, so the
70
+ flags after it are reported; the arguments that `$(or …)`, `$(and …)` and `$(if …)` can give are
71
+ read as command lines where they are written, so the old name in them is renamed. A Makefile
72
+ variable set with `?=` (the environment can override it) or to a value that make computes is
73
+ reported the same way where it runs. The flags change only when every definition of the variable
68
74
  in the file sets it to the generator: a variable that another Dockerfile stage, a step `env` or a
69
75
  later Makefile line or shell assignment sets to another program is reported with its old flags. So is a
70
76
  variable that runs a command but that no definition the tool reads sets: one set by another
71
77
  `script` item or step (`echo "GEN=…" >> "$GITHUB_ENV"`), a Makefile recipe's `$$GEN`, a bash
72
78
  array (`GEN=(npx openapi-typescript)`, whose items are renamed, run as `"${GEN[@]}"`), or one
73
79
  set outside the file. A variable of old
74
- flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`, or a justfile `{{flags}}` with
75
- `flags := '-it'` or a recipe parameter `*flags='-it'`) may serve other commands too, so it
80
+ flags that the generator gets (`$(FLAGS)` with `FLAGS := -it`, a justfile `{{flags}}` with
81
+ `flags := '-it'` or a recipe parameter `*flags='-it'`, an exported justfile `$FLAGS`, or
82
+ `${{ inputs.flags }}` with an input default `-it`) may serve other commands too, so it
76
83
  is reported, not changed. YAML files are changed only in command
77
84
  keys (`run`, `script`, `command`, `entrypoint`, …), in the values of `env` and in input
78
- defaults, in block and flow style, never in other values. A CI step whose `shell` is another program (`shell: python`) runs
85
+ defaults, in block and flow style, never in other values. An anchor that an alias uses under such
86
+ 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
79
87
  code of that language, so its script is not changed, and it is reported when it names an old
80
88
  package. The nearest `shell` counts: the step's own, then the job's and the workflow's
81
89
  `defaults.run.shell` (GitHub Actions), or the job's `shell` and then the `shell` of the