[PCPlugin] Add preprocessor

This commit is contained in:
Ducko 2021-04-04 15:52:41 +01:00 committed by Keanu
parent c58dbac469
commit 2c48e7fd6f
Signed by: keanucode
GPG Key ID: A7431C0D513CA93B
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import { readFileSync, writeFileSync, mkdirSync, rmSync } from 'fs';
export default (manifestPath, repo) => {
const pcManifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
let manifest = {
main: 'index.js',
tags: ['port'],
name: pcManifest.name,
description: pcManifest.description,
version: pcManifest.version,
authors: [ pcManifest.author ]
};
rmSync(manifestPath);
mkdirSync(manifestPath);
const content = readFileSync(pcManifest.main || 'index.js', 'utf8');//.replace(/\\/g, '\\\\').replace(/`/g, '\\`');
const jsCode = content;
writeFileSync(`${manifestPath}/goosemodModule.json`, JSON.stringify(manifest));
writeFileSync(`${manifestPath}/index.js`, jsCode);
};