Skip to content

Commit b33fc4a

Browse files
refactor: migrate to dynamic-openapi-tools
Remove duplicated parser/, auth/, and utils/ modules and consume them from dynamic-openapi-tools@^1.0.0. Replace the inlined bundle renderer with a thin wrapper around the shared buildBundle helper. Drop tests that were migrated into the tools package. Regenerate examples/petstore-cli from the new binary.
1 parent f33ccce commit b33fc4a

30 files changed

Lines changed: 93 additions & 2592 deletions

examples/petstore-cli

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Generator: dynamic-openapi-cli
44
# CLI name: petstore-cli
55
# Version: 1.0.0
6+
# Description: Petstore Mini
67
# Spec source: test/fixtures/petstore-mini.yaml
78
# Spec MD5: bb864f7025e1408ccdc00f11f5c0e8bb
89
# Spec: embedded as base64-encoded JSON (dereferenced OpenAPI v3)
@@ -76,7 +77,7 @@ if [[ "${1:-}" == "install" ]]; then
7677
-h|--help)
7778
printf 'Usage: %s install [--dir <path>] [--copy] [--force]\n' "$CLI_NAME"
7879
printf '\n'
79-
printf 'Installs this CLI into a directory on your PATH.\n'
80+
printf 'Installs this binary into a directory on your PATH.\n'
8081
printf '\n'
8182
printf 'Options:\n'
8283
printf ' --dir <path> Target directory (default: \$XDG_BIN_HOME or \$HOME/.local/bin)\n'
@@ -125,7 +126,7 @@ if [[ "${1:-}" == "install" ]]; then
125126
printf >&2 '\n'
126127
printf >&2 ' Then run: exec $SHELL (or open a new terminal)\n'
127128
else
128-
printf >&2 ' Run: %s --help\n' "$CLI_NAME"
129+
printf >&2 ' Run: %s --help\n' "$LINK"
129130
fi
130131
exit 0
131132
fi
@@ -162,12 +163,12 @@ if [[ "${1:-}" == "uninstall" ]]; then
162163
if [[ -L "$LINK" ]]; then
163164
RESOLVED="$(readlink "$LINK" 2>/dev/null || true)"
164165
if [[ "$RESOLVED" != "$SELF" ]]; then
165-
printf >&2 '%s uninstall: %s is a symlink to %s, not to this CLI. Pass --force to remove anyway.\n' \
166+
printf >&2 '%s uninstall: %s is a symlink to %s, not to this binary. Pass --force to remove anyway.\n' \
166167
"$CLI_NAME" "$LINK" "$RESOLVED"
167168
exit 1
168169
fi
169170
elif ! cmp -s "$LINK" "$SELF"; then
170-
printf >&2 '%s uninstall: %s differs from this CLI. Pass --force to remove anyway.\n' "$CLI_NAME" "$LINK"
171+
printf >&2 '%s uninstall: %s differs from this binary. Pass --force to remove anyway.\n' "$CLI_NAME" "$LINK"
171172
exit 1
172173
fi
173174
fi
@@ -187,10 +188,10 @@ if [[ "${1:-}" == "update" ]]; then
187188
-h|--help)
188189
printf 'Usage: %s update [--spec <url|file>] [--app-version <version>]\n' "$CLI_NAME"
189190
printf '\n'
190-
printf 'Re-fetches the original spec and rewrites this CLI in-place.\n'
191+
printf 'Re-fetches the original spec and rewrites this binary in-place.\n'
191192
printf '\n'
192193
printf 'By default, the new CLI_VERSION tracks the spec.info.version of the freshly\n'
193-
printf 'fetched spec — the bundled version is a snapshot of the API, not of the CLI.\n'
194+
printf 'fetched spec — the bundled version is a snapshot of the API, not of the binary.\n'
194195
printf '\n'
195196
printf 'Options:\n'
196197
printf ' --spec <url|file> Use a different spec source (default: the one baked in at bundle time)\n'
@@ -233,7 +234,7 @@ if [[ "${1:-}" == "update" ]]; then
233234
UPDATE_SOURCE="${UPDATE_SPEC:-$SPEC_SOURCE}"
234235

235236
if [[ -z "$UPDATE_SOURCE" ]]; then
236-
printf >&2 '%s update: this CLI was bundled from an inline spec — no remote source to refresh.\n' "$CLI_NAME"
237+
printf >&2 '%s update: this binary was bundled from an inline spec — no remote source to refresh.\n' "$CLI_NAME"
237238
printf >&2 ' Pass --spec <url|file> to update, or re-run "dynamic-openapi-cli bundle" manually.\n'
238239
exit 1
239240
fi
@@ -262,7 +263,7 @@ if [[ "${1:-}" == "update" ]]; then
262263
--name "$CLI_NAME" \
263264
"${VERSION_ARGS[@]}" \
264265
--out "$TMP"; then
265-
printf >&2 '%s update: bundle failed, CLI not modified.\n' "$CLI_NAME"
266+
printf >&2 '%s update: bundle failed, binary not modified.\n' "$CLI_NAME"
266267
exit 1
267268
fi
268269

@@ -318,7 +319,7 @@ done
318319
if [[ -n "$SPEC_OVERRIDE" ]]; then
319320
SPEC_FILE="$SPEC_OVERRIDE"
320321
else
321-
SPEC_FILE="$(mktemp -t "${CLI_NAME}.XXXXXX.json")"
322+
SPEC_FILE="$(mktemp -t "$CLI_NAME.XXXXXX.json")"
322323
trap 'rm -f "$SPEC_FILE"' EXIT
323324
printf '%s' "$SPEC_B64" | base64 -d > "$SPEC_FILE"
324325
fi
@@ -327,7 +328,4 @@ RUNNER_STR="$(_resolve_runner)" || exit $?
327328
read -r -a RUNNER <<< "$RUNNER_STR"
328329

329330
exec "${RUNNER[@]}" \
330-
--spec "$SPEC_FILE" \
331-
--name "$CLI_NAME" \
332-
--app-version "$CLI_VERSION" \
333-
"${PASSTHROUGH[@]}"
331+
--spec "$SPEC_FILE" --name "$CLI_NAME" --app-version "$CLI_VERSION" "${PASSTHROUGH[@]}"

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535
],
3636
"license": "MIT",
3737
"dependencies": {
38-
"@readme/openapi-parser": "^4.1.0",
3938
"cli-args-parser": "^1.0.6",
40-
"openapi-types": "^12.1.3",
41-
"yaml": "^2.7.0"
39+
"dynamic-openapi-tools": "^1.0.0",
40+
"openapi-types": "^12.1.3"
4241
},
4342
"devDependencies": {
4443
"@types/node": "^25.2.2",
4544
"@vitest/coverage-v8": "^3.2.4",
4645
"tsup": "^8.4.0",
4746
"typescript": "^5.7.3",
48-
"vitest": "^3.0.5"
47+
"vitest": "^3.0.5",
48+
"yaml": "^2.7.0"
4949
}
5050
}

pnpm-lock.yaml

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/auth/resolver.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)