-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
46 lines (43 loc) · 1.31 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import typescript from '@rollup/plugin-typescript';
import scss from 'rollup-plugin-scss';
import terser from '@rollup/plugin-terser';
import fs from 'fs';
const packageJSON = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
const BANNER = `
// ==UserScript==
// @name Hacker News User Tags
// @version ${packageJSON.version}
// @description Allows the user to associate a custom coloured label/tag on usernames throughout Hacker News.
// @author ${packageJSON.author}
// @match https://news.ycombinator.com/*
// @icon https://news.ycombinator.com/favicon.ico
// @updateURL https://cdn.jsdelivr.net/gh/lachlanmcdonald/hackernews-user-tags@master/dist/userscript.js
// @downloadURL https://cdn.jsdelivr.net/gh/lachlanmcdonald/hackernews-user-tags@master/dist/userscript.js
// @grant GM.getValue
// @grant GM.setValue
// @run-at document-idle
// @license ${packageJSON.license}
// @noframes
// ==/UserScript==`;
export default {
input: 'src/Userscript.ts',
output: {
file: 'dist/userscript.js',
format: 'iife',
},
plugins: [
scss({
output: false,
processor: css => css.replace(/(?<=[}{;])\s+/gum, ''),
}),
typescript(),
terser({
toplevel: true,
mangle: false,
compress: false,
format: {
preamble: BANNER.trim(),
},
}),
],
};