Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/songkeys/tswc
Compile your TypeScript with tsconfig.json using swc
https://github.com/songkeys/tswc
Last synced: about 2 months ago
JSON representation
Compile your TypeScript with tsconfig.json using swc
- Host: GitHub
- URL: https://github.com/songkeys/tswc
- Owner: songkeys
- License: mit
- Created: 2021-08-20T11:21:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T03:53:56.000Z (over 1 year ago)
- Last Synced: 2024-10-04T13:44:16.882Z (3 months ago)
- Language: JavaScript
- Size: 260 KB
- Stars: 16
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tswc
[![NPM version](https://img.shields.io/npm/v/tswc.svg?style=flat)](https://npmjs.org/package/tswc)
[![NPM downloads](https://img.shields.io/npm/dm/tswc.svg?style=flat)](https://npmjs.org/package/tswc)Compile your TypeScript with tsconfig.json using [swc](https://swc.rs)
## Install
```bash
npm install tswc @swc/core -D
# Or Yarn
yarn add tswc @swc/core --dev
```## Usage
Just change `swc [...options]` to `tswc -- [options]`. That's it! Your `tsconfig.json` file will be respected.
For example:
```bash
# Transpile one file and emit to stdout.
# swc FILE
tswc -- FILE# Transpile one file and emit to `output.js`.
# swc FILE -o output.js
tswc -- FILE -o output.js# Transpile and write output to dir
# swc DIR -d dir
tswc -- DIR -d dir
```See more about how to use [swc cli](https://swc.rs/docs/usage-swc-cli).
You can change your build script in "package.json" as:
```json
"build": "tswc -- src -D dist",
```Now you can run `npm run build` to build.
## Notice
Only a subgroup of fields of tsconfig is supported currently. This is done with [tsconfig-to-swcconfig](https://github.com/Songkeys/tsconfig-to-swcconfig). This means that some tsc features may be missing when compiling with this.
If you want to know what swc config is exactly used, you can use `--debug` to inspect:
```bash
tswc --debug -- [other options...]
```## Advanced Options
```
Options:
--tsconfig the filename of tsconfig (default: tsconfig.json)
--debug output the final swc config (default: false)
-h, --help Display this message
-v, --version Display version number
```