Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: pnpm lint

- name: Generate openapi types
run: pnpm gen:type
run: pnpm gen

- name: Build
run: pnpm build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Generate openapi types
run: pnpm gen:type
run: pnpm gen

- name: Build
run: pnpm build
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
jq
nodejs_24
pnpm
];
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"build": "tsdown",
"test": "vitest",
"gen:type": "openapi-typescript ./public.json -o ./gen/unsplash.d.ts",
"gen:alias": "jq --raw-output -f scripts/gen-alias.jq < public.json > ./gen/aliases.d.ts",
"gen": "pnpm gen:type && pnpm gen:alias",
"lint": "oxlint",
"format": "oxfmt",
"typecheck": "tsc",
Expand Down
4 changes: 4 additions & 0 deletions scripts/gen-alias.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"import { components } from \"./unsplash.d.ts\";",
(.components.schemas
| keys[]
| "export type \(. | sub("\\."; ""; "g")) = components[\"schemas\"][\"\(.)\"];")
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import createFetchClient, { type ClientOptions, type Client } from "openapi-fetch";
import type { paths } from "../gen/unsplash.d.ts"; // generated by openapi-typescript
export type { paths } from "../gen/unsplash.d.ts"; // generated by openapi-typescript
export type { paths, components } from "../gen/unsplash.d.ts"; // generated by openapi-typescript
export type * from "../gen/aliases.d.ts";
export type * from "openapi-fetch";
export { trackNonHotLinkedPhotoView } from "./beacon.ts";

Expand Down
Loading