Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umijs/sylvanas
Convert TypeScript to JavaScript
https://github.com/umijs/sylvanas
Last synced: 6 days ago
JSON representation
Convert TypeScript to JavaScript
- Host: GitHub
- URL: https://github.com/umijs/sylvanas
- Owner: umijs
- Created: 2019-05-31T07:00:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-05T02:06:41.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T11:36:41.735Z (21 days ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 45
- Watchers: 5
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sylvanas
A tool to convert TypeScript to JavaScript with human-like code style.
## How to use
```bash
npm install --save-dev sylvanas
```### sylvanas(files: string[], option?: Option)
```js
const sylvanas = require('sylvanas');const files = glob.sync('**/*.@(ts|tsx)');
const fileList = sylvanas(files);
fileList.forEach(({ data }) => {
console.log('Trans:', data);
});
```### Option
#### cwd - string
The current working directory in which to search. Defaults to `process.cwd()`.
#### action - `none` | `write` | `overwrite`
Default `none`. Set what will Sylvanas do with files:
- `write`: Write new file with name of suffix `.js` or `.jsx`.
- `overwrite`: Like `write` but will remove origin files.#### outDir - string
Set the write file folder. Defaults to `cwd`.
#### decoratorsBeforeExport - boolean
Same as [babel decoratorsbeforeexport](https://babeljs.io/docs/en/babel-plugin-proposal-decorators#decoratorsbeforeexport).