Skip to content

Commit

Permalink
chore(deps): add missing deps
Browse files Browse the repository at this point in the history
chore: fix simple compilation errors
  • Loading branch information
midnqp committed Mar 9, 2023
1 parent dc09e66 commit 2f89562
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pcli",
"version": "0.0.3",
"type": "module",
"main": "./src/index.js",
"scripts": {
Expand All @@ -18,14 +19,17 @@
"browserify": "^17.0.0",
"chai": "^4.3.7",
"chalk": "^5.2.0",
"clean-stack": "^5.1.0",
"commander": "^9.4.0",
"content-type": "^1.0.4",
"dotenv": "^16.0.1",
"enquirer": "^2.3.6",
"fs-extra": "^11.1.0",
"lodash": "^4.17.21",
"newman": "^5.3.2",
"open": "^8.4.2",
"postman-collection": "^4.1.5",
"tmp": "^0.2.1",
"uuid": "^9.0.0",
"webpack-cli": "^5.0.1",
"winston": "^3.8.2"
Expand All @@ -43,14 +47,15 @@
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"esbuild": "^0.17.11",
"eslint": "^8.33.0",
"express": "^4.18.2",
"pkg": "^5.8.0",
"pretty-bytes": "^6.1.0",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.2",
"tsc-watch": "^5.0.3",
"typescript": "^4.7.4",
"typescript": "^4.9.5",
"webpack": "^5.74.0"
},
"bundleDependencies": [
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Command } from 'commander'
import util from 'node:util'
import _ from 'lodash'
import Enquirer from 'enquirer'
import openeditor from 'open-editor'
import editor from '@inquirer/editor'
import open from 'open'
import tmp from 'tmp'
import fs from 'node:fs'
Expand Down Expand Up @@ -87,7 +85,7 @@ export default async function (
}
const response = new psdk.Response({
code: parsed.response.code,
responseTime: parsed.response.time,
responseTime: parsed.response.time || 0,
body: JSON.stringify(parsed.response.body),
header: services.common.jsonToHeaders(parsed.response.headers),

Expand Down
16 changes: 5 additions & 11 deletions src/services/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import util, { inspect } from 'node:util'
import lodash from 'lodash'
import newman, { NewmanRunOptions, NewmanRunSummary } from 'newman'
import services from '@src/services/index.js'
import pretty from 'js-object-pretty-print'

export class CommonService {
_ = lodash
Expand Down Expand Up @@ -41,16 +40,11 @@ export class CommonService {
* into JSON-parsable string.
*/
toJsonString(input: string) {
//const keyMatcher = '([^",{}\\s]+?)'
//const valMatcher = '(.,*)'
//const matcher = new RegExp(`${keyMatcher}\\s*:\\s*${valMatcher}`, 'g')
//const parser = (_, key, value) => `"${key}":${value}`
//return input.replace(matcher, parser)

//return input.replace(/([\$\w]+)\s*:/g, function (_, $1) {return '"' + $1 + '":'})
//.replace(/'([^']+)'/g, function (_, $1) {return '"' + $1 + '"'})

return pretty.pretty(input, 4, 'JSON')
const keyMatcher = '([^",{}\\s]+?)'
const valMatcher = '(.,*)'
const matcher = new RegExp(`${keyMatcher}\\s*:\\s*${valMatcher}`, 'g')
const parser = (_, key, value) => `"${key}":${value}`
return input.replace(matcher, parser)
}

isJson(input: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/services/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class ResponseService {
headers,
body: rawBody,
size: r.size() as any,
time: r.responseTime,
time: r.responseTime || 0,
code: r.code,
status: r.status,
$parsedBody,
Expand Down

0 comments on commit 2f89562

Please sign in to comment.