Upload via GUI (324 Dateien)
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* build-streamdeck-plugin.js – das AeroMC-Plugin als Datei zum Weitergeben packen
|
||||
* -------------------------------------------------------------------------------
|
||||
* Erzeugt dist/AeroMC.streamDeckPlugin. Das ist ein ZIP mit dem Plugin-Ordner; ein
|
||||
* Doppelklick darauf installiert es in der Stream-Deck-Software. Die Datei ist für
|
||||
* alle gedacht, die den Launcher nicht selbst aktualisieren lassen (oder die
|
||||
* Stream-Deck-Software erst später installieren).
|
||||
*
|
||||
* Die Launcher-Installation enthält das Plugin ohnehin und kopiert es von selbst
|
||||
* (src/streamdeckplugin.js) - diese Datei ist der zweite Weg dafür.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const archiver = require('archiver');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const NAME = 'com.aeromc.launcher.sdPlugin';
|
||||
const QUELLE = path.join(ROOT, 'streamdeck-plugin', NAME);
|
||||
const AUSGABE = path.join(ROOT, 'dist', 'AeroMC.streamDeckPlugin');
|
||||
|
||||
function main() {
|
||||
if (!fs.existsSync(path.join(QUELLE, 'manifest.json'))) throw new Error(`${QUELLE}\\manifest.json fehlt.`);
|
||||
fs.mkdirSync(path.dirname(AUSGABE), { recursive: true });
|
||||
fs.rmSync(AUSGABE, { force: true });
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const aus = fs.createWriteStream(AUSGABE);
|
||||
const zip = archiver('zip', { zlib: { level: 9 } });
|
||||
aus.on('close', () => {
|
||||
const version = JSON.parse(fs.readFileSync(path.join(QUELLE, 'manifest.json'), 'utf8')).Version;
|
||||
console.log(`\n» Stream-Deck-Plugin ${version}: ${AUSGABE} (${Math.round(zip.pointer() / 1024)} KB)`);
|
||||
resolve();
|
||||
});
|
||||
zip.on('error', reject);
|
||||
zip.pipe(aus);
|
||||
// Der Plugin-Ordner steht als einziger Eintrag oben im ZIP; Protokolle der Stream-Deck-Software gehören nicht hinein
|
||||
zip.directory(QUELLE, NAME, (eintrag) => (/^(logs[\\/]|logs$)/.test(eintrag.name.replace(NAME + '/', '')) ? false : eintrag));
|
||||
zip.finalize();
|
||||
});
|
||||
}
|
||||
|
||||
main().catch((err) => { console.error('Stream-Deck-Plugin konnte nicht gepackt werden:', err.message); process.exit(1); });
|
||||
Reference in New Issue
Block a user