Comparing version 5.2.0-rc.3 to 5.2.0-rc.4
119
cli.js
@@ -10,8 +10,123 @@ 'use strict'; | ||
var version = "5.2.0-rc.3"; | ||
var version = "5.2.0-rc.4"; | ||
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", "api", "auth", "core", "couchdb-setup", "editor", "live", "setup", "theme"]; | ||
var runCommands = [".babelrc", ".template", "api", "auth", "core", "couchdb-setup", "editor", "live", "setup", "theme", "theme-server"]; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var asyncToGenerator = function (fn) { | ||
@@ -18,0 +133,0 @@ return function () { |
174
index.js
@@ -11,8 +11,122 @@ 'use strict'; | ||
var resolve__default = _interopDefault(resolve); | ||
var fs = _interopDefault(require('mz/fs')); | ||
var child_process$1 = require('mz/child_process'); | ||
var libRc = require('@pagedip/lib-rc'); | ||
var path = require('path'); | ||
var findUp = _interopDefault(require('find-up')); | ||
var fs = _interopDefault(require('mz/fs')); | ||
var mz_child_process = require('mz/child_process'); | ||
var _pagedip_libRc = require('@pagedip/lib-rc'); | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve$$1, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve$$1, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var asyncToGenerator = function (fn) { | ||
@@ -142,33 +256,5 @@ return function () { | ||
let lerna; | ||
try { | ||
lerna = require("lerna"); | ||
} catch (e) { | ||
// eat errors | ||
} | ||
let resolveCli = (() => { | ||
var load = (() => { | ||
var _ref = asyncToGenerator(function* (pkgname, opts) { | ||
lernaif: if (lerna) { | ||
const lernafile = yield findUp("lerna.json", { cwd: __dirname }); | ||
if (!lernafile) break lernaif; | ||
const ls = new lerna.LsCommand(["ls"], {}, path.dirname(lernafile)); | ||
ls.runValidations(); | ||
ls.runPreparations(); | ||
yield new Promise(function (r) { | ||
return ls._attempt("initialize", r); | ||
}); | ||
const lpkgname = formatPackageName(pkgname); | ||
const pkg = ls.packages.find(function ({ name }) { | ||
return name === lpkgname; | ||
}); | ||
if (!pkg) break lernaif; | ||
pkgname = pkg.location; | ||
} | ||
return yield resolve__default(pkgname, _extends({}, opts, { | ||
const cliFile = yield resolve__default(pkgname, _extends({}, opts, { | ||
leads: ["@pagedip/", ""], | ||
@@ -180,13 +266,3 @@ packageFilter(pkg) { | ||
})); | ||
}); | ||
return function resolveCli(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
})(); | ||
var load = (() => { | ||
var _ref2 = asyncToGenerator(function* (pkgname, opts) { | ||
const cliFile = yield resolveCli(pkgname, opts); | ||
if (!cliFile) { | ||
@@ -201,4 +277,4 @@ const err = new Error(`Could not find package '${pkgname}'.`); | ||
function load(_x3, _x4) { | ||
return _ref2.apply(this, arguments); | ||
function load(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
} | ||
@@ -211,5 +287,5 @@ | ||
var _ref = asyncToGenerator(function* (license) { | ||
yield fs.writeFile(path.join(_pagedip_libRc.globalPath, ".pdlicense"), license); | ||
yield mz_child_process.exec(`npm config set @pagedip:registry https://license.system.pagedip.com/npm`); | ||
yield mz_child_process.exec(`npm config set //license.system.pagedip.com/:_authToken ${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}`); | ||
}); | ||
@@ -216,0 +292,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"public": true, | ||
"version": "5.2.0-rc.3", | ||
"version": "5.2.0-rc.4", | ||
"author": "Tyler Johnson <tyler@beneaththeink.com>", | ||
@@ -18,16 +18,16 @@ "repository": { | ||
"clean": "shx rm -f index.js test.js cli.js", | ||
"build-lib": "rollup src/index.js -c > index.js", | ||
"build-cli": "rollup src/cli.js -c > cli.js", | ||
"build-test": "rollup test/index.js -c > test.js", | ||
"build": "npm-run-all clean build-lib build-cli", | ||
"test": "npm run build-test && node test.js", | ||
"build:full": "npm-run-all clean build", | ||
"build:lib": "rollup src/index.js -c > index.js", | ||
"build:cli": "rollup src/cli.js -c > cli.js", | ||
"build:test": "rollup test/index.js -c > test.js", | ||
"build": "run-p build:lib build:cli", | ||
"test": "npm run build:test && node test.js", | ||
"prepublish": "npm run build" | ||
}, | ||
"dependencies": { | ||
"@pagedip/lib-command": "^1.0.0-rc.3", | ||
"@pagedip/lib-rc": "^1.0.0-rc.3", | ||
"@pagedip/util-resolve": "^1.0.0-rc.2", | ||
"find-up": "^2.1.0", | ||
"@pagedip/lib-command": "^1.0.0-rc.4", | ||
"@pagedip/lib-rc": "^1.0.0-rc.4", | ||
"@pagedip/util-resolve": "^1.0.0-rc.3", | ||
"inquirer": "^3.1.1", | ||
"mz": "^2.6.0", | ||
"mz": "^2.7.0", | ||
"npm-cli-path": "^2.0.0" | ||
@@ -37,4 +37,4 @@ }, | ||
"@pagedip/tool-rollup-cli-help": "*", | ||
"npm-run-all": "^4.0.2", | ||
"rollup": "^0.43.0", | ||
"npm-run-all": "^4.1.1", | ||
"rollup": "^0.50.0", | ||
"shx": "^0.2.2" | ||
@@ -47,3 +47,3 @@ }, | ||
], | ||
"gitHead": "40ef4eddbc8dea35fb802ee65a6067eeaa13360b" | ||
"gitHead": "5f9462413e50a8f6396637db57e689a387bd25c4" | ||
} |
13680
6
437
- Removedfind-up@^2.1.0
Updated@pagedip/lib-rc@^1.0.0-rc.4
Updatedmz@^2.7.0