-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dependency maintenance; rewrote build in typescript; added first shor…
…t-form run functions
- Loading branch information
Showing
14 changed files
with
196 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env -S deno run --quiet --allow-run | ||
|
||
import * as proc from "./mod.ts"; | ||
import { dirname } from "./runners/utility.ts"; | ||
|
||
async function findAllTypescriptFiles(): Promise<string[]> { | ||
return await proc.run0Sa( | ||
{ cmd: ["find", dirname(import.meta), "-name", "*.ts"] }, | ||
); | ||
} | ||
|
||
async function updateDependencies(): Promise<void> { | ||
await proc.run00({ cmd: ["udd", ...(await findAllTypescriptFiles())] }); | ||
} | ||
|
||
async function format(): Promise<void> { | ||
await proc.run00({ cmd: ["deno", "fmt", dirname(import.meta)] }); | ||
|
||
/* Fix breaks to legacy shebang caused by deno formatter. */ | ||
await proc.run00( | ||
{ | ||
cmd: [ | ||
"sed", | ||
"-i", | ||
'2s|^":";\\s[/][/]#;|":" //#;|', | ||
...(await findAllTypescriptFiles()), | ||
], | ||
}, | ||
); | ||
} | ||
|
||
async function lint(): Promise<void> { | ||
await proc.run00({ cmd: ["deno", "lint", dirname(import.meta)] }); | ||
} | ||
|
||
async function test(): Promise<void> { | ||
await proc.run00({ | ||
cmd: ["deno", "test", "--allow-run", "--reload", dirname(import.meta)], | ||
}); | ||
} | ||
|
||
await updateDependencies(); | ||
await format(); | ||
await lint(); | ||
await test(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "https://deno.land/std@0.125.0/testing/asserts.ts"; | ||
export * from "https://deno.land/std@0.126.0/testing/asserts.ts"; | ||
export * from "https://deno.land/x/[email protected]/mod.ts"; | ||
export * from "https://deno.land/std@0.125.0/fmt/colors.ts"; | ||
export * from "https://deno.land/std@0.126.0/fmt/colors.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "https://deno.land/std@0.125.0/textproto/mod.ts"; | ||
export * from "https://deno.land/std@0.125.0/async/mod.ts"; | ||
export * from "https://deno.land/std@0.125.0/io/mod.ts"; | ||
export * from "https://deno.land/std@0.126.0/textproto/mod.ts"; | ||
export * from "https://deno.land/std@0.126.0/async/mod.ts"; | ||
export * from "https://deno.land/std@0.126.0/io/mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import { Answer, Question } from "./common-json-defs.ts"; | ||
import * as proc from "../../mod.ts"; | ||
import { asynciter } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { blue, red } from "https://deno.land/std@0.125.0/fmt/colors.ts"; | ||
import { blue, red } from "https://deno.land/std@0.126.0/fmt/colors.ts"; | ||
|
||
/** | ||
* This demonstrates sending objects to and receiving objects from a child process | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env -S deno run --quiet --allow-run | ||
|
||
import * as proc from "./mod.ts"; | ||
import { dirname } from "./runners/utility.ts"; | ||
|
||
const here = dirname(import.meta); | ||
|
||
proc.run00({ | ||
cmd: [ | ||
"bash", | ||
"--login", | ||
"-c", | ||
` | ||
set -e | ||
cd "${here}/examples/warandpeace" && ( | ||
set -x | ||
time ./countwords.sh < ./warandpeace.txt.gz | ||
time ./countwords.ts < ./warandpeace.txt.gz | ||
time ./countwords2.ts < ./warandpeace.txt.gz | ||
echo "a b c d" | ./countwords2.ts || true | ||
time ./countwords3.ts < ./warandpeace.txt.gz | ||
echo "a b c d" | ./countwords3.ts || true | ||
) | ||
cd "${here}/examples/pushiterable" && ( | ||
PATH=".:$PATH" ./example-of-pushiterable.ts | ||
) | ||
cd "${here}/examples/sounds" && ( | ||
./sounds.ts | ||
) | ||
`, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { BufReader, BufWriter } from "../deps.ts"; | ||
import * as path from "https://deno.land/[email protected]/path/mod.ts"; | ||
|
||
export const DEFAULT_BUFFER_SIZE = 4096; | ||
|
||
|
@@ -207,3 +208,11 @@ export async function sleep(delayms: number): Promise<void> { | |
setTimeout(() => resolve(), delayms) | ||
); | ||
} | ||
|
||
export function filename(meta: { url: string }): string { | ||
return path.fromFileUrl(meta.url); | ||
} | ||
|
||
export function dirname(meta: { url: string }): string { | ||
return path.dirname(filename(meta)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters