1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-02-19 04:49:42 +00:00

Added bin

Allow to execute ts-node (npm link)
This commit is contained in:
Darkimage
2021-11-04 12:44:46 +01:00
parent b2497865a1
commit 278e73c319
3 changed files with 4705 additions and 12 deletions

18
bin/destreamer Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env node
/* tslint:disable */
// check if we're running in dev mode
var devMode = require('fs').existsSync(`${__dirname}/../src`);
// or want to "force" running the compiled version with --compiled-build
var wantsCompiled = process.argv.indexOf('--compiled-build') >= 0;
if (wantsCompiled || !devMode) {
// this runs from the compiled javascript source
require(`${__dirname}/../build/src/destreamer`).run(process.argv);
} else {
// this runs from the typescript source (for dev only)
// hook into ts-node so we can run typescript on the fly
require('ts-node').register({ project: `${__dirname}/../tsconfig.json` });
// run the CLI with the current process arguments
require(`${__dirname}/../src/destreamer`).run(process.argv);
}