Skip to content

Commit

Permalink
Start preparing jsr publication of client lib
Browse files Browse the repository at this point in the history
  • Loading branch information
danopia committed Sep 18, 2024
1 parent 47558c3 commit e864e88
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 11 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/deno-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
strategy:
matrix:
deno-version:
- v1.28
- v1.32
- v1.36
- v1.41
- v1.43
- v1.45
- canary
fail-fast: false # run each branch to completion

Expand Down Expand Up @@ -51,3 +51,20 @@ jobs:

- name: Test
run: time deno test

audit-lib:
runs-on: ubuntu-latest
name: Audit ./lib

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Use Deno v1
uses: denoland/setup-deno@v1
with:
deno-version: v1

- name: Check publish rules
working-directory: lib
run: ../with-jsr-deps.sh deno publish --dry-run --allow-dirty
25 changes: 25 additions & 0 deletions .github/workflows/jsr-publish-lib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
push:
branches:
- main
paths:
- lib/jsr.json

jobs:
publish:
runs-on: ubuntu-latest
name: Publish ./lib

permissions:
contents: read
id-token: write

steps:
- uses: denoland/setup-deno@v1

- uses: actions/checkout@v4

- name: Publish to JSR
working-directory: lib
run: ../with-jsr-deps.sh deno publish --allow-dirty
16 changes: 9 additions & 7 deletions lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
// All the generated code uses this centralized API contract,
// while users are free to pass in a different compatible client to actually call

import { toStatus } from './builtin/meta@v1/structs.ts';
import {
ApiKind,
JSONObject, JSONValue,
JSONObject,
JSONValue,
RequestOptions,
} from "https://deno.land/x/[email protected]/lib/contract.ts";

export * from "https://deno.land/x/[email protected]/lib/contract.ts";
toStatus,
} from "./deps.ts";
export {
WatchEventTransformer
} from "https://deno.land/x/[email protected]/lib/stream-transformers.ts";
type RestClient,
type JSONValue,
type ApiKind,
WatchEventTransformer,
} from "./deps.ts";

// Helpers used to validate/transform structures from or for the wire
// And some other stuff :)
Expand Down
9 changes: 8 additions & 1 deletion lib/client.ts → lib/deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// This file is just the entire matching kubernetes_client version.
// kubernetes_apis itself only depends on specific files,
// so this is provided an optional utility (as opposed to deps.ts)
// so this is provided an optional utility

export * from "https://deno.land/x/[email protected]/mod.ts";
export * as tunnelBeta from "https://deno.land/x/[email protected]/tunnel-beta/via-websocket.ts";

export { toStatus } from './builtin/meta@v1/structs.ts';

export * from "https://deno.land/x/[email protected]/lib/contract.ts";
export {
WatchEventTransformer
} from "https://deno.land/x/[email protected]/lib/stream-transformers.ts";
Empty file added lib/deps_jsr.ts
Empty file.
14 changes: 14 additions & 0 deletions with-jsr-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
set -ux

mv deps.ts deps_https.ts
mv deps_jsr.ts deps.ts
undo () {
ARG=$?
mv deps.ts deps_jsr.ts
mv deps_https.ts deps.ts
exit $ARG
}
trap undo EXIT

"$@"

0 comments on commit e864e88

Please sign in to comment.