[Bulk] Fix some random bugs, add images support, re-add example module

This commit is contained in:
Ducko 2021-01-30 13:35:08 +00:00
parent 334c4e7f59
commit e492a71827
4 changed files with 28 additions and 12 deletions

5
dist/module/Example Module.js vendored Normal file
View 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

File diff suppressed because one or more lines are too long

View file

@ -22,9 +22,16 @@ const modulesDir = `${distDir}/module`;
const resetDir = (dir) => { const resetDir = (dir) => {
rmSync(dir, { recursive: true, force: true }); 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 = []; let previous = [];
if (existsSync(clonesDir)) { if (existsSync(clonesDir)) {
for (const cloneDir of glob.sync(`${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'; import { exec } from 'child_process';
const parcelOptions = { const parcelOptions = {
@ -113,7 +113,9 @@ for (const repo of ModuleRepos) {
const preprocessor = repo[3]; const preprocessor = repo[3];
resetDir(cloneDir); // resetDir(cloneDir);
// rmSync(cloneDir, { recursive: true, force: true });
await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res)); await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));
process.chdir(cloneDir); process.chdir(cloneDir);
@ -149,19 +151,27 @@ for (const repo of ModuleRepos) {
const jsHash = createHash('sha512').update(jsCode).digest('hex'); const jsHash = createHash('sha512').update(jsCode).digest('hex');
moduleJson.push({ const manifestJson = {
name: manifest.name, name: manifest.name,
description: manifest.description, description: manifest.description,
version: manifest.version, version: manifest.version,
tags: manifest.tags, tags: manifest.tags,
authors: manifest.authors, authors: manifest.authors,
hash: jsHash, hash: jsHash,
github: { github: {
stars: githubInfo.stargazers_count, stars: githubInfo.stargazers_count,
repo: repo[0] repo: repo[0]
} }
}); };
if (manifest.images) manifestJson.images = manifest.images;
moduleJson.push(manifestJson);
console.timeEnd(repo.slice(0, 2).join(' @ ')+`${repo[2] ? ` ${repo[2]}` : ''}`); console.timeEnd(repo.slice(0, 2).join(' @ ')+`${repo[2] ? ` ${repo[2]}` : ''}`);

View file

@ -2,6 +2,7 @@ export default
[ [
/* ['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef'], /* ['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef'],
['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef', '/subModule'], */ ['GooseMod/GMExampleModule', 'ba7c20f44fe88780286ac88b47b933609016c7ef', '/subModule'], */
['GooseMod/GMExampleModule', '5b7cbe5788f964a61ba17c376bea395d3582cde7'],
['Controlfreak707/GM-Copy-Raw', 'ae3f739f4d53344f87b1b404686d100394a566ee'], ['Controlfreak707/GM-Copy-Raw', 'ae3f739f4d53344f87b1b404686d100394a566ee'],
]; ];