0.1.3 • Published 1 year ago

tsc-start v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

tsc-start

Wrapper around tsc --watch, when it sees Found 0 errors in the stdout it starts the target. It also preloads dependencies to speedup a start, but yes, it will not work in some cases, which I'm NOT going to fix.

This package also expects that typescript already installed and there is tsconfig.json in the root of your project.

Install

npm install --save-dev typescript @types/node source-map-support tsc-start

Then you can add scripts entries

{
    "scripts": {
        "dev": "tsc-start build/main.js",
        "inspect": "tsc-start -- --inspect build/main.js"
    }
}

Don't forget about tsconfig.json

{
    "compilerOptions": {
        "target": "ES2020",
        "module": "CommonJS",
        "sourceMap": true,
        "outDir": "./build"
    },
    "include": [
        "src/**/*"
    ]
}

And run it

npm run dev

One-liner Example

mkdir tsc-start-example && cd tsc-start-example && mkdir src && printf '{\n  "scripts": {\n    "dev": "tsc-start build/main.js",\n    "inspect": "tsc-start -- --inspect build/main.js"\n  }\n}\n' > ./package.json && npm install --save-dev typescript @types/node source-map-support tsc-start && printf '{\n    "compilerOptions": {\n        "target": "ES2020",\n        "module": "CommonJS",\n        "sourceMap": true,\n        "outDir": "./build"\n    },\n    "include": [\n        "src/**/*"\n    ]\n}\n' > ./tsconfig.json && printf 'console.log('"'"'hello world'"'"')\n' > ./src/main.ts && npm run dev

Then you can change src/main.ts and see the result

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.3

1 year ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.3

5 years ago

0.0.4

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago