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

2
jslib

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

15
package-lock.json generated
View File

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

View File

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

View File

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

View File

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

View File

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