Skip to content

Commit

Permalink
Drop webpack in favor of esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
double-beep committed Oct 29, 2023
1 parent c391a67 commit 2cbb934
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 1,490 deletions.
File renamed without changes.
50 changes: 50 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { build } from 'esbuild';
import info from './package.json' assert { type: 'json' };

const svgsNeeded = ['Checkmark', 'Clear', 'EyeOff', 'Flag', 'Pencil', 'Trash'];
const svgsUrls = svgsNeeded.map(svgName => {
return `// @resource icon${svgName} https://cdn.sstatic.net/Img/stacks-icons/${svgName}.svg`;
});

const userscriptHeader = `// ==UserScript==
// @name Advanced Flagging
// @namespace https://github.com/SOBotics
// @version ${info.version}
// @author Robert Rudman
// @contributor double-beep
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @exclude *://chat.stackexchange.com/*
// @exclude *://chat.meta.stackexchange.com/*
// @exclude *://chat.stackoverflow.com/*
// @exclude *://area51.stackexchange.com/*
// @exclude *://data.stackexchange.com/*
// @exclude *://stackoverflow.com/c/*
// @exclude *://winterbash*.stackexchange.com/*
// @exclude *://api.stackexchange.com/*
${svgsUrls.join('\n')}
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_addStyle
// @grant GM_getResourceText
// @downloadURL https://github.com/SOBotics/AdvancedFlagging/raw/master/dist/AdvancedFlagging.user.js
// @updateURL https://github.com/SOBotics/AdvancedFlagging/raw/master/dist/AdvancedFlagging.user.js
// ==/UserScript==
/* globals StackExchange, Stacks, $ */\n`;


await build({
entryPoints: [ 'src/AdvancedFlagging.ts' ],
bundle: true,
banner: {
js: userscriptHeader
},
outfile: 'dist/AdvancedFlagging.user.js',
});
Loading

0 comments on commit 2cbb934

Please sign in to comment.