diff options
author | Unknown | 2018-04-14 16:54:58 +0100 |
---|---|---|
committer | Unknown | 2018-04-14 16:54:58 +0100 |
commit | 6b7328cece2b8aa832add58a2057156fd250b195 (patch) | |
tree | 66631a8d732675f1200881ab0622f6acc1b26006 | |
parent | 51bdf1a7a15ec9c5677896a8ef923aeb86050d23 (diff) |
add dependencies
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | pkg93.js | 13 |
2 files changed, 19 insertions, 3 deletions
@@ -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: @@ -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] |