@jakesidsmith/tsb
Version:
Dead simple TypeScript bundler, watcher, dev server, transpiler, and polyfiller
47 lines • 1.88 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const dotenv_1 = __importDefault(require("dotenv"));
dotenv_1.default.config();
const jargs_1 = require("jargs");
const constants_1 = require("./constants");
const build_1 = __importDefault(require("./commands/build"));
const watch_1 = __importDefault(require("./commands/watch"));
const serve_1 = __importDefault(require("./commands/serve"));
const COMMON_ARGS = [
(0, jargs_1.KWArg)('config', {
alias: 'c',
description: `Path to ${constants_1.PROGRAM}.config.ts`,
}),
];
(0, jargs_1.collect)((0, jargs_1.Help)('help', {
description: 'Display help and usage info',
}, (0, jargs_1.Program)(constants_1.PROGRAM, {
description: constants_1.DESCRIPTION,
usage: `${constants_1.PROGRAM} <command>`,
examples: [
`${constants_1.PROGRAM} build`,
`${constants_1.PROGRAM} watch`,
`${constants_1.PROGRAM} serve`,
`${constants_1.PROGRAM} build --config custom/path/to/tsb.config.ts`,
],
}, (0, jargs_1.RequireAny)((0, jargs_1.Command)('build', {
description: 'Bundle TypeScript files (production)',
callback: (tree) => {
(0, build_1.default)(tree.kwargs.config);
},
}, ...COMMON_ARGS), (0, jargs_1.Command)('watch', {
description: 'Watch TypeScript files and bundle them when changed (development)',
callback: (tree) => {
(0, watch_1.default)(tree.kwargs.config);
},
}, ...COMMON_ARGS), (0, jargs_1.Command)('serve', {
description: 'Run a dev server and update on change (development)',
callback: (tree) => {
(0, serve_1.default)(tree.kwargs.config);
},
}, ...COMMON_ARGS)))), process.argv);
//# sourceMappingURL=cli.js.map