Skip to content

Commit 3c0c2ab

Browse files
authored
switch to Deno.Command and bump the minimum supported Deno version to 1.28.3(#154)
1 parent a668c80 commit 3c0c2ab

File tree

4 files changed

+16
-24
lines changed

4 files changed

+16
-24
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.20.1' || (matrix.deno == 'stable' && '1.x' || matrix.deno) }}
27+
deno-version: ${{ matrix.deno == 'old' && '1.28.3' || (matrix.deno == 'stable' && '1.x' || matrix.deno) }}
2828

2929
- run: deno --version
3030

src/subcommands/upgrade.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ export default async function (rawArgs: Record<string, any>): Promise<void> {
6060
console.log("You're using the latest version.");
6161
Deno.exit();
6262
} else {
63-
// deno-lint-ignore no-deprecated-deno-api
64-
const process = Deno.run({
65-
cmd: [
66-
Deno.execPath(),
63+
const process = new Deno.Command(Deno.execPath(), {
64+
args: [
6765
"install",
6866
"--allow-read",
6967
"--allow-write",
@@ -74,8 +72,8 @@ export default async function (rawArgs: Record<string, any>): Promise<void> {
7472
"-f",
7573
`https://deno.land/x/deploy@${version ? version : latest}/deployctl.ts`,
7674
],
77-
});
78-
await process.status();
75+
}).spawn();
76+
await process.status;
7977
}
8078
}
8179

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const VERSION = "1.6.0";
22

3-
export const MINIMUM_DENO_VERSION = "1.20.0";
3+
export const MINIMUM_DENO_VERSION = "1.28.3";

tests/utils.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function deployctl(
1515
env: true,
1616
run: true,
1717
},
18-
): Deno.Process {
18+
): Deno.ChildProcess {
1919
const deno = [
2020
Deno.execPath(),
2121
"run",
@@ -34,13 +34,12 @@ export function deployctl(
3434
? ["bash", "-c", [...deno, ...args].join(" ")]
3535
: [...deno, ...args];
3636

37-
// deno-lint-ignore no-deprecated-deno-api
38-
return Deno.run({
39-
cmd,
37+
return new Deno.Command(cmd[0], {
38+
args: cmd.slice(1),
4039
stdin: "null",
4140
stdout: "piped",
4241
stderr: "piped",
43-
});
42+
}).spawn();
4443
}
4544

4645
export interface TestOptions {
@@ -51,26 +50,21 @@ export interface TestOptions {
5150

5251
export function test(
5352
opts: TestOptions,
54-
fn: (proc: Deno.Process) => void | Promise<void>,
53+
fn: (proc: Deno.ChildProcess) => void | Promise<void>,
5554
) {
5655
const name = opts.name ?? ["deployctl", ...opts.args].join(" ");
5756
Deno.test(name, async () => {
5857
const proc = deployctl(opts.args, opts.permissions);
59-
try {
60-
await fn(proc);
61-
} finally {
62-
proc.close();
63-
}
58+
await fn(proc);
6459
});
6560
}
6661

6762
export async function output(
68-
proc: Deno.Process,
69-
): Promise<[string, string, Deno.ProcessStatus]> {
70-
const [status, stdout, stderr] = await Promise.all([
71-
proc.status(),
63+
proc: Deno.ChildProcess,
64+
): Promise<[string, string, Deno.CommandStatus]> {
65+
const [status, { stdout, stderr }] = await Promise.all([
66+
proc.status,
7267
proc.output(),
73-
proc.stderrOutput(),
7468
]);
7569
return [
7670
new TextDecoder().decode(stdout),

0 commit comments

Comments
 (0)