cable_ready-element 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/rollup.config.js ADDED
@@ -0,0 +1,74 @@
1
+ import resolve from '@rollup/plugin-node-resolve'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import json from '@rollup/plugin-json'
4
+ import terser from '@rollup/plugin-terser'
5
+
6
+ const pretty = () => {
7
+ return terser({
8
+ mangle: false,
9
+ compress: false,
10
+ format: {
11
+ beautify: true,
12
+ indent_level: 2
13
+ }
14
+ })
15
+ }
16
+
17
+ const minify = () => {
18
+ return terser({
19
+ mangle: true,
20
+ compress: true
21
+ })
22
+ }
23
+
24
+ const esConfig = {
25
+ format: 'es',
26
+ inlineDynamicImports: true
27
+ }
28
+
29
+ const umdConfig = {
30
+ name: 'CableReadyElement',
31
+ format: 'umd',
32
+ exports: 'named'
33
+ }
34
+
35
+ const distFolders = ['dist', 'app/assets/javascripts']
36
+
37
+ const output = distFolders
38
+ .map(distFolder => [
39
+ {
40
+ ...esConfig,
41
+ file: `${distFolder}/cable_ready-element.js`,
42
+ plugins: [pretty()]
43
+ },
44
+ {
45
+ ...esConfig,
46
+ file: `${distFolder}/cable_ready-element.min.js`,
47
+ sourcemap: true,
48
+ plugins: [minify()]
49
+ },
50
+ {
51
+ ...umdConfig,
52
+ file: `${distFolder}/cable_ready-element.umd.js`,
53
+ plugins: [pretty()]
54
+ },
55
+ {
56
+ ...umdConfig,
57
+ file: `${distFolder}/cable_ready-element.umd.min.js`,
58
+ sourcemap: true,
59
+ plugins: [minify()]
60
+ }
61
+ ])
62
+ .flat()
63
+
64
+ export default [
65
+ {
66
+ external: [],
67
+ input: 'javascript/index.js',
68
+ output,
69
+ plugins: [commonjs(), resolve(), json()],
70
+ watch: {
71
+ include: 'javascript/**'
72
+ }
73
+ }
74
+ ]