/libpack

Build your library without tears.:rofl:

Primary LanguageJavaScriptMIT LicenseMIT

libpack

Greenkeeper badge Build Status Dependency License Prettier Node npm version

CLI tool for quickly build your library with zero configuration.

Support:

  • es2015/es2016/es2017/es2018...
  • Flow
  • Typescript
  • React
  • Vue

Installation

npm install @axetroy/libpack -g

Usage

$ libpack --help

   libpack 0.5.2 - Build your library without tears.

   USAGE

     libpack <entry> <output>

   ARGUMENTS

     <entry>       Entry file path      required      default: "./index.js"
     <output>      Output dir path      required      default: "./build/"  

   OPTIONS

     --cwd <cwd>                          Current work dir                                                                              optional
     -w, --watch                          Watch the file change                                                                         optional      default: false
     --server                             Server the file                                                                               optional      default: false
     --target <target>                    Build target, https://webpack.js.org/concepts/targets/                                        optional      default: "web"
     --prepack                            Prepack the Javascript with facebook/prepack                                                  optional      default: false
     --library <library>                  Output library name, default your package.json name field                                     optional
     --libraryTarget <libraryTarget>      Output library target, https://webpack.js.org/configuration/output/#output-librarytarget      optional      default: "umd"
     --externals <externals>              Externals library, eg. "--externals react,react-dom"                                          optional      default: []

   GLOBAL OPTIONS

     -h, --help         Display help
     -V, --version      Display version
     --no-color         Disable colors
     --quiet            Quiet mode - only displays warn and error messages
     -v, --verbose      Verbose mode - will also output debug messages

API

const libpack = require("@axetroy/libpack");

libpack({
  cwd: process.cwd(),
  watch: false,
  entry: "./index.js",
  output: "./build",
  prepack: false,
  library: "my-library-name",
  libraryTarget: "umd",
  externals: [],
  target: "web",
  server: false
})
  .then(function() {
    console.log("build success...");
  })
  .catch(function(err) {
    console.error(err);
  });

Example

libpack ./index.js ./build
libpack ./index.jsx ./build
libpack ./index.ts ./build
libpack ./index.tsx ./build
libpack ./index.vue ./build

Contributing

git clone https://github.com/axetroy/libpack.git
cd ./libpack
npm i
npm test

You can flow Contribute Guide

Contributors


Axetroy

💻 🔌 ⚠️ 🐛 🎨

License

The MIT License