Files
commafeed-podcasts/bs/dev/paths.js
T
2026-05-22 15:56:44 +02:00

45 lines
926 B
JavaScript
Executable File

#!/bin/env node
import tsconfig from "../../tsconfig.json" with { type: "json" };
export const paths = {
/** code source */
src: "src",
/** code processed by tsc */
tscoutput: tsconfig.compilerOptions.outDir,
/** code processed by tsc and rollup */
dist: "dist",
/** tempral results of tsc, tests, … */
tmp: ".tmp",
};
export default paths;
import { argv, exit } from "node:process";
import { fileURLToPath } from "node:url";
const [ _, script ] = argv;
if (script === fileURLToPath(import.meta.url))
main(argv.slice(2));
function main(args) {
if(args.includes("--help") || args.includes("-h")){
console.log(`
Usage: ${script} [options]
Options:
[type] … if omitted, echo all
`);
exit(0);
}
if(args.length === 0){
console.log(paths);
exit(0);
}
for(const arg of args){
const path = paths[arg];
if(!path){
console.error(`Unknown path: ${arg}`);
exit(1);
}
console.log(path);
}
}