source: trip-planner-front/node_modules/copy-anything/build/rollup.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/* eslint-disable */
2
3// npm install rollup-plugin-typescript2 typescript --save-dev
4import typescript from 'rollup-plugin-typescript2'
5
6// ------------------------------------------------------------------------------------------
7// formats
8// ------------------------------------------------------------------------------------------
9// amd – Asynchronous Module Definition, used with module loaders like RequireJS
10// cjs – CommonJS, suitable for Node and Browserify/Webpack
11// esm – Keep the bundle as an ES module file
12// iife – A self-executing function, suitable for inclusion as a <script> tag. (If you want to create a bundle for your application, you probably want to use this, because it leads to smaller file sizes.)
13// umd – Universal Module Definition, works as amd, cjs and iife all in one
14// system – Native format of the SystemJS loader
15
16// ------------------------------------------------------------------------------------------
17// setup
18// ------------------------------------------------------------------------------------------
19const pkg = require('../package.json')
20const name = pkg.name
21const className = name.replace(/(^\w|-\w)/g, c => c.replace('-', '').toUpperCase())
22const external = Object.keys(pkg.dependencies || [])
23const plugins = [
24 typescript({ useTsconfigDeclarationDir: true, tsconfigOverride: { exclude: ['test/**/*'] } }),
25]
26
27// ------------------------------------------------------------------------------------------
28// Builds
29// ------------------------------------------------------------------------------------------
30function defaults (config) {
31 // defaults
32 const defaults = {
33 plugins,
34 external,
35 }
36 // defaults.output
37 config.output = config.output.map(output => {
38 return Object.assign(
39 {
40 sourcemap: false,
41 name: className,
42 },
43 output
44 )
45 })
46 return Object.assign(defaults, config)
47}
48
49export default [
50 defaults({
51 input: 'src/index.ts',
52 output: [
53 { file: 'dist/index.cjs.js', format: 'cjs' },
54 { file: 'dist/index.esm.js', format: 'esm' },
55 ],
56 }),
57]
Note: See TracBrowser for help on using the repository browser.