|
| 1 | +/** |
| 2 | + * The MIT License (MIT) |
| 3 | + * |
| 4 | + * Copyright (c) 2017-2020 Mickael Jeanroy |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in all |
| 14 | + * copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | + * SOFTWARE. |
| 23 | + */ |
| 24 | + |
| 25 | +const path = require('path'); |
| 26 | +const prettier = require('prettier'); |
| 27 | +const stripBanner = require('rollup-plugin-strip-banner'); |
| 28 | +const babel = require('rollup-plugin-babel'); |
| 29 | +const license = require('rollup-plugin-license'); |
| 30 | +const config = require('../config'); |
| 31 | +const pkg = require('../../package.json'); |
| 32 | + |
| 33 | +module.exports = { |
| 34 | + input: path.join(config.src, 'index.js'), |
| 35 | + |
| 36 | + output: [ |
| 37 | + { |
| 38 | + format: 'cjs', |
| 39 | + file: path.join(config.dist, 'index.js'), |
| 40 | + }, |
| 41 | + ], |
| 42 | + |
| 43 | + plugins: [ |
| 44 | + stripBanner(), |
| 45 | + |
| 46 | + babel({ |
| 47 | + envName: 'rollup', |
| 48 | + }), |
| 49 | + |
| 50 | + license({ |
| 51 | + banner: { |
| 52 | + content: { |
| 53 | + file: path.join(config.root, 'LICENSE'), |
| 54 | + }, |
| 55 | + }, |
| 56 | + }), |
| 57 | + |
| 58 | + { |
| 59 | + renderChunk(code) { |
| 60 | + return prettier.format(code, { |
| 61 | + parser: 'babel', |
| 62 | + }); |
| 63 | + }, |
| 64 | + }, |
| 65 | + ], |
| 66 | + |
| 67 | + external: [ |
| 68 | + ...Object.keys(pkg.dependencies), |
| 69 | + ...Object.keys(pkg.peerDependencies), |
| 70 | + ], |
| 71 | +}; |
0 commit comments