 Issue 29901591:
  Issue 7020 - publish gecko with Node.js  (Closed) 
  Base URL: https://gitlab.com/eyeo/adblockplus/adblockpluschrome/tree/6323e74d580026e3bd1e8e631fcddaf0bbaa34df
    
  
    Issue 29901591:
  Issue 7020 - publish gecko with Node.js  (Closed) 
  Base URL: https://gitlab.com/eyeo/adblockplus/adblockpluschrome/tree/6323e74d580026e3bd1e8e631fcddaf0bbaa34df| Index: automation/publish.js | 
| diff --git a/options.js b/automation/publish.js | 
| similarity index 50% | 
| copy from options.js | 
| copy to automation/publish.js | 
| index 9b3b21b8a5e8d63941b67ad7d4d4a21bad966f5e..45951b6ff61bf88ea878752e3707c8496e4031f3 100644 | 
| --- a/options.js | 
| +++ b/automation/publish.js | 
| @@ -17,20 +17,28 @@ | 
| "use strict"; | 
| -let iframe = document.getElementById("content"); | 
| +const {ArgumentParser} = require("argparse"); | 
| +const fs = require("fs"); | 
| +const path = require("path"); | 
| -iframe.onload = () => | 
| -{ | 
| - document.title = iframe.contentDocument.title; | 
| -}; | 
| +let platforms = {}; | 
| -browser.runtime.sendMessage({ | 
| - type: "app.get", | 
| - what: "application" | 
| -}, | 
| -application => | 
| -{ | 
| - // Load the mobile version of the options page on Firefox for Android. | 
| - iframe.src = iframe.getAttribute("data-src-" + application) || | 
| - iframe.getAttribute("data-src"); | 
| +let parser = new ArgumentParser({ | 
| + help: "Deploy an Adblock Plus development build." | 
| +}); | 
| +let subParser = parser.addSubparsers({ | 
| + title: "Platforms", | 
| + dest: "platform_name" | 
| }); | 
| + | 
| +for (let file of fs.readdirSync(path.resolve("automation/target/"))) | 
| +{ | 
| + let target = path.basename(file, ".js"); | 
| + let platformSubParser = subParser.addParser(target, {addHelp: true}); | 
| + let module = require(path.resolve(`automation/target/${file}`)); | 
| + module.addArguments(platformSubParser); | 
| + platforms[target] = module; | 
| +} | 
| + | 
| +let args = parser.parseArgs(); | 
| +platforms[args.platform_name].run(args); | 
| 
kzar
2018/10/15 12:42:58
I guess if the platform doesn't exist we'll just g
 
tlucas
2018/10/15 14:12:39
That's what argparse does for you, e.g.:
$ npm ru
 
kzar
2018/10/15 14:46:10
Cool!
 |