Skip to content

Commit 14f81c7

Browse files
authored
feat(setRaw): Remove the need for unstable flag by upgrading dependencies and min deno version (#13)
upgrade dependencies
1 parent 7e12267 commit 14f81c7

File tree

10 files changed

+234
-29
lines changed

10 files changed

+234
-29
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"deno.enable": true,
33
"deno.lint": true,
4-
"deno.unstable": true,
54
"deno.suggest.imports.hosts": {
65
"https://deno.land": true
76
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
### Install
1515

1616
```
17-
deno install -f --unstable --allow-run --allow-net https://deno.land/x/dkill@0.7.0/cli.ts
17+
deno install -f --allow-run --allow-net https://deno.land/x/dkill@0.7.0/cli.ts
1818
```
1919

2020
You can then use it using command `dkill`

cli.test.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deno.test("killing by pid", async () => {
88

99
// call dkill
1010
const pDkill = Deno.run({
11-
cmd: ["deno", "run", "-A", "--unstable", "./cli.ts", `${pTest.pid}`],
11+
cmd: ["deno", "run", "-A", "./cli.ts", `${pTest.pid}`],
1212
});
1313
// wait dkill finishes
1414
await pDkill.status();
@@ -22,28 +22,37 @@ Deno.test("killing by pid", async () => {
2222

2323
assertNotEquals(status.code, 0);
2424
});
25-
Deno.test("killing by port", async () => {
25+
Deno.test("killing by ports", async () => {
2626
// create a webserver
27-
const pTest = Deno.run({
28-
cmd: ["deno", "run", "-A", "--unstable", "./src/tests/utils.ts"],
27+
const pTest1 = Deno.run({
28+
cmd: ["deno", "run", "-A", "./src/tests/utils.ts"],
29+
});
30+
const pTest2 = Deno.run({
31+
cmd: ["deno", "run", "-A", "./src/tests/utils.ts", "8081"],
2932
});
3033

34+
3135
// give time fo the webserver to start and the port be discoverable
3236
await delay(5000);
3337

3438
// call dkill
3539
const pDkill = Deno.run({
36-
cmd: ["deno", "run", "-A", "--unstable", "./cli.ts", ":8080"],
40+
cmd: ["deno", "run", "-A", "./cli.ts", ":8080", ":8081"],
3741
});
3842
// wait dkill finishes
3943
await pDkill.status();
4044

4145
// retrieve status from test pid
42-
const status = await pTest.status();
46+
const status1 = await pTest1.status();
47+
const status2 = await pTest2.status();
4348

4449
// close resources
45-
pTest.close();
50+
pTest1.close();
51+
pTest2.close();
52+
4653
pDkill.close();
4754

48-
assertNotEquals(status.code, 0);
55+
assertNotEquals(status1.code, 0);
56+
assertNotEquals(status2.code, 0);
57+
4958
});

cli.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { yellow } from "https://deno.land/std@0.118.0/fmt/colors.ts";
21
import { Checkbox, Command } from "./deps.ts";
32
import { dkill } from "./mod.ts";
43
import { procList } from "./src/procList.ts";
@@ -7,8 +6,8 @@ import { assertMinVersion } from "./src/utils/versions.ts";
76

87
import vJson from "./version.json" assert { type: "json" };
98

10-
// check minimum version of deno 1.17.0
11-
const minVRequired = "1.17.0";
9+
// check minimum version of deno
10+
const minVRequired = "1.29.1";
1211
if (!assertMinVersion(Deno.version.deno, minVRequired)) {
1312
console.error(`Please upgrade deno. min version required: ${minVRequired}`);
1413
Deno.exit(1);
@@ -25,7 +24,7 @@ await new Command()
2524
2625
You can specify multiple targets at once: 'dkill node.exe :5000 :3000 164'`,
2726
)
28-
.arguments("<targets...>")
27+
.arguments("<...targets>")
2928
.option("-i, --interactive", "Interactive mode", {
3029
standalone: true,
3130
})
@@ -42,7 +41,7 @@ await new Command()
4241
},
4342
)
4443
.action(
45-
async (opts, targets) => {
44+
async (opts, ...targets) => {
4645
if (opts.upgrade) {
4746
// upgrading version.
4847
await upgrader({
@@ -58,11 +57,6 @@ await new Command()
5857
const procs: string[] = [];
5958

6059
if (opts.interactive) {
61-
if (Deno.build.os === "windows") {
62-
console.warn(
63-
yellow("** ON windows you cannot navigate up/down. use filter ** "),
64-
);
65-
}
6660
// list processes
6761
const pList = await procList();
6862
const pickedProcesses: string[] = await Checkbox.prompt({

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"tasks": {
33
"test": "deno test --allow-run --allow-net",
4-
"dev": "deno run --unstable --allow-run --allow-net ./cli.ts",
4+
"dev": "deno run --allow-run --allow-net ./cli.ts",
55
"release": "deno run -A https://deno.land/x/release_up@0.5.0/cli.ts --regex \"(?<=@)(.*)(?=\/cli)\" --github --versionFile --changelog"
66
}
77
}

deno.lock

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

deps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { Command } from "https://deno.land/x/cliffy@v0.24.2/command/mod.ts";
2-
export { Checkbox } from "https://deno.land/x/cliffy@v0.24.2/prompt/mod.ts";
1+
export { Command } from "https://deno.land/x/cliffy@v0.25.6/command/mod.ts";
2+
export { Checkbox } from "https://deno.land/x/cliffy@v0.25.6/prompt/mod.ts";

deps_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export {
22
assert,
33
assertNotEquals,
4-
} from "https://deno.land/std@0.138.0/testing/asserts.ts";
5-
export { delay } from "https://deno.land/std@0.138.0/async/mod.ts";
6-
export { serve } from "https://deno.land/std@0.138.0/http/server.ts";
4+
} from "https://deno.land/std@0.170.0/testing/asserts.ts";
5+
export { delay } from "https://deno.land/std@0.170.0/async/mod.ts";
6+
export { serve } from "https://deno.land/std@0.170.0/http/server.ts";

src/tests/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
import { serve } from "../../deps_test.ts";
55

6-
const port = 8080;
6+
const rawPort : string | number = Deno.args[0] ?? 8080;
7+
const port = Number(rawPort)
78

89
const handler = (request: Request): Response => {
910
let body = "Your user-agent is:\n\n";
@@ -12,5 +13,5 @@ const handler = (request: Request): Response => {
1213
return new Response(body, { status: 200 });
1314
};
1415

15-
console.log(`HTTP webserver running. Access it at: http://localhost:8080/`);
16+
console.log(`HTTP webserver running. Access it at: http://localhost:${port}/`);
1617
await serve(handler, { port });

version.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// experimental used by upgrader
33
// deno-fmt-ignore
44
export const denoFlags = [
5-
"--unstable",
65
"--allow-run",
76
"--allow-net"
87
];

0 commit comments

Comments
 (0)