source: trip-planner-front/node_modules/is-what/build.js@ eed0bf8

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

initial commit

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