mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[Bulk] Fix some random bugs, add images support, re-add example module
This commit is contained in:
parent
334c4e7f59
commit
e492a71827
4 changed files with 28 additions and 12 deletions
5
dist/module/Example Module.js
vendored
Normal file
5
dist/module/Example Module.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"second.js":[function(require,module,exports) {
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.exampleImportedFunction=void 0;var e=function(){console.log("example imported function")};exports.exampleImportedFunction=e;
|
||||
},{}],"index.js":[function(require,module,exports) {
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./second.js"),o={goosemodHandlers:{onImport:function(){(0,e.exampleImportedFunction)()},onRemove:function(){}}};exports.default=o;
|
||||
},{"./second.js":"second.js"}]},{},["index.js"], null);parcelRequire('index.js').default
|
2
dist/modules.json
vendored
2
dist/modules.json
vendored
File diff suppressed because one or more lines are too long
32
src/index.js
32
src/index.js
|
@ -22,9 +22,16 @@ const modulesDir = `${distDir}/module`;
|
|||
|
||||
const resetDir = (dir) => {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
mkdirSync(dir);
|
||||
mkdirSync(dir, { recursive: true });
|
||||
};
|
||||
|
||||
if (process.argv[2] === '-f') {
|
||||
resetDir(clonesDir);
|
||||
|
||||
resetDir(distDir);
|
||||
resetDir(modulesDir);
|
||||
}
|
||||
|
||||
let previous = [];
|
||||
if (existsSync(clonesDir)) {
|
||||
for (const cloneDir of glob.sync(`${clonesDir}/*/*`)) {
|
||||
|
@ -36,13 +43,6 @@ if (existsSync(clonesDir)) {
|
|||
}
|
||||
}
|
||||
|
||||
if (process.argv[2] === '-f') {
|
||||
resetDir(clonesDir);
|
||||
|
||||
resetDir(distDir);
|
||||
resetDir(modulesDir);
|
||||
}
|
||||
|
||||
import { exec } from 'child_process';
|
||||
|
||||
const parcelOptions = {
|
||||
|
@ -113,7 +113,9 @@ for (const repo of ModuleRepos) {
|
|||
|
||||
const preprocessor = repo[3];
|
||||
|
||||
resetDir(cloneDir);
|
||||
// resetDir(cloneDir);
|
||||
// rmSync(cloneDir, { recursive: true, force: true });
|
||||
|
||||
await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));
|
||||
|
||||
process.chdir(cloneDir);
|
||||
|
@ -149,19 +151,27 @@ for (const repo of ModuleRepos) {
|
|||
|
||||
const jsHash = createHash('sha512').update(jsCode).digest('hex');
|
||||
|
||||
moduleJson.push({
|
||||
const manifestJson = {
|
||||
name: manifest.name,
|
||||
description: manifest.description,
|
||||
|
||||
version: manifest.version,
|
||||
|
||||
tags: manifest.tags,
|
||||
|
||||
authors: manifest.authors,
|
||||
|
||||
hash: jsHash,
|
||||
|
||||
github: {
|
||||
stars: githubInfo.stargazers_count,
|
||||
repo: repo[0]
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (manifest.images) manifestJson.images = manifest.images;
|
||||
|
||||
moduleJson.push(manifestJson);
|
||||
|
||||
console.timeEnd(repo.slice(0, 2).join(' @ ')+`${repo[2] ? ` ${repo[2]}` : ''}`);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ export default
|
|||
[
|
||||
/* ['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef'],
|
||||
['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef', '/subModule'], */
|
||||
['GooseMod/GMExampleModule', '5b7cbe5788f964a61ba17c376bea395d3582cde7'],
|
||||
|
||||
['Controlfreak707/GM-Copy-Raw', 'ae3f739f4d53344f87b1b404686d100394a566ee'],
|
||||
];
|
Loading…
Reference in a new issue