Skip to content

Commit

Permalink
Tweaks to make slim variant producer simpler to use
Browse files Browse the repository at this point in the history
  • Loading branch information
peitschie committed May 20, 2023
1 parent 7cabaab commit 086e75f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/make-slim-variant.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { readFileSync, writeFileSync, rmSync } from 'fs';
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';

const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
packageJson.version += '-slim';
writeFileSync('package.json', JSON.stringify(packageJson, undefined, ' ') + '\n');
const version = packageJson.version;

const doc = new DOMParser().parseFromString(readFileSync('plugin.xml', 'utf-8'), 'text/xml');
const pluginXml = doc.documentElement;
Expand All @@ -23,8 +26,8 @@ for (const hookEl of Array.from(pluginXml.getElementsByTagName('hook'))) {
console.log('Removed plugin.xml hook');
writeFileSync('plugin.xml', new XMLSerializer().serializeToString(doc));

rmSync('hooks', { recursive: true });
rmSync('hooks', { recursive: true, force: true });
console.log('Removed hooks folder');

rmSync('stripDuplicatePermissions.js');
rmSync('stripDuplicatePermissions.js', { force: true });
console.log('Removed stripDuplicatePermissions hook');

0 comments on commit 086e75f

Please sign in to comment.