-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: vendor
asserts
from Deno stdlib
Allow modules to import https://deno.land/std@0.177.0/testing/asserts.ts This is a temporary workaround until we implement proper support for ES modules, see #43. Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
- Loading branch information
Showing
3 changed files
with
857 additions
and
15 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,28 @@ | ||
// Run this Deno script to fetch and store Deno modules | ||
// This is a temporary workaround until we support module imports | ||
// See https://github.com/filecoin-station/zinnia/issues/43 | ||
// | ||
// Run this script using the following command: | ||
// deno --allow-all runtime/vendor.js | ||
|
||
import { fromFileUrl } from "https://deno.land/std@0.177.0/path/mod.ts"; | ||
|
||
await vendor( | ||
"https://deno.land/std@0.177.0/testing/asserts.ts", | ||
"asserts.bundle.js", | ||
); | ||
|
||
async function vendor(url, outfile) { | ||
const outpath = fromFileUrl(import.meta.resolve(`./vendored/${outfile}`)); | ||
const cmd = ["deno", "bundle", url, "--", outpath]; | ||
const child = Deno.run({ cmd }); | ||
const status = await child.status(); | ||
child.close(); | ||
if (!status.success) { | ||
const reason = status.code | ||
? `code ${status.code}` | ||
: `signal ${status.signal}`; | ||
|
||
throw new Error(`Process failed with ${reason}: ${cmd}`); | ||
} | ||
} |
Oops, something went wrong.