Skip to content

Commit 53ddfef

Browse files
authored
v0.5.5: Finish the migration to jsr.io (#21)
* v0.5.5: Finish the migration to jsr.io * More tweak
1 parent dd2c922 commit 53ddfef

File tree

17 files changed

+196
-104
lines changed

17 files changed

+196
-104
lines changed

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../lib/README.md

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33

4-
- package-ecosystem: "github-actions"
5-
directory: "/"
4+
- package-ecosystem: github-actions
5+
directory: /
66
schedule:
7-
interval: "weekly"
7+
interval: monthly

.github/workflows/deno-ci.yaml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [ main ]
66
pull_request: {}
77

8+
permissions:
9+
contents: read
810
jobs:
911

1012
check:
@@ -13,10 +15,12 @@ jobs:
1315
strategy:
1416
matrix:
1517
deno-version:
16-
- v1.41
17-
- v1.43
18-
- v1.45
1918
- v2.0
19+
- v2.1
20+
- v2.2
21+
- v2.3
22+
- v2.4
23+
- v2.5
2024
- canary
2125
fail-fast: false # run each branch to completion
2226

@@ -29,14 +33,14 @@ jobs:
2933
with:
3034
deno-version: ${{ matrix.deno-version }}
3135

32-
# "https" cache: code from the Internet
33-
# External sources won't change much so we use less precise keys
34-
- name: Cache https://
36+
- name: Cache Deno deps
3537
uses: actions/cache@v4
3638
with:
37-
path: ~/.cache/deno/deps/https
38-
key: deno-https/v1-${{ github.sha }}
39-
restore-keys: deno-https/v1-
39+
path: ~/.cache/deno
40+
key: denodir/${{ matrix.deno-version }}-${{ hashFiles('deno.lock') }}
41+
42+
- name: Possibly reset lockfile
43+
run: deno install || rm deno.lock
4044

4145
- name: Check generation/mod.ts
4246
run: time deno check generation/mod.ts
@@ -53,7 +57,7 @@ jobs:
5357
- name: Test
5458
run: time deno test
5559

56-
audit-lib:
60+
check-publish-lib:
5761
runs-on: ubuntu-latest
5862
name: Audit ./lib
5963

@@ -64,6 +68,37 @@ jobs:
6468
- name: Use latest Deno
6569
uses: denoland/setup-deno@v2
6670

71+
- name: Cache Deno deps
72+
uses: actions/cache@v4
73+
with:
74+
path: ~/.cache/deno
75+
key: denodir-${{ hashFiles('deno.lock') }}
76+
6777
- name: Check publish rules
6878
working-directory: lib
69-
run: ../with-jsr-deps.sh deno publish --dry-run --allow-dirty
79+
run: deno publish --dry-run --allow-dirty
80+
81+
publish-lib:
82+
runs-on: ubuntu-latest
83+
name: Publish ./lib
84+
needs:
85+
- check
86+
- check-publish-lib
87+
if: github.event_name == 'push'
88+
89+
permissions:
90+
contents: read
91+
id-token: write
92+
93+
steps:
94+
- uses: denoland/setup-deno@v2
95+
- uses: actions/checkout@v5
96+
97+
- name: Cache Deno deps
98+
uses: actions/cache@v4
99+
with:
100+
path: ~/.cache/deno
101+
key: denodir-${{ hashFiles('deno.lock') }}
102+
103+
- name: Publish now
104+
run: deno publish

.github/workflows/jsr-publish-lib.yaml

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

deno.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"workspace": [
3+
"generation",
4+
"lib"
5+
]
6+
}

deno.lock

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

README.md renamed to generation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
![Deno CI](https://github.com/danopia/deno-kubernetes_apis/workflows/CI/badge.svg?branch=main)
1+
[![CI](https://github.com/cloudydeno/kubernetes-apis/actions/workflows/deno-ci.yaml/badge.svg)](https://github.com/cloudydeno/kubernetes-apis/actions/workflows/deno-ci.yaml)
22

3-
# `/x/kubernetes_apis`
3+
# `@cloudydeno/kubernetes-apis`
44

55
NOTE: This README is about code generation concepts.
66

generation/codegen.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { path } from "./deps.ts";
1+
import { join as joinPath } from "@std/path/join";
22
import { generateModuleTypescript } from "./codegen-mod.ts";
33
import { generateStructsTypescript } from "./codegen-structs.ts";
44
import { SurfaceApi, SurfaceMap } from "./describe-surface.ts";
55

66
export async function writeApiModule(surface: SurfaceMap, api: SurfaceApi, category: string, apisModuleRoot?: string) {
7-
const modRoot = path.join('lib', category, api.moduleName);
7+
const modRoot = joinPath('lib', category, api.moduleName);
88

99
function postProcess(text: string) {
1010
if (apisModuleRoot) {
@@ -22,13 +22,13 @@ export async function writeApiModule(surface: SurfaceMap, api: SurfaceApi, categ
2222

2323
await Deno.mkdir(modRoot, {recursive: true});
2424

25-
await Deno.writeTextFile(path.join(modRoot, 'structs.ts'),
25+
await Deno.writeTextFile(joinPath(modRoot, 'structs.ts'),
2626
postProcess(generateStructsTypescript(surface, api)));
27-
console.log('Wrote', path.join(modRoot, 'structs.ts'));
27+
console.log('Wrote', joinPath(modRoot, 'structs.ts'));
2828

2929
if (api.operations.length > 0) {
30-
await Deno.writeTextFile(path.join(modRoot, 'mod.ts'),
30+
await Deno.writeTextFile(joinPath(modRoot, 'mod.ts'),
3131
postProcess(generateModuleTypescript(surface, api)));
32-
console.log('Wrote', path.join(modRoot, 'mod.ts'));
32+
console.log('Wrote', joinPath(modRoot, 'mod.ts'));
3333
}
3434
}

generation/deno.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"imports": {
3+
"@cloudydeno/kubernetes-client": "jsr:@cloudydeno/kubernetes-client@^0.7",
4+
"@std/path": "jsr:@std/path@^1",
5+
"@std/yaml": "jsr:@std/yaml@^1"
6+
}
7+
}

generation/deps.ts

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

0 commit comments

Comments
 (0)