Closed evil-shrike closed 9 years ago
You can use npm scripts for that, it'll use the locally installed version of TypeScript.
@ivogabe thanks! It's a nice article and elegant solution. The only problem that tsc doesn't support globing/wildcards:
"scripts": {
"ts": "tsc --module amd --sourceMap src/lib/*.ts"
},
so I have to collect files on my own:
"ts": "dir src\\*.ts /b /s > ts-files.txt && tsc --module amd --sourceMap @ts-files.txt"
Hi. I've seen in most examples that
typescript
npm-package is considered to be installed globally and we can just runtsc
. That's nice but I'd like to keep more safe approach and install thetypescript
package locally (on project level). But in such a case I'll losetcs
command availability. I'd suggest to use Grunt's approach - to have two packagestypescript
(with compiler and node API) andtypescript-cli
(with CLI tools).typescript
will be installed locally andtypescript-cli
will be installed globally.typescript-cli
would providetsc
command which would look for a local typescript first and run it via its api (require).Then we could have:
running
tcs
in project1 will run ts-1.4 (local), in project2 - ts-1.5b (global).What do you think?