Comparing version 5.2.0-rc.4 to 5.2.0-rc.5
60
cli.js
@@ -10,7 +10,7 @@ 'use strict'; | ||
var version = "5.2.0-rc.4"; | ||
var version = "5.2.0-rc.5"; | ||
var help = "Usage: pagedip [--help] [--version]\n\n A Pagedip CLI tool.\n\nOptions\n -h, -H, --help Shows this message.\n -v, -V, --version Prints the version and exits."; | ||
var runCommands = [".babelrc", ".template", "api", "auth", "core", "couchdb-setup", "editor", "live", "setup", "theme", "theme-server"]; | ||
var apps = [".babelrc", ".template", "api", "auth", "couchdb-setup", "editor", "enterprise-edition", "live", "setup", "theme", "theme-server"]; | ||
@@ -161,5 +161,5 @@ var asyncGenerator = function () { | ||
let install = (() => { | ||
var install = function () { | ||
var _ref2 = asyncToGenerator(function* (args, config, logger) { | ||
yield require("./").install(args, { logger }); | ||
yield require("./").install(args, { logger: logger }); | ||
}); | ||
@@ -170,25 +170,28 @@ | ||
}; | ||
})(); | ||
}(); | ||
let run = (() => { | ||
var run = function () { | ||
var _ref3 = asyncToGenerator(function* (args, config, logger) { | ||
const { load } = require("./"); | ||
let cmd; | ||
var _require = require("./"), | ||
load = _require.load; | ||
var cmd = void 0; | ||
try { | ||
cmd = yield load(args[0], { logger }); | ||
cmd = yield load(args[0], { logger: logger }); | ||
} catch (e) { | ||
if (e.code !== "MODULE_NOT_FOUND") throw e; | ||
const { confirm } = yield inquirer.prompt([{ | ||
var _ref4 = yield inquirer.prompt([{ | ||
type: "confirm", | ||
name: "confirm", | ||
message: `Could not locate a package named '${args[0]}'. Do you want to attempt to install it?`, | ||
message: "Could not locate a package named '" + args[0] + "'. Do you want to attempt to install it?", | ||
default: true | ||
}]); | ||
}]), | ||
confirm = _ref4.confirm; | ||
if (!confirm) throw e; | ||
yield install(args[0], config, { logger }); | ||
cmd = yield load(args[0], { logger }); | ||
yield install(args[0], config, { logger: logger }); | ||
cmd = yield load(args[0], { logger: logger }); | ||
} | ||
@@ -202,6 +205,6 @@ | ||
}; | ||
})(); | ||
}(); | ||
let register = (() => { | ||
var _ref4 = asyncToGenerator(function* (args) { | ||
var register = function () { | ||
var _ref5 = asyncToGenerator(function* (args) { | ||
yield require("./").register(args[0]); | ||
@@ -211,11 +214,11 @@ }); | ||
return function register(_x10) { | ||
return _ref4.apply(this, arguments); | ||
return _ref5.apply(this, arguments); | ||
}; | ||
})(); | ||
}(); | ||
var cli = command("pagedip", { | ||
module | ||
}, (() => { | ||
module: module | ||
}, function () { | ||
var _ref = asyncToGenerator(function* (args, config, logger) { | ||
const isApp = runCommands.includes(args[0]); | ||
var isApp = apps.includes(args[0]); | ||
@@ -226,3 +229,3 @@ if (!isApp && this.help()) { | ||
} else if (!isApp && this.version()) { | ||
logger.info(`${name} ${version}`); | ||
logger.info(name + " " + version); | ||
return; | ||
@@ -244,2 +247,11 @@ } | ||
case "start": | ||
case "server": | ||
case "ee": | ||
{ | ||
var eeArgs = ["enterprise-edition"].concat(args.slice(1)); | ||
yield run.call(this, eeArgs, config, logger); | ||
break; | ||
} | ||
default: | ||
@@ -258,4 +270,4 @@ if (isApp) { | ||
}; | ||
})()); | ||
}()); | ||
module.exports = cli; |
78
index.js
@@ -184,2 +184,46 @@ 'use strict'; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
function formatPackageName(pkg) { | ||
@@ -197,7 +241,7 @@ if (typeof pkg !== "string" || !pkg) { | ||
let npmCli; | ||
let npmPath = (() => { | ||
var npmCli = void 0; | ||
var npmPath = function () { | ||
var _ref = asyncToGenerator(function* () { | ||
if (npmCli) return npmCli; | ||
const p = yield getNpmCliPath(); | ||
var p = yield getNpmCliPath(); | ||
npmCli = p; | ||
@@ -210,10 +254,10 @@ return p; | ||
}; | ||
})(); | ||
}(); | ||
let npmCommand = (() => { | ||
var npmCommand = function () { | ||
var _ref2 = asyncToGenerator(function* (args) { | ||
const cli = yield npmPath(); | ||
var cli = yield npmPath(); | ||
return yield new Promise(function (resolve$$1, reject) { | ||
const cp = child_process.spawn("node", [cli, ...args], { | ||
var cp = child_process.spawn("node", [cli].concat(toConsumableArray(args)), { | ||
stdio: "inherit" | ||
@@ -233,3 +277,3 @@ }); | ||
}; | ||
})(); | ||
}(); | ||
@@ -240,3 +284,3 @@ function npmInstall(pkgname) { | ||
var install = (() => { | ||
var install = (function () { | ||
var _ref = asyncToGenerator(function* (pkgs, opts) { | ||
@@ -247,3 +291,3 @@ if (!Array.isArray(pkgs)) pkgs = pkgs == null ? [] : [pkgs]; | ||
for (let i = 0; i < pkgs.length; i++) { | ||
for (var i = 0; i < pkgs.length; i++) { | ||
if (opts.logger) opts.logger.debug("Installing package '%s'", pkgs[i]); | ||
@@ -261,7 +305,7 @@ yield npmInstall(formatPackageName(pkgs[i])); | ||
var load = (() => { | ||
var load = (function () { | ||
var _ref = asyncToGenerator(function* (pkgname, opts) { | ||
const cliFile = yield resolve__default(pkgname, _extends({}, opts, { | ||
var cliFile = yield resolve__default(pkgname, _extends({}, opts, { | ||
leads: ["@pagedip/", ""], | ||
packageFilter(pkg) { | ||
packageFilter: function packageFilter(pkg) { | ||
if (pkg.command) pkg.main = pkg.command;else delete pkg.main; | ||
@@ -273,3 +317,3 @@ return pkg; | ||
if (!cliFile) { | ||
const err = new Error(`Could not find package '${pkgname}'.`); | ||
var err = new Error("Could not find package '" + pkgname + "'."); | ||
err.code = "MODULE_NOT_FOUND"; | ||
@@ -289,7 +333,7 @@ throw err; | ||
var register = (() => { | ||
var register = (function () { | ||
var _ref = asyncToGenerator(function* (license) { | ||
yield fs.writeFile(path.join(libRc.globalPath, ".pdlicense"), license); | ||
yield child_process$1.exec(`npm config set @pagedip:registry https://license.system.pagedip.com/npm`); | ||
yield child_process$1.exec(`npm config set //license.system.pagedip.com/:_authToken ${license}`); | ||
yield child_process$1.exec("npm config set @pagedip:registry https://license.system.pagedip.com/npm"); | ||
yield child_process$1.exec("npm config set //license.system.pagedip.com/:_authToken " + license); | ||
}); | ||
@@ -296,0 +340,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"public": true, | ||
"version": "5.2.0-rc.4", | ||
"version": "5.2.0-rc.5", | ||
"author": "Tyler Johnson <tyler@beneaththeink.com>", | ||
@@ -27,4 +27,4 @@ "repository": { | ||
"dependencies": { | ||
"@pagedip/lib-command": "^1.0.0-rc.4", | ||
"@pagedip/lib-rc": "^1.0.0-rc.4", | ||
"@pagedip/lib-command": "^1.0.0-rc.5", | ||
"@pagedip/lib-rc": "^1.0.0-rc.5", | ||
"@pagedip/util-resolve": "^1.0.0-rc.3", | ||
@@ -46,3 +46,3 @@ "inquirer": "^3.1.1", | ||
], | ||
"gitHead": "5f9462413e50a8f6396637db57e689a387bd25c4" | ||
"gitHead": "949f92ca2fd03cacbcd26b51577adc1a7cc59bc0" | ||
} |
14355
455