CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
TheLazySquid

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: TheLazySquid/GimkitCheat
Path: blob/main/rollup.config.js
Views: 1178
1
import typescript from '@rollup/plugin-typescript';
2
import svelte from 'rollup-plugin-svelte';
3
import resolve from '@rollup/plugin-node-resolve';
4
import sveltePreprocess from 'svelte-preprocess';
5
import commonjs from '@rollup/plugin-commonjs';
6
import metablock from 'rollup-plugin-userscript-metablock';
7
import fs from 'fs';
8
import terser from '@rollup/plugin-terser';
9
import makeBookmarklet from './makeBookmarket.js';
10
11
const pkg = JSON.parse(fs.readFileSync('./package.json'));
12
const full = process.argv.includes('full');
13
14
let output = [
15
{
16
file: 'build/bundle.js',
17
format: 'iife'
18
}
19
]
20
21
let otherOutputs = [
22
{
23
file: 'build/bundle.user.js',
24
format: 'iife',
25
plugins: [
26
metablock({
27
file: './meta.json',
28
override: {
29
version: pkg.version
30
}
31
})
32
]
33
},
34
{
35
file: 'build/bundle.bookmarklet.txt',
36
format: 'iife',
37
plugins: [
38
terser(),
39
makeBookmarklet()
40
]
41
}
42
];
43
44
// If we're doing a full build, also create a userscript and bookmarklet
45
if (full) {
46
output = output.concat(otherOutputs);
47
}
48
49
export default {
50
input: 'src/main.ts',
51
output,
52
plugins: [
53
typescript(),
54
commonjs(),
55
svelte({
56
emitCss: false,
57
compilerOptions: {
58
css: 'injected'
59
},
60
preprocess: sveltePreprocess()
61
}),
62
resolve({
63
browser: true,
64
exportConditions: ['svelte'],
65
extensions: ['.svelte', '.js', '.ts', '.json']
66
})
67
]
68
}
69