{"id":23773465,"url":"https://github.com/beenotung/live-tsc","last_synced_at":"2025-06-12T00:34:43.956Z","repository":{"id":65247804,"uuid":"586145044","full_name":"beenotung/live-tsc","owner":"beenotung","description":"A lightweight esbuild-based implementation of tsc that trim off the types (without type checking)","archived":false,"fork":false,"pushed_at":"2023-01-27T20:33:03.000Z","size":57,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-03T04:48:18.511Z","etag":null,"topics":["cli","esbuild","lightweight","skip-typechecking","trimming","typescript","watcher"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/live-tsc?activeTab=readme","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-07T04:56:12.000Z","updated_at":"2023-08-06T00:34:47.000Z","dependencies_parsed_at":"2023-02-15T12:31:33.402Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/live-tsc","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/beenotung/live-tsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flive-tsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flive-tsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flive-tsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flive-tsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/live-tsc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flive-tsc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259371188,"owners_count":22847532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","esbuild","lightweight","skip-typechecking","trimming","typescript","watcher"],"created_at":"2025-01-01T05:40:32.603Z","updated_at":"2025-06-12T00:34:43.933Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# live-tsc\n\nA lightweight esbuild-based implementation of tsc that trim off the types (without type checking)\n\nIntended to be used by [ts-liveview](https://github.com/beenotung/ts-liveview) but it should be generic enough as an alternative to \"tsc --watch\"\n\n[![npm Package Version](https://img.shields.io/npm/v/live-tsc)](https://www.npmjs.com/package/live-tsc)\n\n## Installation\n\n```bash\nnpm i -D live-tsc\n```\n\n## Command Line Usage\n\nUsage Example:\n\n```bash\nnpx live-tsc \\\n  --watch \\\n  --src     ./ \\\n  --dest    ./dist \\\n  --exclude ./scripts \\\n  --exclude ./public \\\n  --exclude ./data \\\n  --exclude ./db/data \\\n  --post-hook \"npx fix-esm-import-path dist/db/proxy.js\" \\\n  --server  ./dist/server/index.js \\\n  --open \"https://localhost:8100\"\n```\n\nOptions:\n\n```\n  --src \u003cdir|file\u003e\n    Specify the source directory/file\n    Alias: -s\n\n  --dest \u003cdir|file\u003e\n    Specify the destination directory/file\n    Alias: -d\n\n  --exclude \u003cdir|file\u003e\n    Specify the path to be excluded;\n    Can be specified multiple times;\n    The destination directory is excluded by default\n    Alias: -e\n\n  --project \u003cfile\u003e\n    Specify the path of tsconfig file\n    Alias: -p\n    Default: tsconfig.json\n\n  --watch\n    Watch for changes and rerun\n    Alias: -w\n\n  --format \u003ccjs|esm|iife\u003e\n    Sets the output format for the generated JavaScript files\n    Alias: -f\n    Default: esm\n\n  --post-hook \u003ccommand\u003e[#watch:\u003cfile1[,file2]\u003e]\n    Add command to run after initial scan and subsequence updates;\n    If the watch files are specified, the hook will be re-run only if the specified files are changed,\n    otherwise the hook will observe the source files;\n    Can be specified multiple times;\n\n  --post-script \u003cnpm script\u003e[#watch:\u003cfile1[,file2]\u003e]\n    Add npm script to run after initial scan and subsequence updates;\n    This is a shortcut as: --post-hook \"npm run \u003cscript\u003e\";\n    Details refers to \"--post-hook\"\n\n  --server \u003cfile\u003e\n    Specify the path of server js file\n\n  --cwd \u003cdir\u003e\n    Specify the current working directory for the server and postHooks\n    Alias: -c\n    Default: sample as process.cwd\n\n  --open \u003curl\u003e\n    Open the url in the default browser after initial scanning\n    Alias: -o\n\n  --help\n    Show help message\n    Alias: -h\n```\n\n## Why skip type checking?\n\nThis tool is intended to be used by the development server (potentially behind nodemon)\n\nRunning tsc on slow machine can takes some time.\n\nDevelopers can get type checking error messages from the editor in realtime, so skipping type check on the build-flow should speed up iteration cycle without compromise.\n\nIt is a waste to do type checking twice in the cli build watcher and editor's language server.\n\n## Speed Comparison\n\nTested with ts-liveview v5\n\n### Environments\n\n**Env [1]**:\n\n- archlinux Desktop\n- btrfs on HDD\n\n**Env [2]**:\n\n- Mac mini (2014)\n- 2.6 GHz Dual-Core Intel i5\n- Macintosh HD (1TB SATA Disk)\n\n**Env [3]**:\n\n- Kudu3 laptop\n- archlinux\n- 6th Gen 2.6 GHz 4 Core Intel i7\n- zfs on top of lvm\n\n### Run Type\n\n**Fresh Build**:\nRemoved the outDir before run\n\n**Incremental Build**:\nKeep the outDir from previous run\n\n### Comparison\n\n| Env | Tool     | Fresh Build | Incremental Build | Improvement |\n| --- | -------- | ----------- | ----------------- | ----------- |\n| [1] | tsc      | ?           | 4.3s              | ?           |\n| [1] | live-tsc | ?           | 0.1s              | ?           |\n| [2] | tsc      | 11.2s       | 2.8s              | 4x          |\n| [2] | live-tsc | 0.36s       | 0.22s             | 1.6x        |\n| [3] | tsc      | 3.2s        | 1.9s              | 1.6x        |\n| [3] | live-tsc | 0.152s      | 0.148s            | 1.02        |\n\n| Env | Fresh bulid Speedup Rate | Incremtntal Build Speedup Rate |\n| --- | ------------------------ | ------------------------------ |\n| [2] | 31x                      | 12x                            |\n| [3] | 21x                      | 12x                            |\n\nThe time used is the average of multiple runs. In practice, the cold-start run time of fresh build is much longer if the Typescript files are not already cached by the OS.\n\nYou can run the speed test on your machine by running `npx ts-node src/test/measure-speed.ts`\n\n## Todo\n\nThe watch mode seems not working on mac mini, maybe use polling as fallback.\n\n## License\n\nThis project is licensed with [BSD-2-Clause](./LICENSE)\n\nThis is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):\n\n- The freedom to run the program as you wish, for any purpose\n- The freedom to study how the program works, and change it so it does your computing as you wish\n- The freedom to redistribute copies so you can help others\n- The freedom to distribute copies of your modified versions to others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Flive-tsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Flive-tsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Flive-tsc/lists"}