Skip to content

Commit

Permalink
mk: --loader => --import
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Jan 13, 2024
1 parent 1b9a3b2 commit 8d7e9b6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions mk/literate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ literate_run() {
pushd $1 >/dev/null
FILE=README.md
fi
export TS_CONFIG_PATH=$ROOTDIR/mk/tsconfig-literate.json
node --loader $ROOTDIR/mk/loader.mjs $FILE
node --import $ROOTDIR/mk/loader-import.mjs $FILE
popd >/dev/null
}

Expand Down
5 changes: 5 additions & 0 deletions mk/loader-import.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { register } from "node:module";
import { fileURLToPath } from "node:url";

process.env.TS_CONFIG_PATH = fileURLToPath(new URL("tsconfig-literate.json", import.meta.url));
register(new URL("loader.mjs", import.meta.url));
2 changes: 1 addition & 1 deletion packages/autoconfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ console.log("fastest face is", `${fastestFace}`);
// By default, default route "/" is added to the face, so that you can send Interests right away.
try {
const t0 = Date.now();
const data = await new Endpoint({ fw }).consume(`/ndn/edu/ucla/ping/${Math.trunc(Math.random() * 1e8)}`);
const data = await new Endpoint({ fw }).consume(`/ndn/edu/memphis/ping/${Math.trunc(Math.random() * 1e8)}`);
console.log("Interest satisfied", `${data.name}`, `${Date.now() - t0}ms`);
} catch (err: unknown) {
console.warn(err);
Expand Down
3 changes: 1 addition & 2 deletions packages/cat/ndncat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash
PKGDIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"
export TS_CONFIG_PATH=$(readlink -f ${PKGDIR}/../../mk/tsconfig-literate.json)
node --loader ${PKGDIR}/../../mk/loader.mjs ${PKGDIR}/lib/main_node.js "$@"
node --import ${PKGDIR}/../../mk/loader-import.mjs ${PKGDIR}/lib/main_node.js "$@"
3 changes: 1 addition & 2 deletions packages/keychain-cli/ndnts-keychain.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash
PKGDIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"
export TS_CONFIG_PATH=$(readlink -f ${PKGDIR}/../../mk/tsconfig-literate.json)
node --loader ${PKGDIR}/../../mk/loader.mjs ${PKGDIR}/lib/main_node.js "$@"
node --import ${PKGDIR}/../../mk/loader-import.mjs ${PKGDIR}/lib/main_node.js "$@"
3 changes: 1 addition & 2 deletions packages/repo-cli/ndnts-repo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash
PKGDIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"
export TS_CONFIG_PATH=$(readlink -f ${PKGDIR}/../../mk/tsconfig-literate.json)
node --loader ${PKGDIR}/../../mk/loader.mjs ${PKGDIR}/lib/main_node.js "$@"
node --import ${PKGDIR}/../../mk/loader-import.mjs ${PKGDIR}/lib/main_node.js "$@"

0 comments on commit 8d7e9b6

Please sign in to comment.