mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 04:07:23 +00:00
Allow for set contexts
This commit is contained in:
18
build.js
18
build.js
@@ -16,10 +16,12 @@ const BROWSER_MANIFEST = "./platform-specific/extension/manifest.json";
|
||||
const OBSIDIAN_MANIFEST = "./platform-specific/obsidian/manifest.json";
|
||||
const USERSCRIPT_HEADER = "./platform-specific/userscript/header.txt";
|
||||
const OBSIDIAN_WRAPPER = "./platform-specific/obsidian/wrapper.js";
|
||||
const VENCORD_WRAPPER = "./platform-specific/vencord/wrapper.js";
|
||||
|
||||
const USERSCRIPT_DIR = DIST_DIR + "/userscript";
|
||||
const EXTENSION_DIR = DIST_DIR + "/extension";
|
||||
const OBSIDIAN_DIR = DIST_DIR + "/obsidian";
|
||||
const VENCORD_DIR = DIST_DIR + "/vencord";
|
||||
|
||||
const STYLESHEET_PATH = SRC_DIR + "/stylesheet.css";
|
||||
const APPLICATION_ENTRY = SRC_DIR + "/application.js";
|
||||
@@ -32,6 +34,7 @@ const VERSION_KEY = "__VERSION__";
|
||||
const STYLESHEET_KEY = "___STYLESHEET___";
|
||||
const MONOCRAFT_SRC_KEY = "__MONOCRAFT_SRC__";
|
||||
const CODE_KEY = "__CODE__";
|
||||
const CONTEXT_KEY = "__CONTEXT__";
|
||||
|
||||
const spriteSheets = [
|
||||
{
|
||||
@@ -183,4 +186,19 @@ let obsidianManifest = readFileSync(OBSIDIAN_MANIFEST, 'utf8');
|
||||
obsidianManifest = obsidianManifest.replace(/"version":\s*".*"/, `"version": "${version}"`);
|
||||
writeFileSync(OBSIDIAN_DIR + '/manifest.json', obsidianManifest);
|
||||
|
||||
// =============================================
|
||||
// Build Vencord plugin
|
||||
// =============================================
|
||||
|
||||
mkdirSync(VENCORD_DIR, { recursive: true });
|
||||
|
||||
// Wrap birb.js with plugin boilerplate
|
||||
let vencordPlugin = readFileSync(VENCORD_WRAPPER, 'utf8').replace(CODE_KEY, birbJs);
|
||||
|
||||
// Set context to "local"
|
||||
vencordPlugin = vencordPlugin.replace(CONTEXT_KEY, "local");
|
||||
|
||||
// Create exported birb function
|
||||
writeFileSync(VENCORD_DIR + '/birb.export.js', vencordPlugin);
|
||||
|
||||
console.log(`Build complete: ${version}`);
|
||||
Reference in New Issue
Block a user