add copytoken command
This commit is contained in:
parent
16499e0bb0
commit
085a282c96
|
@ -1,4 +1,5 @@
|
|||
const uuid = require('uuid/v1');
|
||||
const utils = require("../../utils/utils.js")
|
||||
|
||||
const ERROR_OBJ = {error: __('Wrong authentication token. Get your token from the Embark console by typing `token`')};
|
||||
|
||||
|
@ -32,10 +33,21 @@ class Authenticator {
|
|||
return {
|
||||
match: () => cmd === "token",
|
||||
process: (callback) => {
|
||||
callback(null, __('Your authentication token: %s', this.authToken));
|
||||
callback(null, __('Your authentication token: %s \nYou can use the command `copytoken` to copy the token your clipboard', this.authToken));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
this.embark.registerConsoleCommand((cmd, _options) => {
|
||||
return {
|
||||
match: () => cmd === "copytoken",
|
||||
process: (callback) => {
|
||||
utils.copyToClipboard(this.authToken)
|
||||
callback(null, __('Token copied to clipboard: %s', this.authToken));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
registerEvents() {
|
||||
|
|
|
@ -514,6 +514,11 @@ function fileTreeSort(nodes){
|
|||
return folders.concat(files);
|
||||
}
|
||||
|
||||
function copyToClipboard(text) {
|
||||
const clipboardy = require('clipboardy');
|
||||
clipboardy.writeSync(text);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
joinPath,
|
||||
dirname,
|
||||
|
@ -558,5 +563,6 @@ module.exports = {
|
|||
interceptLogs,
|
||||
errorMessage,
|
||||
timer,
|
||||
fileTreeSort
|
||||
fileTreeSort,
|
||||
copyToClipboard
|
||||
};
|
||||
|
|
|
@ -1005,7 +1005,7 @@
|
|||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
|
||||
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
|
||||
}
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@
|
|||
},
|
||||
"ambi": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "http://registry.npmjs.org/ambi/-/ambi-2.5.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/ambi/-/ambi-2.5.0.tgz",
|
||||
"integrity": "sha1-fI43K+SIkRV+fOoBy2+RQ9H3QiA=",
|
||||
"requires": {
|
||||
"editions": "^1.1.1",
|
||||
|
@ -1189,6 +1189,11 @@
|
|||
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
|
||||
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
|
||||
},
|
||||
"arch": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/arch/-/arch-2.1.1.tgz",
|
||||
"integrity": "sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg=="
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
|
@ -3303,6 +3308,36 @@
|
|||
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
|
||||
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
|
||||
},
|
||||
"clipboardy": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.2.3.tgz",
|
||||
"integrity": "sha512-2WNImOvCRe6r63Gk9pShfkwXsVtKCroMAevIbiae021mS850UkWPbevxsBz3tnvjZIEGvlwaqCPsw+4ulzNgJA==",
|
||||
"requires": {
|
||||
"arch": "^2.1.0",
|
||||
"execa": "^0.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz",
|
||||
"integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=",
|
||||
"requires": {
|
||||
"cross-spawn": "^5.0.1",
|
||||
"get-stream": "^3.0.0",
|
||||
"is-stream": "^1.1.0",
|
||||
"npm-run-path": "^2.0.0",
|
||||
"p-finally": "^1.0.0",
|
||||
"signal-exit": "^3.0.0",
|
||||
"strip-eof": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"cliui": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
|
||||
|
@ -5378,7 +5413,7 @@
|
|||
},
|
||||
"express": {
|
||||
"version": "4.16.3",
|
||||
"resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
||||
"requires": {
|
||||
"accepts": "~1.3.5",
|
||||
|
@ -5541,14 +5576,14 @@
|
|||
"dependencies": {
|
||||
"typechecker": {
|
||||
"version": "2.0.8",
|
||||
"resolved": "http://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz",
|
||||
"integrity": "sha1-6D2oS7ZMWEzLNFg4V2xAsDN9uC4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"external-editor": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
|
||||
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
|
||||
"requires": {
|
||||
"chardet": "^0.4.0",
|
||||
|
@ -5625,7 +5660,7 @@
|
|||
"dependencies": {
|
||||
"typechecker": {
|
||||
"version": "2.0.8",
|
||||
"resolved": "http://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.0.8.tgz",
|
||||
"integrity": "sha1-6D2oS7ZMWEzLNFg4V2xAsDN9uC4="
|
||||
}
|
||||
}
|
||||
|
@ -7123,7 +7158,7 @@
|
|||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"process": {
|
||||
|
@ -7324,7 +7359,7 @@
|
|||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
|
@ -9417,7 +9452,7 @@
|
|||
},
|
||||
"jsonfile": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
|
@ -9524,7 +9559,7 @@
|
|||
},
|
||||
"levenshtein-edit-distance": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "http://registry.npmjs.org/levenshtein-edit-distance/-/levenshtein-edit-distance-1.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/levenshtein-edit-distance/-/levenshtein-edit-distance-1.0.0.tgz",
|
||||
"integrity": "sha1-iVuvR4zOi1waDSfkXXwdl4pmHkk="
|
||||
},
|
||||
"levn": {
|
||||
|
@ -9927,7 +9962,7 @@
|
|||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"optional": true
|
||||
}
|
||||
|
@ -10192,7 +10227,7 @@
|
|||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
|
@ -10257,7 +10292,7 @@
|
|||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
|
@ -10545,7 +10580,7 @@
|
|||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
}
|
||||
}
|
||||
|
@ -10866,7 +10901,7 @@
|
|||
},
|
||||
"buffer": {
|
||||
"version": "4.9.1",
|
||||
"resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
|
||||
"integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=",
|
||||
"requires": {
|
||||
"base64-js": "^1.0.2",
|
||||
|
@ -10943,7 +10978,7 @@
|
|||
},
|
||||
"chalk": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "http://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz",
|
||||
"integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=",
|
||||
"requires": {
|
||||
"ansi-styles": "~1.0.0",
|
||||
|
@ -13424,7 +13459,7 @@
|
|||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
|
@ -14113,7 +14148,7 @@
|
|||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "http://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
|
||||
"integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
|
||||
"requires": {
|
||||
"graceful-readlink": ">= 1.0.0"
|
||||
|
@ -14387,7 +14422,7 @@
|
|||
},
|
||||
"sinon": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "http://registry.npmjs.org/sinon/-/sinon-4.5.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-4.5.0.tgz",
|
||||
"integrity": "sha512-trdx+mB0VBBgoYucy6a9L7/jfQOmvGeaKZT4OOJ+lPAtI8623xyGr8wLiE4eojzBS8G9yXbhx42GHUOVLr4X2w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -15403,7 +15438,7 @@
|
|||
},
|
||||
"table": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz",
|
||||
"integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==",
|
||||
"requires": {
|
||||
"ajv": "^6.0.1",
|
||||
|
@ -15495,7 +15530,7 @@
|
|||
"dependencies": {
|
||||
"bluebird": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "http://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
|
||||
"integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE="
|
||||
},
|
||||
"mout": {
|
||||
|
@ -15855,7 +15890,7 @@
|
|||
},
|
||||
"typechecker": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/typechecker/-/typechecker-2.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/typechecker/-/typechecker-2.1.0.tgz",
|
||||
"integrity": "sha1-0cIJOlT/ihn1jP+HfuqlTyJC04M="
|
||||
},
|
||||
"typedarray": {
|
||||
|
@ -17199,7 +17234,7 @@
|
|||
},
|
||||
"wrap-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||
"requires": {
|
||||
"string-width": "^1.0.1",
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
"body-parser": "^1.18.2",
|
||||
"check-dependencies": "1.1.0",
|
||||
"chokidar": "2.0.4",
|
||||
"clipboardy": "1.2.3",
|
||||
"clone-deep": "4.0.0",
|
||||
"colors": "1.3.2",
|
||||
"commander": "2.18.0",
|
||||
|
|
Loading…
Reference in New Issue