https://www.npmjs.com/package/ux-charts
发布
npm adduser
// 或者 npm login
npm publish
⚠️: npm镜像登陆发布会失败, npm config set registry http://registry.npmjs.org/
添加组件
添加组件
单元测试
示例及文档
0⃣️、首次创建
mkdir <npm-name>
cd <npm-name>
npm init
index.js
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moduleName = factory()
}(this, (function () {
var test = {
sayHi: function () {
console.log('hi');
}
};
return test
})))
安装后自测
import 方式
import UxCharts from 'ux-charts'
var ux = UxCharts;
ux.sayHi()
require 方式
let ux = require('ux-charts')
ux.sayHi()