roll-up.js
v0.0.3
Published
Quick CLI to scaffold rollup + types setup in an existing project
Readme
roll-up
Turning a pure JS package to typed project is annoying, roll-up handles the annoying part.
A CLI tool that transforms a pure JavaScript project with JSDocs into a typed project using Rollup.
Usage
Setup a project :
yarn init -yIn that project: Run
npx roll-up.js --pkg <npm|pnpm|yarn>to initialize the project with Rollup configuration, TypeScript setup, and necessary dependencies. or install globallynpm i -g roll-up.jsusage:roll-up -hWrite source code: Create your JavaScript files in the
src/directory with JSDocs comments for type annotations.
//src/index.js
/**
* @param {number} a
* @param {number} b
* @returns {number}
* */
function add(a, b){
return a + b
}
Build the project: Run
npm run buildto generate minified JavaScript bundles and TypeScript declaration files in thedist/folder.publish: Run
npm publish<- only the dist folder will be pushed to npm
Notes
- The build process uses
terser()for minification. Remove it fromrollup.config.jsfor a debuggable distribution. - Supports ESM and CommonJS outputs with source maps.
