mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCPlugin] Add preprocessor
This commit is contained in:
parent
c58dbac469
commit
2c48e7fd6f
1 changed files with 26 additions and 0 deletions
26
src/preprocessors/pcPlugin.js
Normal file
26
src/preprocessors/pcPlugin.js
Normal 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);
|
||||
};
|
Loading…
Reference in a new issue