Using windows 8.1 64bit & yarn
I'm trying to create a global module which has typescript files in it & running it on the fly using ts-node (and not convert files to js)
The sample project is at github
I want to run it whenever I execute "gmt" on command line, so I added "bin" in "package.json" and provided appropriate values
And also added shebang "#!/usr/bin/env ts-node" to the main file
But when I execute "gmt" after installing package globally by "yarn global add [directory-path]", I get error:-
C:\Users\gmaster>gmt
C:\Users\gmaster\AppData\Local\Yarn\Data\global\node_modules\gmt\bin\index.ts:6
let term: string = 'guys';
^
SyntaxError: Unexpected token :
at Module._compile (internal/modules/cjs/loader.js:720:23)
at Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\gmaster\AppData\L
ocal\Yarn\Data\global\node_modules\ts-node\src\index.ts:485:14)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
at Object.<anonymous> (C:\Users\gmaster\AppData\Local\Yarn\Data\global\node_
modules\ts-node\src\bin.ts:158:12)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
Am I doing something wrong? Been searching the net for hours.
My aim is to later pass ts filepath to "gmt" so that "gmt" will dynamically import my typescript file and execute something from it using a shared interface-file. But I can't even seem to make the global ts system work, :(
Please help. Also mention if there's a better way to achieve my aim.
Thankyou very much
node version 12.6.0
npm version 6.9.0
yarn version 1.16.0
ts-node version 8.4.1
tsc version 3.6.3
All installed globally