kviewui-color
Version:
kviewui自用的颜色生成工具
60 lines (53 loc) • 1.44 kB
JavaScript
import path from 'path';
import resolve from "rollup-plugin-node-resolve"; // 依赖引用插件
import commonjs from 'rollup-plugin-commonjs'; // commonjs 转换插件
import { eslint } from 'rollup-plugin-eslint'; // eslint 插件
import ts from 'rollup-plugin-typescript2';
const getPath = _path => path.resolve(__dirname, _path);
import packageJSON from './package.json';
import nodeResolve from 'rollup-plugin-node-resolve';
import json from '@rollup/plugin-json'
const extendsions = [
'.js',
'.ts',
'.jsx',
'.json',
'.md'
];
// ts
const tsPlugin = ts({
tsconfig: getPath('./tsconfig.json'), // 导入本地ts配置
extendsions
})
// eslint
const esPlugin = eslint({
throwOnError: true,
include: ['src/**/*.ts'],
exclude: ['node_modules/**', 'lib/**']
})
// 基础配置
const commonConf = {
input: getPath('./src/main.ts'),
plugins: [
resolve(extendsions),
commonjs(),
esPlugin,
tsPlugin,
json(),
nodeResolve({
browser: true
})
]
}
// 导出的模块类型
const outputMap = [{
file: packageJSON.main, // 通用模块
format: 'umd',
},
{
file: packageJSON.module, // es6模块
format: 'es'
}
];
const buildConf = options => Object.assign({}, commonConf, options);
export default outputMap.map(output => buildConf({ output: { name: packageJSON.name, ...output } }));