@axetroy/libpack

Build your library without tears.

libpack

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

HomePage

https://github.com/axetroy/libpack#readme

Repository

https+https://github.com/axetroy/libpack


上一篇:@axetroy/webuild
下一篇:@deskproapps/dpat

相关推荐

  • @axetroy/webuild

    零配置无侵入式的微信小程序开发工具 零配置, 无侵入式的小程序开发工具 Build Status(https://travisci.org/axetroy/webuild.svg?branch=...

    7 个月前
  • @axetroy/crawler

    crawler framework for nodejs Build Status(https://github.com/axetroy/crawler/workflows/build/badge....

    6 个月前

官方社区

扫码加入 JavaScript 社区