README
sn-taro-utils
简体中文 | English
The best third party JS|TS
library for Taro.
Characteristics
- Coded in ES6+ or TypeScript, easily compile and generate production code
- Integrated babel-runtime (Default set to closed)
- Third parties rely on automatic injection(Tree shaking)
- Supports multi environment, including default browsers, Node, AMD, CMD, Webpack, Rollup, Fis and so on.
- Integrated code style lint(eslint|tslint).
- Integrated unit test environment(mocha).
- Integrated test coverage(istanbul).
- Integrated continuous integration tool travis-ci
- Supports banner
- Supports one-key renaming.
- Supports sideEffects
- Integrated Issue template
Note: When export
and export default
are not used at the same time, there is the option to
turn on legacy mode
. Under legacy mode
, the module system can be compatible with IE6-8
. For more information on legacy mode,
please see rollup supplemental file.
Compatibility
Unit tests guarantee support on the following environment:
IE | CH | FF | SF | OP | IOS | Android | Node |
---|---|---|---|---|---|---|---|
6+ | 29+ | 55+ | 9+ | 50+ | 9+ | 4+ | 4+ |
Note: Compiling code depend on ES5, so you need import es5-shim to compatible with
IE6-8
, here is a demo
Usage Instructions
Using npm, download and install the code.
$ npm install --save sn-taro-utils
For node environment:
const snJsUtils = require('../dist/index.js');
For webpack or similar environment:
import { DateUtil } from 'sn-taro-utils';
For requirejs environment:
requirejs(['node_modules/sn-taro-utils/dist/index.aio.js'], function (snJsUtils) {
console.log(snJsUtils.DateUtil.formatDate(new Date(), 'yyyy-MM-dd'));
})
Documents
Contribution Guide
For the first time to run, you need to install dependencies firstly.
$ npm install
To build the project:
$ npm run build
To run unit tests:
$ npm test
Modify the version number in package.json, modify the version number in README.md, modify the CHANGELOG.md, and then release the new version.
$ npm run release
Publish the new version to NPM.
$ npm publish