chalk and source maps

This commit is contained in:
Kyle Spearrin 2018-05-15 10:50:06 -04:00
parent d79cf6d9f8
commit eb83569f2f
7 changed files with 24 additions and 26 deletions

16
.vscode/launch.json vendored
View File

@ -7,18 +7,12 @@
"name": "Launch Program", "name": "Launch Program",
"protocol": "inspector", "protocol": "inspector",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js", "program": "${workspaceFolder}/build/bw.js",
"args": [ "args": [
"-r", "login",
"tsconfig-paths/register", "sdfsd@sdfdf.com",
"${workspaceFolder}/src/main.ts", "ddddddd"
"get", ]
"item",
"f6709d4f-69c3-4957-93e4-a82d01259693"
],
"env": {
"NODE_ENV": "debug"
},
} }
] ]
} }

2
jslib

@ -1 +1 @@
Subproject commit 17cf0599707090bcb2f3992e6b65f3f7809073f0 Subproject commit f173001a411acb39c0d2ebb11d17ea90d70ec784

15
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@bitwarden/cli", "name": "@bitwarden/cli",
"version": "1.0.0", "version": "0.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -81,7 +81,6 @@
"version": "3.2.1", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": { "requires": {
"color-convert": "1.9.1" "color-convert": "1.9.1"
} }
@ -546,7 +545,6 @@
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"dev": true,
"requires": { "requires": {
"ansi-styles": "3.2.1", "ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
@ -652,7 +650,6 @@
"version": "1.9.1", "version": "1.9.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz",
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==",
"dev": true,
"requires": { "requires": {
"color-name": "1.1.3" "color-name": "1.1.3"
} }
@ -660,8 +657,7 @@
"color-name": { "color-name": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
"dev": true
}, },
"commander": { "commander": {
"version": "2.15.1", "version": "2.15.1",
@ -1110,8 +1106,7 @@
"escape-string-regexp": { "escape-string-regexp": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
"dev": true
}, },
"escope": { "escope": {
"version": "3.6.0", "version": "3.6.0",
@ -2041,8 +2036,7 @@
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
"dev": true
}, },
"has-value": { "has-value": {
"version": "1.0.0", "version": "1.0.0",
@ -3722,7 +3716,6 @@
"version": "5.4.0", "version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": { "requires": {
"has-flag": "3.0.0" "has-flag": "3.0.0"
} }

View File

@ -45,6 +45,7 @@
"webpack": "^3.10.0" "webpack": "^3.10.0"
}, },
"dependencies": { "dependencies": {
"chalk": "2.4.1",
"commander": "2.15.1", "commander": "2.15.1",
"node-fetch": "2.1.2", "node-fetch": "2.1.2",
"node-forge": "0.7.1", "node-forge": "0.7.1",

View File

@ -12,8 +12,14 @@ export class CreateCommand {
constructor(private cipherService: CipherService, private folderService: FolderService) { } constructor(private cipherService: CipherService, private folderService: FolderService) { }
async run(object: string, requestData: string, cmd: program.Command): Promise<Response> { async run(object: string, requestData: string, cmd: program.Command): Promise<Response> {
const reqJson = new Buffer(requestData, 'base64').toString(); let req: any = null;
const req = JSON.parse(reqJson); try {
const reqJson = new Buffer(requestData, 'base64').toString();
req = JSON.parse(reqJson);
} catch (e) {
return Response.badRequest('Error parsing the encoded request data.');
}
switch (object.toLowerCase()) { switch (object.toLowerCase()) {
case 'item': case 'item':
return await this.createCipher(req); return await this.createCipher(req);

View File

@ -1,3 +1,4 @@
import * as chk from 'chalk';
import * as program from 'commander'; import * as program from 'commander';
import { Main } from './bw'; import { Main } from './bw';
@ -16,6 +17,8 @@ import { TemplateResponse } from './models/response/templateResponse';
import { Response } from './models/response'; import { Response } from './models/response';
const chalk = chk.default;
export class Program { export class Program {
constructor(private main: Main) { } constructor(private main: Main) { }
@ -124,7 +127,7 @@ export class Program {
} }
process.exit(); process.exit();
} else { } else {
process.stdout.write(response.message); process.stdout.write(chalk.redBright(response.message));
process.exit(1); process.exit(1);
} }
} }

View File

@ -47,6 +47,7 @@ const plugins = [
const config = { const config = {
target: 'node', target: 'node',
devtool: ENV === 'development' ? 'eval-source-map' : 'source-map',
node: { node: {
__dirname: false, __dirname: false,
__filename: false, __filename: false,