Skip to content

Commit 1e16376

Browse files
authored
Chore: support JSR (#284)
1 parent 0cb1040 commit 1e16376

29 files changed

+2589
-88
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Deno
2525
uses: denoland/setup-deno@v1
2626
with:
27-
deno-version: ${{ matrix.deno == 'old' && '1.37.2' || (matrix.deno == 'stable' && '1.x' || matrix.deno) }}
27+
deno-version: ${{ matrix.deno == 'old' && '1.40.0' || (matrix.deno == 'stable' && '1.x' || matrix.deno) }}
2828

2929
- run: deno --version
3030

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ contains the `denoland/deployctl` GitHub Action.
66
## Install
77

88
```shell
9-
deno install -qArf https://deno.land/x/deploy/deployctl.ts
9+
deno install -Arf jsr:@deno/deployctl
1010
```
1111

1212
## Usage

deno.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"name": "@deno/deployctl",
3+
"version": "1.11.0",
4+
"exports": "./deployctl.ts",
25
"fmt": {
36
"files": {
47
"exclude": ["action/node_modules/"]
@@ -13,5 +16,6 @@
1316
"test": "deno test -A --unstable tests/ src/",
1417
"build-action": "deno bundle ./src/utils/mod.ts > ./action/deps.js",
1518
"version-match": "deno run --allow-read --allow-env ./tools/version_match.ts"
16-
}
19+
},
20+
"importMap": "./import_map.json"
1721
}

deno.lock

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

deployctl.ts

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

33
// Copyright 2021 Deno Land Inc. All rights reserved. MIT license.
44

5-
import { semverGreaterThanOrEquals, setColorEnabled } from "./deps.ts";
5+
import {
6+
semverGreaterThanOrEquals,
7+
semverParse,
8+
setColorEnabled,
9+
} from "./deps.ts";
610
import { Args, parseArgs } from "./src/args.ts";
711
import { error } from "./src/error.ts";
812
import deploySubcommand from "./src/subcommands/deploy.ts";
@@ -36,7 +40,12 @@ For more detailed help on each subcommand, use:
3640
deployctl <SUBCOMMAND> -h
3741
`;
3842

39-
if (!semverGreaterThanOrEquals(Deno.version.deno, MINIMUM_DENO_VERSION)) {
43+
if (
44+
!semverGreaterThanOrEquals(
45+
semverParse(Deno.version.deno),
46+
semverParse(MINIMUM_DENO_VERSION),
47+
)
48+
) {
4049
error(
4150
`The Deno version you are using is too old. Please update to Deno ${MINIMUM_DENO_VERSION} or later. To do this run \`deno upgrade\`.`,
4251
);
@@ -76,7 +85,10 @@ if (isTerminal(Deno.stdin)) {
7685
// If latestVersion is set we need to inform the user about a new release.
7786
if (
7887
latestVersion &&
79-
!(semverGreaterThanOrEquals(VERSION, latestVersion.toString()))
88+
!(semverGreaterThanOrEquals(
89+
semverParse(VERSION),
90+
semverParse(latestVersion.toString()),
91+
))
8092
) {
8193
console.error(
8294
[

deps.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export {
1313
relative,
1414
resolve,
1515
toFileUrl,
16-
} from "https://deno.land/std@0.170.0/path/mod.ts";
16+
} from "jsr:@std/path@0.217";
1717
export {
1818
bold,
1919
cyan,
@@ -23,18 +23,19 @@ export {
2323
setColorEnabled,
2424
stripColor,
2525
yellow,
26-
} from "https://deno.land/std@0.170.0/fmt/colors.ts";
27-
export { parse } from "https://deno.land/std@0.195.0/flags/mod.ts";
28-
export { TextLineStream } from "https://deno.land/std@0.170.0/streams/text_line_stream.ts";
29-
export * as JSONC from "https://deno.land/std@0.170.0/encoding/jsonc.ts";
30-
export { encodeHex } from "https://deno.land/std@0.212.0/encoding/hex.ts";
31-
export { delay } from "https://deno.land/std@0.212.0/async/mod.ts";
26+
} from "jsr:@std/fmt@0.217/colors";
27+
export { parse } from "jsr:@std/flags@0.217";
28+
export { TextLineStream } from "jsr:@std/streams@0.217/text_line_stream";
29+
export * as JSONC from "jsr:@std/jsonc@0.217";
30+
export { encodeHex } from "jsr:@std/encoding@0.217/hex";
31+
export { delay } from "jsr:@std/async@0.217";
3232

3333
// x/semver
3434
export {
35-
gte as semverGreaterThanOrEquals,
36-
valid as semverValid,
37-
} from "https://deno.land/[email protected]/semver/mod.ts";
35+
canParse as semverValid,
36+
greaterOrEqual as semverGreaterThanOrEquals,
37+
parse as semverParse,
38+
} from "jsr:@std/[email protected]";
3839

3940
// x/wait
4041
export {

import_map.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"imports": {
3+
"https://deno.land/": "./vendor/deno.land/",
4+
"https://raw.githubusercontent.com/denosaurs/wait/453df8babdd72c59d865c5a616c5b04ee1154b9f/": "./vendor/wait-deprecated-warnings-pr-head/"
5+
}
6+
}

src/subcommands/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The following example will fail because main.ts is not included:
5757
The entrypoint can also be a remote script. A common use case for this is to deploy an static site
5858
using std/http/file_server.ts (more details in https://docs.deno.com/deploy/tutorials/static-site ):
5959
60-
deployctl deploy --entrypoint=https://deno.land/[email protected]/http/file_server.ts
60+
deployctl deploy --entrypoint=jsr:@std/http/file_server
6161
6262
6363
USAGE:

src/subcommands/logs_test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { parseArgsForLogSubcommand } from "./logs.ts";
2-
import {
3-
assertEquals,
4-
assertThrows,
5-
} from "https://deno.land/[email protected]/testing/asserts.ts";
2+
import { assertEquals, assertThrows } from "jsr:@std/[email protected]";
63
import { parseArgs } from "../args.ts";
74

85
Deno.test("parseArgsForLogSubcommand", async (t) => {

src/subcommands/upgrade.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Copyright 2021 Deno Land Inc. All rights reserved. MIT license.
22

33
import { error } from "../error.ts";
4-
import { semverGreaterThanOrEquals, semverValid } from "../../deps.ts";
4+
import {
5+
semverGreaterThanOrEquals,
6+
semverParse,
7+
semverValid,
8+
} from "../../deps.ts";
59
import { VERSION } from "../version.ts";
610

711
const help = `deployctl upgrade
@@ -56,7 +60,10 @@ export default async function (rawArgs: Record<string, any>): Promise<void> {
5660
);
5761
}
5862

59-
if (!version && semverGreaterThanOrEquals(VERSION, latest)) {
63+
if (
64+
!version &&
65+
semverGreaterThanOrEquals(semverParse(VERSION), semverParse(latest))
66+
) {
6067
console.log("You're using the latest version.");
6168
Deno.exit();
6269
} else {

0 commit comments

Comments
 (0)