All Projects → osdevisnot → Klap

osdevisnot / Klap

Licence: mit
zero config, zero dependency bundler for tiny javascript packages

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Klap

Tsdx
Zero-config CLI for TypeScript package development
Stars: ✭ 9,010 (+6200.7%)
Mutual labels:  rollup, packaging, npm, yarn
Yarn Package Boilerplate
An Yarn package with babel, jest, flow, prettier and more
Stars: ✭ 10 (-93.01%)
Mutual labels:  babel, npm, yarn
Democracy Client
DEMOCRACY App Client
Stars: ✭ 98 (-31.47%)
Mutual labels:  babel, npm, yarn
Microbundle
📦 Zero-configuration bundler for tiny modules.
Stars: ✭ 6,622 (+4530.77%)
Mutual labels:  bundle, build, rollup
Bili
Bili makes it easier to bundle JavaScript libraries.
Stars: ✭ 949 (+563.64%)
Mutual labels:  bundle, rollup, babel
Npm Build Boilerplate
A collection of packages that build a website using npm scripts.
Stars: ✭ 963 (+573.43%)
Mutual labels:  build, watch, npm
Node Developer Boilerplate
🍭 Boilerplate for ES6+ Node.js and npm Developer
Stars: ✭ 82 (-42.66%)
Mutual labels:  babel, npm, yarn
Cra Build Watch
A script for create-react-app that writes development builds to the disk
Stars: ✭ 110 (-23.08%)
Mutual labels:  build, watch
Babel Plugin Prismjs
A babel plugin to use PrismJS with standard bundlers.
Stars: ✭ 114 (-20.28%)
Mutual labels:  rollup, babel
Kymsu
Keep Your macOs Stuff Updated (KYMSU)
Stars: ✭ 119 (-16.78%)
Mutual labels:  npm, yarn
Barebones
A barebones boilerplate for getting started on a bespoke front end.
Stars: ✭ 127 (-11.19%)
Mutual labels:  babel, yarn
Example Rollup React Component Npm Package
Example React Component, Published to npm
Stars: ✭ 122 (-14.69%)
Mutual labels:  rollup, npm
Mhy
🧩 A zero-config, out-of-the-box, multi-purpose toolbox and development environment
Stars: ✭ 128 (-10.49%)
Mutual labels:  build, babel
Cheatsheets
A curated list of everything I look up more than twice
Stars: ✭ 109 (-23.78%)
Mutual labels:  npm, yarn
Yarn
The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
Stars: ✭ 40,325 (+28099.3%)
Mutual labels:  npm, yarn
Simple Boilerplate
A simple webpack boilerplate for your comfortable work with HTML, JS and CSS.
Stars: ✭ 116 (-18.88%)
Mutual labels:  babel, npm
Wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Stars: ✭ 1,374 (+860.84%)
Mutual labels:  babel, yarn
Babel React Rollup Starter
A simple boilerplate for web apps with React, Babel, and Rollup.
Stars: ✭ 124 (-13.29%)
Mutual labels:  rollup, babel
Preact Minimal
🚀 Minimal preact structure
Stars: ✭ 136 (-4.9%)
Mutual labels:  babel, yarn
Vscode Deploy Reloaded
Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
Stars: ✭ 129 (-9.79%)
Mutual labels:  npm, yarn

klap 👏

a zero config, zero dependency bundler for tiny javascript packages.

Build Status David David npm NPM All Contributors

klap output

✨ Features

  • 🎉 zero config: bundle your library using only a package.json
  • 💥 zero config: typescript support (just rename *.js to *.ts)
  • 🌟 zero config: code transforms using babel macros
  • 🌈 zero config: code generation using babel plugin codegen
  • 🚀 zero dependency: uses gcc-style bundling.
  • 🐙 creates tiny bundles for multiple output formats cjs, esm and umd
  • 🔥 Modern JS syntax with class properties, async/await, and generators
  • ⚡️ Built in Minification and Gzip Size Tracking
  • 🌀 Built in development server for quick prototyping.
  • 🎊 Supports react, styled-components and emotion out of the box.

💪 Powered By

  • rollup - Next-generation ES module bundler
  • babel - The compiler for next generation JavaScript
  • typescript - Typed JavaScript at Any Scale.

🍽 Usage

First, initialize your project using klap init:

npx klap init

Prefer Typescript ? initialize using ts argument:

npx klap init ts

Want to use JSX with Typescript? init using tsx argument:

npx klap init tsx

The init command will create a minimal package.json with source, main, module and browser entries and the build, watch and start scripts.

{
  "name": "...",
  "version": "0.0.0",
  "files": [ "dist" ],
  "source": "src/sum.js",         # source file of your package
  "main": "dist/sum.cjs.js",      # commonjs bundle target
  "module": "dist/sum.esm.js",    # esm bundle target
  "browser": "dist/sum.js",       # umd bundle target
  "scripts": {
    "build": "klap build",        # bundle your package
    "watch": "klap watch",        # bundle your package and watch for changes
    "start": "klap start",        # start a development server
  },
  "devDependencies": {
    "klap": "3.2.0"               # klap as dev dependency
  }
}

Note: Dropping pkg.main will disable cjs output, also applies to esm and umd outputs.

Then use npm run or yarn to invoke npm scripts as you normally would.

See examples for common use cases using klap.

💢 Granular Control

klap uses sensible defaults for most part. However, as needed, use below properties in package.json to fine tune klap. You can also use cli flags to control config options for klap.

option cli flag(s) description default
source -s --source source file to compile and bundle src/index.js
cjs -c --cjs the output file for common js format pkg.main
esm -e --esm the output file for esm format pkg.module
umd -u --umd the output file for umd format pkg.browser
types -t --types the output file for type definitions pkg.types
browserslist -b --browserslist browserslist compatible compilation target last 2 versions modern browsers if usage is greater than 1%
klap.name -n --name package name for umd bundles sanitized pkg.name
klap.port -p --port port for development server 1234
klap.example --example location of index js/ts file for start command public/index.js or pkg.source
klap.fallback --fallback location of index html file for start command public/index.html
klap.target --target target for development server (umd, es) es
klap.sourcemap --no-sourcemap sourcemaps for builds true
klap.minify --no-minify minification for builds true
klap.runtime --runtime the runtime for new JSX transform react
klap.usets --usets use typescript compiler for the project false
klap.globals global names for umd bundles {}

--usets allows the library code to use typescript features not supported by @babel/preset-typescript. See const-enums example to enable usage of const enums.

🥂 License

klap is licensed under the MIT License.

Documentation is licensed under Creative Common License.

Created with ❤️ by @osdevisnot and all contributors.

✨ Contributors

Thanks goes to these wonderful people (emoji key):


v 1 r t l

💻

Daniel Berner

💻

Tom Julius

💻

Marcus Lindblom

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

💝 Supporters

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].