Add support for optional vs required modules.
Directories representing toggleable modules are now segemented into three subdirectories. * `required` Modules that are required. * `optionalon` Modules that are optional and enabled by default. * `optionaloff` Modules that are optional and disabled by default. Filter your files into these three directories. Files at the root directory will no longer be processed. Currently, forgemods and litemods are the only toggleable modules. For existing servers, just manually create these directories and move your files inside either of them. Generating a new server will automatically create them.
This commit is contained in:
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
github: dscalzi
|
||||||
|
patreon: dscalzi
|
||||||
|
custom: ['https://www.paypal.me/dscalzi']
|
||||||
61
README.md
61
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Nebula
|
# Nebula
|
||||||
|
|
||||||
Generate a distribution.json for Helios.
|
Generate a distribution.json for Helios. Documentation on this format can be found [here][distro.md].
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -185,8 +185,65 @@ Ex.
|
|||||||
* `files` All modules of type `File`.
|
* `files` All modules of type `File`.
|
||||||
* `libraries` All modules of type `Library`
|
* `libraries` All modules of type `Library`
|
||||||
* `forgemods` All modules of type `ForgeMod`.
|
* `forgemods` All modules of type `ForgeMod`.
|
||||||
|
* This is a directory of toggleable modules. See the note below.
|
||||||
* `litemods` All modules of type `LiteMod`.
|
* `litemods` All modules of type `LiteMod`.
|
||||||
|
* This is a directory of toggleable modules. See the note below.
|
||||||
* `TestServer-1.12.2.png` Server icon file.
|
* `TestServer-1.12.2.png` Server icon file.
|
||||||
|
|
||||||
|
#### Toggleable Modules
|
||||||
|
|
||||||
[dotenvnpm]: https://www.npmjs.com/package/dotenv
|
If a directory represents a toggleable mod, it will have three subdirectories. You must filter your files into these three.
|
||||||
|
|
||||||
|
* `required` Modules that are required.
|
||||||
|
* `optionalon` Modules that are optional and enabled by default.
|
||||||
|
* `optionaloff` Modules that are optional and disabled by default.
|
||||||
|
|
||||||
|
### Additional Metadata
|
||||||
|
|
||||||
|
To preserve metadata that cannot be inferred via file structure, two files exist. Default values will be generated when applicable. Customize to fit your needs. These values should be self explanatory. If further details are required, see the [distribution.json specification document][distro.md].
|
||||||
|
|
||||||
|
#### ${ROOT}/meta/distrometa.json
|
||||||
|
|
||||||
|
Represents the additiona metadata on the distribution object. Sample:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"rss": "<LINK TO RSS FEED>",
|
||||||
|
"discord": {
|
||||||
|
"clientId": "<FILL IN OR REMOVE DISCORD OBJECT>",
|
||||||
|
"smallImageText": "<FILL IN OR REMOVE DISCORD OBJECT>",
|
||||||
|
"smallImageKey": "<FILL IN OR REMOVE DISCORD OBJECT>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### servers/${YOUR_SERVER}/servermeta.json
|
||||||
|
|
||||||
|
Represents the additional metadata on the server object (for a YOUR_SERVER). Sample:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"name": "Test (Minecraft 1.12.2)",
|
||||||
|
"description": "Test Running Minecraft 1.12.2 (Forge v14.23.5.2854)",
|
||||||
|
"address": "localhost:25565",
|
||||||
|
"discord": {
|
||||||
|
"shortId": "1.12.2 Test Server",
|
||||||
|
"largeImageText": "1.12.2 Test Server",
|
||||||
|
"largeImageKey": "seal-circle"
|
||||||
|
},
|
||||||
|
"mainServer": false,
|
||||||
|
"autoconnect": true
|
||||||
|
},
|
||||||
|
"forge": {
|
||||||
|
"version": "14.23.5.2854"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
[dotenvnpm]: https://www.npmjs.com/package/dotenv
|
||||||
|
[distro.md]: https://github.com/dscalzi/HeliosLauncher/blob/master/docs/distro.md
|
||||||
159
package-lock.json
generated
159
package-lock.json
generated
@@ -5,27 +5,27 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": {
|
"@babel/code-frame": {
|
||||||
"version": "7.10.3",
|
"version": "7.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
|
||||||
"integrity": "sha512-fDx9eNW0qz0WkUeqL6tXEXzVlPh6Y5aCDEZesl0xBGA8ndRukX91Uk44ZqnkECp01NAZUdCAl+aiQNGi0k88Eg==",
|
"integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/highlight": "^7.10.3"
|
"@babel/highlight": "^7.10.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-validator-identifier": {
|
"@babel/helper-validator-identifier": {
|
||||||
"version": "7.10.3",
|
"version": "7.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
|
||||||
"integrity": "sha512-bU8JvtlYpJSBPuj1VUmKpFGaDZuLxASky3LhaKj3bmpSTY6VWooSM8msk+Z0CZoErFye2tlABF6yDkT3FOPAXw==",
|
"integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/highlight": {
|
"@babel/highlight": {
|
||||||
"version": "7.10.3",
|
"version": "7.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
|
||||||
"integrity": "sha512-Ih9B/u7AtgEnySE2L2F0Xm0GaM729XqqLfHkalTsbjXGyqmf/6M0Cu0WpvqueUlW+xk88BHw9Nkpj49naU+vWw==",
|
"integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/helper-validator-identifier": "^7.10.3",
|
"@babel/helper-validator-identifier": "^7.10.4",
|
||||||
"chalk": "^2.0.0",
|
"chalk": "^2.0.0",
|
||||||
"js-tokens": "^4.0.0"
|
"js-tokens": "^4.0.0"
|
||||||
},
|
},
|
||||||
@@ -67,6 +67,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@babel/runtime-corejs3": {
|
||||||
|
"version": "7.10.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.10.4.tgz",
|
||||||
|
"integrity": "sha512-BFlgP2SoLO9HJX9WBwN67gHWMBhDX/eDz64Jajd6mR/UAUzqrNMm99d4qHnVaKscAElZoFiPv+JpR/Siud5lXw==",
|
||||||
|
"requires": {
|
||||||
|
"core-js-pure": "^3.0.0",
|
||||||
|
"regenerator-runtime": "^0.13.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@dabh/diagnostics": {
|
"@dabh/diagnostics": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
|
||||||
@@ -131,12 +140,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.5.0.tgz",
|
||||||
"integrity": "sha512-wfkpiqaEVhZIuQRmudDszc01jC/YR7gMSxa6ulhggAe/Hs0KVIuo9wzvFiDbG3JD5pRFQoqnf4m7REDsUvBnMQ==",
|
"integrity": "sha512-m4erZ8AkSjoIUOf8s4k2V1xdL2c1Vy0D3dN6/jC9d7+nEqjY3gxXCkgi3gW/GAxPaA4hV8biaCoTVdQmfAeTCQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "3.4.0",
|
"@typescript-eslint/experimental-utils": "3.5.0",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"regexpp": "^3.0.0",
|
"regexpp": "^3.0.0",
|
||||||
@@ -162,37 +171,46 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.5.0.tgz",
|
||||||
"integrity": "sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw==",
|
"integrity": "sha512-zGNOrVi5Wz0jcjUnFZ6QUD0MCox5hBuVwemGCew2qJzUX5xPoyR+0EzS5qD5qQXL/vnQ8Eu+nv03tpeFRwLrDg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "3.4.0",
|
"@typescript-eslint/types": "3.5.0",
|
||||||
|
"@typescript-eslint/typescript-estree": "3.5.0",
|
||||||
"eslint-scope": "^5.0.0",
|
"eslint-scope": "^5.0.0",
|
||||||
"eslint-utils": "^2.0.0"
|
"eslint-utils": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.5.0.tgz",
|
||||||
"integrity": "sha512-ZUGI/de44L5x87uX5zM14UYcbn79HSXUR+kzcqU42gH0AgpdB/TjuJy3m4ezI7Q/jk3wTQd755mxSDLhQP79KA==",
|
"integrity": "sha512-sU07VbYB70WZHtgOjH/qfAp1+OwaWgrvD1Km1VXqRpcVxt971PMTU7gJtlrCje0M+Sdz7xKAbtiyIu+Y6QdnVA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/eslint-visitor-keys": "^1.0.0",
|
"@types/eslint-visitor-keys": "^1.0.0",
|
||||||
"@typescript-eslint/experimental-utils": "3.4.0",
|
"@typescript-eslint/experimental-utils": "3.5.0",
|
||||||
"@typescript-eslint/typescript-estree": "3.4.0",
|
"@typescript-eslint/types": "3.5.0",
|
||||||
|
"@typescript-eslint/typescript-estree": "3.5.0",
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
"eslint-visitor-keys": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@typescript-eslint/types": {
|
||||||
|
"version": "3.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.5.0.tgz",
|
||||||
|
"integrity": "sha512-Dreqb5idi66VVs1QkbAwVeDmdJG+sDtofJtKwKCZXIaBsINuCN7Jv5eDIHrS0hFMMiOvPH9UuOs4splW0iZe4Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.5.0.tgz",
|
||||||
"integrity": "sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw==",
|
"integrity": "sha512-Na71ezI6QP5WVR4EHxwcBJgYiD+Sre9BZO5iJK2QhrmRPo/42+b0no/HZIrdD1sjghzlYv7t+7Jis05M1uMxQg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@typescript-eslint/types": "3.5.0",
|
||||||
|
"@typescript-eslint/visitor-keys": "3.5.0",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"eslint-visitor-keys": "^1.1.0",
|
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"is-glob": "^4.0.1",
|
"is-glob": "^4.0.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
@@ -217,6 +235,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@typescript-eslint/visitor-keys": {
|
||||||
|
"version": "3.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.5.0.tgz",
|
||||||
|
"integrity": "sha512-7cTp9rcX2sz9Z+zua9MCOX4cqp5rYyFD5o8LlbSpXrMTXoRdngTtotRZEkm8+FNMHPWYFhitFK+qt/brK8BVJQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"eslint-visitor-keys": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "7.3.1",
|
"version": "7.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
|
||||||
@@ -242,9 +269,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ansi-colors": {
|
"ansi-colors": {
|
||||||
"version": "3.2.4",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
|
||||||
"integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==",
|
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
@@ -424,6 +451,11 @@
|
|||||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"core-js-pure": {
|
||||||
|
"version": "3.6.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz",
|
||||||
|
"integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA=="
|
||||||
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
@@ -449,9 +481,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"decamelize": {
|
"decamelize": {
|
||||||
"version": "1.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-3.2.0.tgz",
|
||||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
|
"integrity": "sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==",
|
||||||
|
"requires": {
|
||||||
|
"xregexp": "^4.2.4"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"deep-is": {
|
"deep-is": {
|
||||||
"version": "0.1.3",
|
"version": "0.1.3",
|
||||||
@@ -484,12 +519,12 @@
|
|||||||
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
|
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
|
||||||
},
|
},
|
||||||
"enquirer": {
|
"enquirer": {
|
||||||
"version": "2.3.5",
|
"version": "2.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
|
||||||
"integrity": "sha512-BNT1C08P9XD0vNg3J475yIUG+mVdp9T6towYFHUv897X0KoHBjB1shyrNmhmtHWKP17iSWgo7Gqh7BBuzLZMSA==",
|
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-colors": "^3.2.1"
|
"ansi-colors": "^4.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"escape-string-regexp": {
|
"escape-string-regexp": {
|
||||||
@@ -499,9 +534,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "7.3.1",
|
"version": "7.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.4.0.tgz",
|
||||||
"integrity": "sha512-cQC/xj9bhWUcyi/RuMbRtC3I0eW8MH0jhRELSvpKYkWep3C6YZ2OkvcvJVUeO6gcunABmzptbXBuDoXsjHmfTA==",
|
"integrity": "sha512-gU+lxhlPHu45H3JkEGgYhWhkR9wLHHEXC9FbWFnTlEkbKyZKWgWRLgf61E8zWmBuI6g5xKBph9ltg3NtZMVF8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
@@ -1042,9 +1077,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"p-limit": {
|
"p-limit": {
|
||||||
"version": "2.2.2",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||||
"integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==",
|
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"p-try": "^2.0.0"
|
"p-try": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -1121,6 +1156,11 @@
|
|||||||
"util-deprecate": "^1.0.1"
|
"util-deprecate": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"regenerator-runtime": {
|
||||||
|
"version": "0.13.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
|
||||||
|
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
|
||||||
|
},
|
||||||
"regexpp": {
|
"regexpp": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
|
||||||
@@ -1390,9 +1430,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.9.5",
|
"version": "3.9.6",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.6.tgz",
|
||||||
"integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==",
|
"integrity": "sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"universalify": {
|
"universalify": {
|
||||||
@@ -1519,18 +1559,26 @@
|
|||||||
"mkdirp": "^0.5.1"
|
"mkdirp": "^0.5.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"xregexp": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==",
|
||||||
|
"requires": {
|
||||||
|
"@babel/runtime-corejs3": "^7.8.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
|
||||||
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
|
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "15.3.1",
|
"version": "15.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.0.tgz",
|
||||||
"integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==",
|
"integrity": "sha512-D3fRFnZwLWp8jVAAhPZBsmeIHY8tTsb8ItV9KaAaopmC6wde2u6Yw29JBIZHXw14kgkRnYmDgmQU4FVMDlIsWw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cliui": "^6.0.0",
|
"cliui": "^6.0.0",
|
||||||
"decamelize": "^1.2.0",
|
"decamelize": "^3.2.0",
|
||||||
"find-up": "^4.1.0",
|
"find-up": "^4.1.0",
|
||||||
"get-caller-file": "^2.0.1",
|
"get-caller-file": "^2.0.1",
|
||||||
"require-directory": "^2.1.1",
|
"require-directory": "^2.1.1",
|
||||||
@@ -1539,7 +1587,7 @@
|
|||||||
"string-width": "^4.2.0",
|
"string-width": "^4.2.0",
|
||||||
"which-module": "^2.0.0",
|
"which-module": "^2.0.0",
|
||||||
"y18n": "^4.0.0",
|
"y18n": "^4.0.0",
|
||||||
"yargs-parser": "^18.1.1"
|
"yargs-parser": "^18.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs-parser": {
|
"yargs-parser": {
|
||||||
@@ -1549,6 +1597,13 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^5.0.0",
|
"camelcase": "^5.0.0",
|
||||||
"decamelize": "^1.2.0"
|
"decamelize": "^1.2.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"decamelize": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -30,11 +30,11 @@
|
|||||||
"@types/node": "^12.12.47",
|
"@types/node": "^12.12.47",
|
||||||
"@types/triple-beam": "^1.3.1",
|
"@types/triple-beam": "^1.3.1",
|
||||||
"@types/yargs": "^15.0.5",
|
"@types/yargs": "^15.0.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
"@typescript-eslint/eslint-plugin": "^3.5.0",
|
||||||
"@typescript-eslint/parser": "^3.4.0",
|
"@typescript-eslint/parser": "^3.5.0",
|
||||||
"eslint": "^7.3.1",
|
"eslint": "^7.4.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"typescript": "^3.9.5"
|
"typescript": "^3.9.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
@@ -46,6 +46,6 @@
|
|||||||
"toml": "^3.0.0",
|
"toml": "^3.0.0",
|
||||||
"triple-beam": "^1.3.0",
|
"triple-beam": "^1.3.0",
|
||||||
"winston": "^3.3.3",
|
"winston": "^3.3.3",
|
||||||
"yargs": "^15.3.1"
|
"yargs": "^15.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { Type } from 'helios-distribution-types'
|
|||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { resolve } from 'url'
|
import { resolve } from 'url'
|
||||||
import { VersionSegmented } from '../../../../util/VersionSegmented'
|
import { VersionSegmented } from '../../../../util/VersionSegmented'
|
||||||
import { ModuleStructure } from './module.struct'
|
|
||||||
import { MinecraftVersion } from '../../../../util/MinecraftVersion'
|
import { MinecraftVersion } from '../../../../util/MinecraftVersion'
|
||||||
|
import { ToggleableModuleStructure } from './toggleablemodule.struct'
|
||||||
|
|
||||||
export abstract class BaseForgeModStructure extends ModuleStructure implements VersionSegmented {
|
export abstract class BaseForgeModStructure extends ToggleableModuleStructure implements VersionSegmented {
|
||||||
|
|
||||||
protected readonly EXAMPLE_MOD_ID = 'examplemod'
|
protected readonly EXAMPLE_MOD_ID = 'examplemod'
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export abstract class BaseForgeModStructure extends ModuleStructure implements V
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
||||||
return resolve(this.baseUrl, join(this.relativeRoot, name))
|
return resolve(this.baseUrl, join(this.relativeRoot, this.getActiveNamespace(), name))
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { join } from 'path'
|
|||||||
import { resolve } from 'url'
|
import { resolve } from 'url'
|
||||||
import { capitalize } from '../../../../util/stringutils'
|
import { capitalize } from '../../../../util/stringutils'
|
||||||
import { LiteMod } from '../../../liteloader/litemod'
|
import { LiteMod } from '../../../liteloader/litemod'
|
||||||
import { ModuleStructure } from './module.struct'
|
import { ToggleableModuleStructure } from './toggleablemodule.struct'
|
||||||
|
|
||||||
export class LiteModStructure extends ModuleStructure {
|
export class LiteModStructure extends ToggleableModuleStructure {
|
||||||
|
|
||||||
private liteModMetadata: {[property: string]: LiteMod | undefined} = {}
|
private liteModMetadata: {[property: string]: LiteMod | undefined} = {}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ export class LiteModStructure extends ModuleStructure {
|
|||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
||||||
return resolve(this.baseUrl, join(this.relativeRoot, name))
|
return resolve(this.baseUrl, join(this.relativeRoot, this.getActiveNamespace(), name))
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export abstract class ModuleStructure extends BaseModelStructure<Module> {
|
|||||||
|
|
||||||
public async getSpecModel(): Promise<Module[]> {
|
public async getSpecModel(): Promise<Module[]> {
|
||||||
if (this.resolvedModels == null) {
|
if (this.resolvedModels == null) {
|
||||||
this.resolvedModels = await this._doModuleRetrieval()
|
this.resolvedModels = await this._doModuleRetrieval(this.containerDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.resolvedModels
|
return this.resolvedModels
|
||||||
@@ -58,10 +58,6 @@ export abstract class ModuleStructure extends BaseModelStructure<Module> {
|
|||||||
id: await this.getModuleId(file, filePath),
|
id: await this.getModuleId(file, filePath),
|
||||||
name: await this.getModuleName(file, filePath),
|
name: await this.getModuleName(file, filePath),
|
||||||
type: this.type,
|
type: this.type,
|
||||||
required: {
|
|
||||||
value: false,
|
|
||||||
def: false
|
|
||||||
},
|
|
||||||
artifact: {
|
artifact: {
|
||||||
size: stats.size,
|
size: stats.size,
|
||||||
MD5: createHash('md5').update(buf).digest('hex'),
|
MD5: createHash('md5').update(buf).digest('hex'),
|
||||||
@@ -75,14 +71,14 @@ export abstract class ModuleStructure extends BaseModelStructure<Module> {
|
|||||||
return mdl
|
return mdl
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _doModuleRetrieval(): Promise<Module[]> {
|
protected async _doModuleRetrieval(scanDirectory: string): Promise<Module[]> {
|
||||||
|
|
||||||
const accumulator: Module[] = []
|
const accumulator: Module[] = []
|
||||||
|
|
||||||
if (await pathExists(this.containerDirectory)) {
|
if (await pathExists(scanDirectory)) {
|
||||||
const files = await readdir(this.containerDirectory)
|
const files = await readdir(scanDirectory)
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const filePath = resolve(this.containerDirectory, file)
|
const filePath = resolve(scanDirectory, file)
|
||||||
const stats = await lstat(filePath)
|
const stats = await lstat(filePath)
|
||||||
if (stats.isFile()) {
|
if (stats.isFile()) {
|
||||||
if(this.filter == null || this.filter(file, filePath, stats)) {
|
if(this.filter == null || this.filter(file, filePath, stats)) {
|
||||||
|
|||||||
68
src/model/struct/model/module/toggleablemodule.struct.ts
Normal file
68
src/model/struct/model/module/toggleablemodule.struct.ts
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import { ModuleStructure } from './module.struct'
|
||||||
|
import { Type, Module } from 'helios-distribution-types'
|
||||||
|
import { Stats, mkdirs } from 'fs-extra'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export enum ToggleableNamespace {
|
||||||
|
|
||||||
|
REQUIRED = 'required',
|
||||||
|
OPTIONAL_ON = 'optionalon',
|
||||||
|
OPTIONAL_OFF = 'optionaloff'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export abstract class ToggleableModuleStructure extends ModuleStructure {
|
||||||
|
|
||||||
|
private activeNamespace: string | undefined
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
absoluteRoot: string,
|
||||||
|
relativeRoot: string,
|
||||||
|
structRoot: string,
|
||||||
|
baseUrl: string,
|
||||||
|
protected type: Type,
|
||||||
|
protected filter?: ((name: string, path: string, stats: Stats) => boolean)
|
||||||
|
) {
|
||||||
|
super(absoluteRoot, relativeRoot, structRoot, baseUrl, type, filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async init(): Promise<void> {
|
||||||
|
await super.init()
|
||||||
|
for(const namespace of Object.values(ToggleableNamespace)) {
|
||||||
|
await mkdirs(resolve(this.containerDirectory, namespace))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getSpecModel(): Promise<Module[]> {
|
||||||
|
if (this.resolvedModels == null) {
|
||||||
|
|
||||||
|
this.resolvedModels = []
|
||||||
|
for(const value of Object.values(ToggleableNamespace)) {
|
||||||
|
this.activeNamespace = value
|
||||||
|
const models = await this._doModuleRetrieval(resolve(this.containerDirectory, value))
|
||||||
|
models.forEach(this.getNamespaceMapper(value))
|
||||||
|
this.resolvedModels = this.resolvedModels.concat(models)
|
||||||
|
}
|
||||||
|
this.activeNamespace = undefined
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.resolvedModels
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getActiveNamespace(): string {
|
||||||
|
return this.activeNamespace || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getNamespaceMapper(namespace: ToggleableNamespace): (x: Module) => void {
|
||||||
|
switch(namespace) {
|
||||||
|
case ToggleableNamespace.REQUIRED:
|
||||||
|
return () => { /* do nothing */ }
|
||||||
|
case ToggleableNamespace.OPTIONAL_ON:
|
||||||
|
return (x) => x.required = { value: false }
|
||||||
|
case ToggleableNamespace.OPTIONAL_OFF:
|
||||||
|
return (x) => x.required = { value: false, def: false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user