Giter Site home page Giter Site logo

library-boilerplate's Introduction

{{name}}

上手

安装

$ npm i {{name}}

使用

import MyLib from '{{name}}';

开发

项目使用 rollup 进行构建,你可以任意修改配置文件 rollup.config.js 并扩展它,也可以在这里搜寻你需要的 rollup 插件。

实时构建测试包

  1. 执行 npm start 构建并监视文件的更改
  2. 执行 npm link 软链项目包到全局
  3. 在你测试的项目中,执行 npm link {{name}}

构建 UMD 包

package.json:

"scripts": {
- "build": "rollup -c --environment NODE_ENV:production",
+ "build": "rollup -c --environment NODE_ENV:production,INCLUDE_UMD",
}

具体配置细节可查看 rollup.config.js,如果你要弄清楚 rollup 如何配置环境变量,请参考官方文档

构建生产包

npm run build

测试

默认已内置了 mocha。在 /test 目录下编写完单元测试后,直接执行:

npm test

发布

  1. 执行 npm version <major|minor|patch> 更新版本
  2. 执行 npm publish,会自动重新执行命令 npm run build,并发布包到 NPM。如果是 scope 的包,需要带 --access public 参数

library-boilerplate's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.