mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCPlugin] Don't use subdir and remove manifest.json as some plugins require it
This commit is contained in:
parent
4d1016516b
commit
e6e0e54913
2 changed files with 16 additions and 9 deletions
10
src/index.js
10
src/index.js
|
@ -103,7 +103,7 @@ for (const parentRepo of ModuleRepos) {
|
|||
|
||||
const name = repo[0];
|
||||
const cloneDir = `${clonesDir}/${name}`;
|
||||
const moduleDir = repo[2] || '';
|
||||
let moduleDir = repo[2] || '';
|
||||
|
||||
if (previous.includes(repo)) {
|
||||
let currentModule = currentRepoJson.modules.filter((x) => x.github.repo === repo[0]);
|
||||
|
@ -155,7 +155,11 @@ for (const parentRepo of ModuleRepos) {
|
|||
await new Promise((res) => exec(`git checkout ${commitHash}`, res));
|
||||
|
||||
if (preprocessor) {
|
||||
(await import(`./preprocessors/${preprocessor}.js`)).default(`${cloneDir}${moduleDir}`, repo);
|
||||
const preOut = (await import(`./preprocessors/${preprocessor}.js`)).default(`${cloneDir}${moduleDir}`, repo);
|
||||
|
||||
if (preOut !== undefined) {
|
||||
moduleDir = preOut;
|
||||
}
|
||||
}
|
||||
|
||||
const manifest = JSON.parse(readFileSync(`${cloneDir}${moduleDir}/goosemodModule.json`));
|
||||
|
@ -163,7 +167,7 @@ for (const parentRepo of ModuleRepos) {
|
|||
// console.log(manifest);
|
||||
|
||||
const outFile = `${manifest.name}.js`;
|
||||
|
||||
|
||||
const bundler = new Parcel(`${cloneDir}${moduleDir}/${manifest.main}`, Object.assign(parcelOptions, {
|
||||
outFile
|
||||
}));
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import { join } from 'path';
|
||||
import { readFileSync, writeFileSync, mkdirSync, rmSync } from 'fs';
|
||||
|
||||
import sass from 'sass';
|
||||
|
||||
export default (manifestPath, repo) => {
|
||||
const baseDir = join(manifestPath, '..');
|
||||
|
||||
const pcManifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
||||
|
||||
let manifest = {
|
||||
main: '../index.js',
|
||||
main: 'index.js',
|
||||
tags: ['port'],
|
||||
|
||||
name: pcManifest.name,
|
||||
|
@ -15,9 +19,6 @@ export default (manifestPath, repo) => {
|
|||
authors: [ pcManifest.author ]
|
||||
};
|
||||
|
||||
rmSync(manifestPath);
|
||||
mkdirSync(manifestPath);
|
||||
|
||||
let content = readFileSync(pcManifest.main || 'index.js', 'utf8');//.replace(/\\/g, '\\\\').replace(/`/g, '\\`');
|
||||
|
||||
content = content.replace(`module.exports = `, `export default new `);
|
||||
|
@ -39,6 +40,8 @@ export default (manifestPath, repo) => {
|
|||
|
||||
const jsCode = `import powercord from '_powercord/global';\n` + content;
|
||||
|
||||
writeFileSync(`${manifestPath}/goosemodModule.json`, JSON.stringify(manifest));
|
||||
writeFileSync(`${manifestPath}/../index.js`, jsCode);
|
||||
writeFileSync(join(baseDir, `goosemodModule.json`), JSON.stringify(manifest));
|
||||
writeFileSync(join(baseDir, `index.js`), jsCode);
|
||||
|
||||
return '';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue