-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2999775
Showing
6 changed files
with
1,426 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# tsup | ||
|
||
A bundler focusing on TypeScript experience, based on Rollup. | ||
|
||
## Install | ||
|
||
Install it locally in your project folder: | ||
|
||
```bash | ||
npm i tsup -D | ||
# Or Yarn | ||
yarn add tsup --dev | ||
``` | ||
|
||
You can also install it globally but it's not recommended. | ||
|
||
## License | ||
|
||
MIT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "tsup", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "EGOIST", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^13.9.2", | ||
"cac": "^6.5.7", | ||
"rollup": "^2.1.0", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"ts-node": "^8.7.0" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.8.7", | ||
"@babel/preset-env": "^7.8.7", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-hashbang": "^2.2.2", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
import { readFileSync } from 'fs' | ||
import {join} from 'path' | ||
import { cac } from 'cac' | ||
|
||
const cli = cac('tsup') | ||
|
||
cli.command('[file]', 'Bundle a speific file') | ||
.option('--format <format>', 'Bundle format') | ||
.action(async (file: string, options) => { | ||
const {rollup} = await import('rollup') | ||
|
||
return rollup({ | ||
input: file, | ||
plugins: [ | ||
require('rollup-plugin-hashbang')(), | ||
require('rollup-plugin-babel')({ | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
presets: [ | ||
[require.resolve('@babel/preset-env'), { | ||
modules: false | ||
}], | ||
require.resolve('@babel/preset-typescript') | ||
] | ||
}) | ||
] | ||
}).then(result => { | ||
result.write({ | ||
dir: 'dist', | ||
format: options.format || 'cjs' | ||
}) | ||
}) | ||
}) | ||
|
||
cli.help() | ||
|
||
const pkgPath = join(__dirname, '../package.json') | ||
cli.version(JSON.parse(readFileSync(pkgPath, 'utf8')).version) | ||
|
||
cli.parse() |
Empty file.
Oops, something went wrong.