aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown2018-04-14 16:54:58 +0100
committerUnknown2018-04-14 16:54:58 +0100
commit6b7328cece2b8aa832add58a2057156fd250b195 (patch)
tree66631a8d732675f1200881ab0622f6acc1b26006
parent51bdf1a7a15ec9c5677896a8ef923aeb86050d23 (diff)
add dependencies
-rw-r--r--README.md9
-rw-r--r--pkg93.js13
2 files changed, 19 insertions, 3 deletions
diff --git a/README.md b/README.md
index 07e5fdf..b95514f 100644
--- a/README.md
+++ b/README.md
@@ -47,15 +47,20 @@ example-repo
Firstly, you want to make a new folder called the name of the package.
Then, you want to make a file called package.json in the folder.
In it, there should be 4 keys.
-- `name`: **Must be the same as the folder name and command name!**
+- `name`: **Must be the same as the folder name and command name!** (unless you've provided a uninstaller)
- `inject`: It should be the name of the injection script.
- `uninstall`: Optional, It should be the name of the uninstaller script, if it doesn't exist pkg93 will simply delete the command for you.
+- `dependencies`: Optional, Packages this package depends on. These will be automatically installed.
Here's a example:
```json
{
"name": "examplepkg",
"inject": "installer.js",
- "uninstall": "optionaluninstaller.js"
+ "uninstall": "optionaluninstaller.js",
+ "dependencies": [
+ "anoptionaldependency",
+ "anotherone"
+ ]
}
```
And the directory structure:
diff --git a/pkg93.js b/pkg93.js
index 237bdb8..f44153a 100644
--- a/pkg93.js
+++ b/pkg93.js
@@ -86,6 +86,17 @@ var pkg93 = {
request.send(null);
var json = JSON.parse(request.responseText);
localStorage[".pkg93/packages/" + pkgname + ".json"] = request.responseText;
+ if (json.dependencies) {
+ json.dependencies.forEach(function (pkg) {
+ try {
+ $log("<b><span style='color:#f0f'>DPND</span></b> Getting dependency \"" + pkg + "\"");
+ output = pkg93.get(pkg);
+ if (output) {throw new Error("Dependency \"" + pkg + "\" failed to install. Current package may not work!");}
+ } catch (err) {
+ $log("<b><span style='color:#f00'>ERR</span></b> " + err.message);
+ }
+ });
+ }
request.open('GET', pkgsource + "/" + pkgname + "/" + json.inject, false);
request.send(null);
localStorage[".pkg93/packages/" + pkgname + ".js"] = request.responseText;
@@ -148,7 +159,7 @@ le._apps.pkg93 = {
exec: function() {
const protected = ["3d","acid","acidbox","ansi","anthology","arena93","bananamp","base64","bytebeat","calc","castlegafa","catex","cd","clear","clearhist","clippy","code","contact","crazy","defrag","dmg","do a barrel roll","doctor","download","find","font","format","fullscreen","fx","gameoflife","glitch","global thermonuclear war","gravity","hampster","hello","help","hexed","history","hl3","hydra","ie6","iframe","img","info","js","key","killall","layer","lenna","lisa","ls","manifesto","marburg","messenger","mines","necronomicoin","pd","piskel","pkg93","pony","potato","progressquest","pwd","reboot","robby","rotate","shutdown","skifree","solitude","speech","starwars","superplayer","takethis","terminal","textarea","tree","trollbox","vega","virtualpc","vm","wat","whatif","whois","win","zkype"];
const args = this.arg.arguments;
- const version = "v1.1.2";
+ const version = "v1.2.0";
const help = `<b>pkg93 ${version}</b>
<b>Usage:</b> pkg93 [command]