Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/db-developer/rollup-plugin-yatsc
yet another rollup plugin for typescript
https://github.com/db-developer/rollup-plugin-yatsc
Last synced: 2 days ago
JSON representation
yet another rollup plugin for typescript
- Host: GitHub
- URL: https://github.com/db-developer/rollup-plugin-yatsc
- Owner: db-developer
- License: mit
- Created: 2019-05-22T17:44:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T12:56:54.000Z (over 5 years ago)
- Last Synced: 2024-06-18T12:29:32.565Z (7 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-yatsc
Yet another [Rollup](https://github.com/rollup/rollup) plugin for transpiling Typescript.
This project is a fork of [rollup-plugin-tsc](https://github.com/tsne/rollup-plugin-tsc) v 1.1.15 (MIT).
Thanks to tsne (Thomas Nitsche) for the work on his project on which the adjustments for this plugin are based.rollup-plugin-yatsc aims to be callable by grunt and provides the option to pass in tsconfig by pojo as well as by filename.
## Installation
```
npm install --save-dev rollup-plugin-yatsc
```## Usage
```javascript
// rollup.config.js
import yatsc from "rollup-plugin-yatsc";export pojodefault {
input: "src/main.ts",plugins: [
yatsc({
// put your tsconfig here
}),
]
};export filedefault {
input: "src/main.ts",plugins: [
yatsc("build/tsconfig.es5.json"),
]
};
```
To configure the Typescript compiler, a [tsconfig](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) has to be passed to the plugin. This can either be by providing a plain old javascript object or by specifying a `path/to/tsconfig.json`.```javascript
// gruntfile.js
const yatsc = require( "rollup-plugin-yatsc" );module.exports = function( grunt ) {
let pkgjson = grunt.file.readJSON( "package.json" );
let scope = pkgjson.name.slice( 0, pkgjson.name.indexOf("/")).replace( "@", "" );
let pkgname = pkgjson.name.slice( pkgjson.name.indexOf("/") + 1 );
let pkglobl = scope ? `${ scope }.${ pkgname }` : pkgname;grunt.initConfig({
rollup: {
esm5: {
src : "build/public-api.ts",
dest : `dist/${ pkgname }/esm5/${ pkglobl }.js`,
options: {
plugins : [ yatsc( `${ BUILD }/tsconfig.esm5.json` )],
name : `${ pkglobl }`,
format : "esm",
sourcemap : "inline"
}
}
}, // ...
});grunt.loadNpmTasks( "grunt-rollup" );
grunt.registerTask( "default", [ "rollup" ]);
};```