Skip to content

Commit d94a46f

Browse files
authored
feat: migrate to jsr (#47)
1 parent 57f5ac8 commit d94a46f

34 files changed

+11754
-11530
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ on: [push, pull_request]
44

55
jobs:
66
deno:
7-
name: deno_cache-${{ matrix.os }}
7+
name: deno_cache_dir-${{ matrix.os }}
88
if: |
99
github.event_name == 'push' ||
1010
!startsWith(github.event.pull_request.head.label, 'denoland:')
1111
runs-on: ${{ matrix.os }}
12+
permissions:
13+
contents: read
14+
id-token: write
1215
timeout-minutes: 30
1316
strategy:
1417
matrix:
1518
os: [macOS-latest, ubuntu-latest, windows-latest]
1619

17-
env:
18-
GH_ACTIONS: 1
19-
2020
steps:
2121
- name: Clone repository
2222
uses: actions/checkout@v4
@@ -53,8 +53,25 @@ jobs:
5353
- name: Cargo publish
5454
if: |
5555
contains(matrix.os, 'ubuntu') &&
56-
github.repository == 'denoland/deno_cache' &&
56+
github.repository == 'denoland/deno_cache_dir' &&
5757
startsWith(github.ref, 'refs/tags/')
5858
env:
5959
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
6060
run: cargo publish -p deno_cache_dir
61+
62+
- name: Get tag version
63+
if: |
64+
contains(matrix.os, 'ubuntu') &&
65+
github.repository == 'denoland/deno_cache_dir' &&
66+
startsWith(github.ref, 'refs/tags/')
67+
id: get_tag_version
68+
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> "$GITHUB_OUTPUT"
69+
70+
- name: Publish
71+
if: |
72+
contains(matrix.os, 'ubuntu') &&
73+
github.repository == 'denoland/deno_cache_dir' &&
74+
startsWith(github.ref, 'refs/tags/')
75+
run: |
76+
deno run -A ./scripts/update_deno_json_version.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
77+
deno publish

Cargo.lock

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

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-2023 the Deno authors
3+
Copyright (c) 2018-2024 the Deno authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# deno_cache
1+
# deno_cache_dir
22

3-
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https://deno.land/x/deno_cache/mod.ts)
4-
[![Build Status - Cirrus][]][Build status] [![Twitter handle][]][Twitter badge]
3+
[![jsr](https://jsr.io/badges/@deno/cache-dir)](https://jsr.io/@deno/cache-dir)
4+
[![Build Status - Cirrus][]][Build status]
55
[![](https://img.shields.io/crates/v/deno_cache_dir.svg)](https://crates.io/crates/deno_cache_dir)
6-
[![Discord Chat](https://img.shields.io/discord/684898665143206084?logo=discord&style=social)](https://discord.gg/deno)
76

87
Implementation of the DENO_DIR/cache for the Deno CLI.
98

109
This is designed to provide access to the cache using the same logic that the
11-
Deno CLI accesses the cache, which allows items like
10+
Deno CLI accesses the cache, which allows projects like
1211
[`deno_graph`](https://deno.land/x/deno_graph),
1312
[`deno_doc`](https://deno.land/x/deno_doc), [`dnt`](https://deno.land/x/dnt),
1413
and [`emit`](https://deno.land/x/deno_emit) to access and populate the cache in
@@ -36,11 +35,16 @@ This can just be granted on startup to avoid being prompted for them.
3635

3736
## Example
3837

38+
```shellsession
39+
> deno add @deno/cache-dir
40+
> deno add @deno/graph
41+
```
42+
3943
Using the cache and the file fetcher to provide modules to build a module graph:
4044

4145
```ts
42-
import { createCache } from "https://deno.land/x/deno_cache/mod.ts";
43-
import { createGraph } from "https://deno.land/x/deno_graph/mod.ts";
46+
import { createCache } from "@deno/cache-dir";
47+
import { createGraph } from "@deno/graph";
4448

4549
// create a cache where the location will be determined environmentally
4650
const cache = createCache();
@@ -54,8 +58,3 @@ const graph = await createGraph("https://deno.land/x/oak@v9.0.1/mod.ts", {
5458
// log out the console a similar output to `deno info` on the command line.
5559
console.log(graph.toString());
5660
```
57-
58-
[Build Status - Cirrus]: https://github.com/denoland/deno_cache/workflows/ci/badge.svg?branch=main&event=push
59-
[Build status]: https://github.com/denoland/deno_cache/actions
60-
[Twitter badge]: https://twitter.com/intent/follow?screen_name=deno_land
61-
[Twitter handle]: https://img.shields.io/twitter/follow/deno_land.svg?style=social&label=Follow

auth_tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
1+
// Copyright 2018-2024 the Deno authors. MIT license.
22

33
interface BearerAuthToken {
44
type: "bearer";

auth_tokens_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
1+
// Copyright 2018-2024 the Deno authors. MIT license.
22

33
import { AuthTokens } from "./auth_tokens.ts";
4-
import { assertEquals } from "./deps_test.ts";
4+
import { assertEquals } from "@std/assert";
55

66
Deno.test({
77
name: "handle undefined token string",

cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
1+
// Copyright 2018-2024 the Deno authors. MIT license.
22

33
import type { LoadResponse } from "./deps.ts";
44
import type { CacheSetting, FileFetcher } from "./file_fetcher.ts";

deno.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@deno/cache-dir",
3+
"version": "0.0.0",
4+
"tasks": {
5+
"test": "deno test --allow-read --allow-write --allow-net --allow-env",
6+
"build": "deno task wasmbuild",
7+
"wasmbuild": "deno run -A jsr:@deno/wasmbuild@0.16.0 --sync --features wasm"
8+
},
9+
"lint": {
10+
"rules": {
11+
"include": [
12+
"no-console"
13+
]
14+
}
15+
},
16+
"exclude": [
17+
"target"
18+
],
19+
"exports": "./mod.ts",
20+
"imports": {
21+
"@deno/graph": "jsr:@deno/graph@^0.69.7",
22+
"@std/assert": "jsr:@std/assert@^0.218.2",
23+
"@std/fmt": "jsr:@std/fmt@^0.218.2",
24+
"@std/fs": "jsr:@std/fs@^0.218.2",
25+
"@std/io": "jsr:@std/io@^0.218.2",
26+
"@std/path": "jsr:@std/path@^0.218.2"
27+
}
28+
}

deno.jsonc

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

deno.lock

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

0 commit comments

Comments
 (0)