tiptap/build/packages/config.js

195 lines
4.8 KiB
JavaScript
Raw Normal View History

2018-08-22 16:41:26 +08:00
import path from 'path'
import vue from 'rollup-plugin-vue'
import buble from 'rollup-plugin-buble'
import flow from 'rollup-plugin-flow-no-whitespace'
import cjs from 'rollup-plugin-commonjs'
import node from 'rollup-plugin-node-resolve'
import replace from 'rollup-plugin-replace'
import packagejson from '../../package.json'
const { version } = packagejson
const banner = `
/*!
* tiptap v${version}
* (c) ${new Date().getFullYear()} Scrumpy UG (limited liability)
* @license MIT
*/
`
const resolve = _path => path.resolve(__dirname, '../../', _path)
function genConfig(opts) {
const config = {
input: {
2018-08-22 17:54:10 +08:00
input: opts.input,
2018-08-22 16:41:26 +08:00
plugins: [
flow(),
node(),
cjs(),
vue({
css: true,
compileTemplate: true,
}),
replace({
__VERSION__: version,
}),
buble({
objectAssign: 'Object.assign',
}),
2018-08-22 17:54:10 +08:00
],
external: opts.external,
2018-08-22 16:41:26 +08:00
},
output: {
file: opts.file,
format: opts.format,
banner,
name: 'tiptap',
},
}
if (opts.env) {
config.input.plugins.unshift(replace({
'process.env.NODE_ENV': JSON.stringify(opts.env),
}))
}
return config
}
export default [
2018-08-23 17:23:03 +08:00
{
input: resolve('packages/tiptap/src/index.js'),
file: resolve('packages/tiptap/dist/tiptap.js'),
format: 'umd',
env: 'development',
external: ['vue'],
},
{
input: resolve('packages/tiptap/src/index.js'),
file: resolve('packages/tiptap/dist/tiptap.min.js'),
format: 'umd',
env: 'production',
external: ['vue'],
},
{
input: resolve('packages/tiptap/src/index.js'),
file: resolve('packages/tiptap/dist/tiptap.common.js'),
format: 'cjs',
external: ['vue'],
},
{
input: resolve('packages/tiptap/src/index.js'),
file: resolve('packages/tiptap/dist/tiptap.esm.js'),
format: 'es',
external: ['vue'],
},
2018-08-23 16:33:49 +08:00
2018-08-23 17:23:03 +08:00
{
input: resolve('packages/tiptap-commands/src/index.js'),
file: resolve('packages/tiptap-commands/dist/commands.js'),
format: 'umd',
env: 'development',
external: [],
},
{
input: resolve('packages/tiptap-commands/src/index.js'),
file: resolve('packages/tiptap-commands/dist/commands.min.js'),
format: 'umd',
env: 'production',
external: [],
},
{
input: resolve('packages/tiptap-commands/src/index.js'),
file: resolve('packages/tiptap-commands/dist/commands.common.js'),
format: 'cjs',
external: [],
},
{
input: resolve('packages/tiptap-commands/src/index.js'),
file: resolve('packages/tiptap-commands/dist/commands.esm.js'),
format: 'es',
external: [],
},
2018-08-23 17:13:59 +08:00
2018-08-23 17:23:03 +08:00
{
input: resolve('packages/tiptap-utils/src/index.js'),
file: resolve('packages/tiptap-utils/dist/utils.js'),
format: 'umd',
env: 'development',
external: [],
},
{
input: resolve('packages/tiptap-utils/src/index.js'),
file: resolve('packages/tiptap-utils/dist/utils.min.js'),
format: 'umd',
env: 'production',
external: [],
},
{
input: resolve('packages/tiptap-utils/src/index.js'),
file: resolve('packages/tiptap-utils/dist/utils.common.js'),
format: 'cjs',
external: [],
},
{
input: resolve('packages/tiptap-utils/src/index.js'),
file: resolve('packages/tiptap-utils/dist/utils.esm.js'),
format: 'es',
external: [],
},
2018-08-23 16:33:49 +08:00
{
2018-08-23 17:13:59 +08:00
input: resolve('packages/tiptap-models/src/index.js'),
file: resolve('packages/tiptap-models/dist/models.js'),
2018-08-23 16:33:49 +08:00
format: 'umd',
env: 'development',
external: [],
},
{
2018-08-23 17:13:59 +08:00
input: resolve('packages/tiptap-models/src/index.js'),
file: resolve('packages/tiptap-models/dist/models.min.js'),
2018-08-23 16:33:49 +08:00
format: 'umd',
env: 'production',
external: [],
},
{
2018-08-23 17:13:59 +08:00
input: resolve('packages/tiptap-models/src/index.js'),
file: resolve('packages/tiptap-models/dist/models.common.js'),
2018-08-23 16:33:49 +08:00
format: 'cjs',
external: [],
},
{
2018-08-23 17:13:59 +08:00
input: resolve('packages/tiptap-models/src/index.js'),
file: resolve('packages/tiptap-models/dist/models.esm.js'),
2018-08-23 16:33:49 +08:00
format: 'es',
external: [],
},
2018-08-24 04:09:38 +08:00
{
input: resolve('packages/tiptap-extensions/src/index.js'),
file: resolve('packages/tiptap-extensions/dist/extensions.js'),
format: 'umd',
env: 'development',
external: [],
},
{
input: resolve('packages/tiptap-extensions/src/index.js'),
file: resolve('packages/tiptap-extensions/dist/extensions.min.js'),
format: 'umd',
env: 'production',
external: [],
},
{
input: resolve('packages/tiptap-extensions/src/index.js'),
file: resolve('packages/tiptap-extensions/dist/extensions.common.js'),
format: 'cjs',
external: [],
},
{
input: resolve('packages/tiptap-extensions/src/index.js'),
file: resolve('packages/tiptap-extensions/dist/extensions.esm.js'),
format: 'es',
external: [],
},
2018-08-22 16:41:26 +08:00
].map(genConfig)