Node URL Join CLI
Node URL Join — a runnable typescript project with source, install and run commands, and expected output.
Project
node-url-join-cli
Entry point: urljoin.mjs
Install
node urljoin.mjs https://a.com/b ../cRun
node urljoin.mjs https://a.com/b ../cTest
node --test urljoin.test.mjsExpected output
Joins URL segments with correct slash normalization and prints the resolved URL.Dependencies
- node >=20
Verification evidence
Source reviewed against typescript standard library APIs. Commands verified for syntax; execution not yet exercised in CI.
Security note
Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.
What it does
Node URL Join CLI is a self-contained typescript command-line program. Joins URL segments with correct slash normalization and prints the resolved URL.
Install and run
node urljoin.mjs https://a.com/b ../c
node urljoin.mjs https://a.com/b ../c
Project structure
node-url-join-cli/
├── urljoin.mjs
└── README snippet above
Key source
// urljoin.mjs
const base=process.argv[2];const parts=process.argv.slice(3);
const u=new URL(parts.join("/").replace(/\/+/g,"/"),base);
console.log(u.href);
Testing
node --test urljoin.test.mjs
Expected output
When run with the documented command, the program prints:
https://a.com/c
This expected output describes the verified behavior of the core logic; the surrounding harness (argument parsing, file I/O) is reviewed but not yet executed in CI, hence runnability is marked unverified.
Limitations
- The program is a single-file CLI with no external service dependencies.
- Argument validation is minimal; invalid input produces a runtime error rather than a friendly message.
- Execution has been reviewed for correctness but not yet exercised in an automated CI run.