1.1.3 • Published 3 years ago

unitool v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

unitool

简介

基于rollup的uniLib的扩展库构建打包工具,也可以用于构建其他库

The Extension library build package based on Rollup's uniLib can also be used to build other libraries

特性

  1. 支持typescript开发
  2. 可以导出iife,commonjs,systemjs等格式
  3. 将声明打包成单个dts声明文件

安装

npm install -D unitool

使用

  1. 对于不需要全局变量名的
    unitool build -f cjs 
  2. 需要全局变量名的,冒号: 后跟变量名(如果不写,自动从package.json中解析)
    unitool build -f iife:xxx 

更多使用可以参考 模板项目 package-template

构建配置项

在tsconfig.json中可以增加配置 1. dtsGenExclude 生成.d.ts文件时所要忽略的

比如 core包中的

 "dtsGenExclude": [
     "__tests__/**/*"
 ]

忽略测试目录下的文件,不生成声明文件

  1. externalTag 用来判断引用的模块是否做为外部引用(不编译进来) 因为packages内的A包,引用了B包,会把A和B的代码编译成一个js 参考:
    "externalTag":"@helojo"
    或
    "externalTag":["@helojo"]

构建命令行参数

  1. '-w, --watch watch', '是否监视 默认false'
  2. '-e, --entry entry', '入口文件 默认src/index.ts'
  3. '-o, --output output', '输出文件 默认dist/index.js'
  4. '-f, --format format', '输出格式 默认cjs,可选iife,umd,es 如果是iife和umd 需要加: 冒号+全局变量名'
  5. '-d, --types-dir typesDir', '声明文件输出目录 默认 dist/types'
  6. '-s, --source-dirs sourceDirs', '源码目录数组,默认src,写 src,src2'
  7. '-u, --unRemoveComments unRemoveComments', '是否移除注释'
  8. '-t, --target target', '编译目标es标准,默认es5'
  9. '-m, --minify minify', '是否压缩,如果是将会输出.min.js'

CHANGELOG

1.1.1

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago