typescriptshelljs

Execute shell commands in typescript


Is there a way to execute commands in Typescript, just like we do in Javascript with Shelljs Library?


Solution

  • You can use any javascript library in typescript, so shelljs should work too.

    Typescript is a so called superset of javascript, which means it adds functionality to the javascript language. Therefore: all valid javascript is valid typescript (but not the other way around).


    Install shelljs:

    npm install --save shelljs
    

    For extra convenience, you can add the @types for shelljs:

    npm install --save @types/shelljs
    

    Maybe you should take a look at Angular Universal, which runs server-side.