From a8399e8fe9636c4cde8b3fd159b56038344fdca5 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Tue, 10 Sep 2019 12:40:34 -0700 Subject: [PATCH 1/6] initial implementation for utils package --- package.json | 2 +- packages/client/package.json | 2 +- packages/utils/README.md | 75 +++++++++++++++++++++++++++++ packages/utils/package.json | 80 +++++++++++++++++++++++++++++++ packages/utils/src/createDebug.ts | 5 ++ packages/utils/src/index.ts | 3 ++ packages/utils/src/tmpDir.ts | 7 +++ packages/utils/src/using.ts | 23 +++++++++ tsconfig.json | 2 +- yarn.lock | 53 ++++++++++++++++++++ 10 files changed, 249 insertions(+), 3 deletions(-) create mode 100644 packages/utils/README.md create mode 100644 packages/utils/package.json create mode 100644 packages/utils/src/createDebug.ts create mode 100644 packages/utils/src/index.ts create mode 100644 packages/utils/src/tmpDir.ts create mode 100644 packages/utils/src/using.ts diff --git a/package.json b/package.json index 24c6679..8f9b489 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "MIT", "scripts": { "prepare": "patch-package", - "build": "rm -rf ./dist && tsc -p ./tsconfig.prod.json && (cd packages/client/ && yarn build)", + "build": "rm -rf ./dist && tsc -p ./tsconfig.prod.json && (cd packages/client/ && yarn build) && (cd packages/utils/ && yarn build)", "tsc": "tsc -p . --noEmit && tsc -p ./tsconfig.prod.json --noEmit", "tslint": "tslint -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' 'packages/**/*.ts'", "tslint:fix": "tslint --fix --format stylish -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' 'packages/**/*.ts'", diff --git a/packages/client/package.json b/packages/client/package.json index cca144d..69d0384 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -21,7 +21,7 @@ "types": "dist/index.d.ts", "license": "MIT", "scripts": { - "build": "rm -rf ./dist && cp -R '../../dist/client/' ./dist/ && cp -R ./src/js ./dist/js && chmod +x ./dist/runner.js", + "build": "rm -rf ./dist && cp -R '../../dist/client/src/' ./dist/ && cp -R ./src/js ./dist/js && chmod +x ./dist/runner.js", "prepublishOnly": "cd ../../ && yarn build" }, "dependencies": { diff --git a/packages/utils/README.md b/packages/utils/README.md new file mode 100644 index 0000000..a09e1dc --- /dev/null +++ b/packages/utils/README.md @@ -0,0 +1,75 @@ +

+ codechecks.io +

Code Checks

+

+ Open source platform for code review automation ✅ +

+

+ Build Status + Software License + All Contributors + codechecks.io +

+

+ +**CodeChecks.io** is a framework for code review automation. It allows writing plugins (codechecks) in **JavaScript** +that: + +- execute directly on your **CI** (like CircleCI or TravisCI) and communicate with our backend +- can inspect all **Pull Request** data (title, content, changed files etc.) +- can attach feedback information back to **GitHub** as check (success/failure status, additional message) +- can upload, retrieve and calculate difference between arbitrary **artifacts** (like JSON values describing build size + or screenshots of views of a frontend app) +- require only one **GitHub App** — [Codechecks App](https://github.com/apps/codechecks) installed in order to work + +```typescript +import { codechecks } from "@codechecks/client"; + +export default async () => { + await codechecks.success({ + name: "Hello world!", + shortDescription: "It's so easy!", + longDescription: "# Hello! 👋", + }); +}; +``` + +![](images/demo.gif) + +Particular codechecks can be distributed as **npm** packages and can be setup in a declarative way in +[`codechecks.yml`](https://github.com/codechecks/docs/blob/master/configuration.md#codechecksyml) file. + +## Install + +```sh +npm add --save-dev @codechecks/client +``` + +## Docs 📚 + +- [Awesome codechecks](https://github.com/codechecks/awesome-codechecks) +- [Getting started guide](https://github.com/codechecks/docs/blob/master/getting-started.md) +- [Full documentation](https://github.com/codechecks/docs) + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + + + + +
Chris Kaczor
Chris Kaczor

💻 🤔 📖 💼 🚇
cgewecke
cgewecke

🔌 🤔 💻
Evgeniy Timokhov
Evgeniy Timokhov

🔌
Michał Załęcki
Michał Załęcki

💻 🔌
Craig Thompson
Craig Thompson

💻
Jakub Ziółkowski
Jakub Ziółkowski

💻 🔌
Deric Cain
Deric Cain

💻
+ + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. +Contributions of any kind welcome! [Read more](./CONTRIBUTING.md)! diff --git a/packages/utils/package.json b/packages/utils/package.json new file mode 100644 index 0000000..fd70232 --- /dev/null +++ b/packages/utils/package.json @@ -0,0 +1,80 @@ +{ + "name": "@codechecks/utils", + "description": "Open source platform for code review automation", + "keywords": [ + "code-review", + "code", + "review", + "codechecks", + "automation", + "continuous-review", + "github", + "pull-request" + ], + "repository": "codechecks/monorepo", + "author": "Chris Kaczor ", + "version": "0.1.0", + "main": "dist/index.js", + "bin": { + "codechecks": "dist/runner.js" + }, + "types": "dist/index.d.ts", + "license": "MIT", + "scripts": { + "build": "rm -rf ./dist && cp -R '../../dist/utils/src/' ./dist/", + "prepublishOnly": "cd ../../ && yarn build" + }, + "dependencies": { + "@types/debug": "^4.1.5", + "bluebird": "^3.5.3", + "chalk": "^2.4.2", + "commander": "^2.19.0", + "debug": "^4.1.1", + "execa": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.1.15", + "js-yaml": "^3.13.1", + "json5": "^2.1.0", + "lodash": "^4.17.15", + "marked": "^0.7.0", + "marked-terminal": "^3.3.0", + "mkdirp": "^0.5.1", + "ms": "^2.1.1", + "promise": "^8.0.2", + "promise-all": "^1.0.0", + "request": "^2.88.0", + "request-promise": "^4.2.2", + "tmp-promise": "^2.0.2", + "ts-essentials": "^3.0.2", + "ts-node": "^8.0.2", + "url-join": "^4.0.0" + }, + "devDependencies": { + "@codechecks/ban-deps-codecheck": "^0.1.0", + "@types/bluebird": "^3.5.26", + "@types/execa": "^0.9.0", + "@types/fs-extra": "^8.0.0", + "@types/glob": "^7.1.1", + "@types/graceful-fs": "^4.1.3", + "@types/js-yaml": "^3.12.1", + "@types/lodash": "^4.14.138", + "@types/marked": "^0.6.5", + "@types/marked-terminal": "^3.1.1", + "@types/mkdirp": "^0.5.2", + "@types/mock-fs": "^3.6.30", + "@types/ms": "^0.7.30", + "@types/request-promise": "^4.1.42", + "@types/tmp": "^0.1.0", + "fs-extra": "^8.1.0", + "mock-fs": "^4.10.1" + }, + "files": [ + "dist/**/*" + ], + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=6" + } +} diff --git a/packages/utils/src/createDebug.ts b/packages/utils/src/createDebug.ts new file mode 100644 index 0000000..e9bcd23 --- /dev/null +++ b/packages/utils/src/createDebug.ts @@ -0,0 +1,5 @@ +import * as debugLib from "debug"; + +export function createDebug(name: string): debugLib.Debugger { + return debugLib(`codechecks:${name}`); +} diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts new file mode 100644 index 0000000..ecf5f30 --- /dev/null +++ b/packages/utils/src/index.ts @@ -0,0 +1,3 @@ +export * from "./createDebug"; +export * from "./using"; +export * from "./tmpDir"; \ No newline at end of file diff --git a/packages/utils/src/tmpDir.ts b/packages/utils/src/tmpDir.ts new file mode 100644 index 0000000..7826c41 --- /dev/null +++ b/packages/utils/src/tmpDir.ts @@ -0,0 +1,7 @@ +import { dir } from "tmp-promise"; + +export async function tmpDir(): Promise { + const { path: tmpPathDir } = await dir({ prefix: "codechecks" }); + + return tmpPathDir; +} diff --git a/packages/utils/src/using.ts b/packages/utils/src/using.ts new file mode 100644 index 0000000..8ac7bfe --- /dev/null +++ b/packages/utils/src/using.ts @@ -0,0 +1,23 @@ +import { AsyncOrSync } from "ts-essentials"; +import { mapValues } from "lodash"; +import { Dictionary } from "ts-essentials"; +const promiseAll = require("promise-all"); + +export type DisposableResource = { + resource: T; + dispose: () => AsyncOrSync; +}; + +declare type DisposableResourceMap = { + [P in keyof T]: T[P] extends () => AsyncOrSync> ? R : never +}; +export async function using AsyncOrSync>>>( + disposable: T, + fn: (resources: DisposableResourceMap) => any, +): Promise { + const allDisposablePromises = promiseAll(mapValues(disposable, d => d())); + const resources = await Promise.all(allDisposablePromises); + await fn(resources as any); + const disposeAllResources = (resources as any).map((r: any) => r()); + await disposeAllResources; +} diff --git a/tsconfig.json b/tsconfig.json index 4b2acbc..fb528eb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "lib": ["es2015", "esnext.asynciterable", "dom"], "sourceMap": true, "declaration": true, - "outDir": "dist/client", + "outDir": "./dist", "baseUrl": "packages", "paths": { "codechecks": ["client/src"] diff --git a/yarn.lock b/yarn.lock index 25f71ec..0f41d1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -933,6 +933,11 @@ resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8" integrity sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w== +"@types/debug@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" + integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== + "@types/dotenv@^6.1.0": version "6.1.0" resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-6.1.0.tgz#fba2bfd1f28a46eadaa049f3313ebb89bdedfc53" @@ -1014,6 +1019,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.135.tgz#d2607c35dd68f70c2b35ba020c667493dedd8447" integrity sha512-Ed+tSZ9qM1oYpi5kzdsBuOzcAIn1wDW+e8TFJ50IMJMlSopGdJgKAbhHzN6h1E1OfjlGOr2JepzEWtg9NIfoNg== +"@types/lodash@^4.14.138": + version "4.14.138" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.138.tgz#34f52640d7358230308344e579c15b378d91989e" + integrity sha512-A4uJgHz4hakwNBdHNPdxOTkYmXNgmUAKLbXZ7PKGslgeV0Mb8P3BlbYfPovExek1qnod4pDfRbxuzcVs3dlFLg== + "@types/marked-terminal@^3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@types/marked-terminal/-/marked-terminal-3.1.1.tgz#130214af1afafda611f69e8528c07230a00b32b2" @@ -1079,6 +1089,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/tmp@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.1.0.tgz#19cf73a7bcf641965485119726397a096f0049bd" + integrity sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA== + "@types/tough-cookie@*": version "2.3.5" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d" @@ -4402,6 +4417,11 @@ lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@^4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + loose-envify@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -5468,6 +5488,13 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== +promise-all@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/promise-all/-/promise-all-1.0.0.tgz#96f2c71973c94f1126f000463648e13a2d100b84" + integrity sha1-lvLHGXPJTxEm8ABGNkjhOi0QC4Q= + dependencies: + is-plain-object "^2.0.1" + promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" @@ -5922,6 +5949,13 @@ rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: dependencies: glob "^7.0.5" +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + rsvp@^4.8.4: version "4.8.4" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" @@ -6524,6 +6558,20 @@ timed-out@^4.0.0: resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= +tmp-promise@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-2.0.2.tgz#ee605edb10f100954be5dd8b9dbe1bfd56194202" + integrity sha512-zl71nFWjPKW2KXs+73gEk8RmqvtAeXPxhWDkTUoa3MSMkjq3I+9OeknjF178MQoMYsdqL730hfzvNfEkePxq9Q== + dependencies: + tmp "0.1.0" + +tmp@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877" + integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw== + dependencies: + rimraf "^2.6.3" + tmp@^0.0.31: version "0.0.31" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" @@ -6626,6 +6674,11 @@ ts-essentials@^1.0.2: resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.2.tgz#ae3e50824e06ea8fbe7e25179a41c3618f79b798" integrity sha512-D9TbEdIS+809h3tEESsHwgRFz0FtaCUEXCadqyFW9dw1/eMWjMeGzBsfkestAPexfNxMky6Fu1acI25XrgpIrw== +ts-essentials@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-3.0.2.tgz#143a60857a97c0e431b12bddbc4f3a7d7f3c40d4" + integrity sha512-vOdAnCS2tt+4fML/Xnf5iWvr+3bAhG0odly05UprbuwgI5hfRhUZ9a+K3hdYSSM0TPRn8/VS3F4Pza1uNqsTKw== + ts-jest@^24.0.1: version "24.0.1" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.0.1.tgz#77258061cc354c3fa8616b8ac03baa0f8580f854" From 44df3450de92760d62c0ee3b588479b92b0b4e52 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Mon, 16 Sep 2019 04:37:42 +0200 Subject: [PATCH 2/6] add execa adapter, add disposableTmpDir --- packages/utils/package.json | 1 + packages/utils/src/execute.ts | 43 ++++++++++++++++++++++ packages/utils/src/tmpDir.ts | 24 +++++++++++-- packages/utils/src/using.ts | 13 ++++--- yarn.lock | 68 ++++++++++++++++++++++++++++++++++- 5 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 packages/utils/src/execute.ts diff --git a/packages/utils/package.json b/packages/utils/package.json index fd70232..4b63963 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -65,6 +65,7 @@ "@types/ms": "^0.7.30", "@types/request-promise": "^4.1.42", "@types/tmp": "^0.1.0", + "execa": "^2.0.4", "fs-extra": "^8.1.0", "mock-fs": "^4.10.1" }, diff --git a/packages/utils/src/execute.ts b/packages/utils/src/execute.ts new file mode 100644 index 0000000..f6b1d61 --- /dev/null +++ b/packages/utils/src/execute.ts @@ -0,0 +1,43 @@ +import * as execa from "execa"; +import * as stream from "stream"; + +interface SharedOptions extends execa.CommonOptions {} + +interface ExecuteOptions extends SharedOptions { + file: string; + args?: string[]; +} +interface ExecuteCommandOptions extends SharedOptions { + cmd: string; +} + +type ExecuteResult = execa.ExecaChildProcess; + +export function execute(options: ExecuteOptions): ExecuteResult { + return execa(options.file, options.args, options); +} + +export function executeCommand(options: ExecuteCommandOptions): ExecuteResult { + return execa.command(options.cmd, options); +} + +function timeoutIfNoData(stream: stream.Readable, interval: number, fn: Function): void { + // probably we could convert nodejs stream to rxjs and avoid this code + let timeoutHook = setTimeout(fn, interval); + + stream.on("data", () => { + clearTimeout(timeoutHook); + timeoutHook = setTimeout(fn, interval); + }); + + stream.on("error", () => { + clearTimeout(timeoutHook); + }); + + stream.on("close", () => { + clearTimeout(timeoutHook); + }); + stream.on("end", () => { + clearTimeout(timeoutHook); + }); +} diff --git a/packages/utils/src/tmpDir.ts b/packages/utils/src/tmpDir.ts index 7826c41..eefa383 100644 --- a/packages/utils/src/tmpDir.ts +++ b/packages/utils/src/tmpDir.ts @@ -1,7 +1,27 @@ import { dir } from "tmp-promise"; +import { DisposableResource } from "./using"; +import { createDebug } from "./createDebug"; -export async function tmpDir(): Promise { - const { path: tmpPathDir } = await dir({ prefix: "codechecks" }); +const SHARED_PREFIX = "codechecks"; + +const debug = createDebug("utils/tmp-dir"); + +export async function createTmpDir(): Promise { + const { path: tmpPathDir } = await dir({ prefix: SHARED_PREFIX }); + debug(`Created tmp dir:`, tmpPathDir); return tmpPathDir; } + +export async function disposableTmpDir(): Promise> { + const tmpDir = await dir({ prefix: SHARED_PREFIX }); + debug(`Created tmp dir:`, tmpDir.path); + + return { + resource: tmpDir.path, + dispose: async () => { + debug(`Deleting tmp dir:`, tmpDir.path); + await tmpDir.cleanup(); + }, + }; +} diff --git a/packages/utils/src/using.ts b/packages/utils/src/using.ts index 8ac7bfe..4c2218e 100644 --- a/packages/utils/src/using.ts +++ b/packages/utils/src/using.ts @@ -11,13 +11,16 @@ export type DisposableResource = { declare type DisposableResourceMap = { [P in keyof T]: T[P] extends () => AsyncOrSync> ? R : never }; + export async function using AsyncOrSync>>>( disposable: T, fn: (resources: DisposableResourceMap) => any, ): Promise { - const allDisposablePromises = promiseAll(mapValues(disposable, d => d())); - const resources = await Promise.all(allDisposablePromises); - await fn(resources as any); - const disposeAllResources = (resources as any).map((r: any) => r()); - await disposeAllResources; + const allDisposablePromises = mapValues(disposable, d => d()); + const resources = await promiseAll(allDisposablePromises); + + await fn(resources as any); + + const disposeAllResources = mapValues(resources, r => r.dispose()); + await promiseAll(disposeAllResources); } diff --git a/yarn.lock b/yarn.lock index 0f41d1d..cd30242 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2076,7 +2076,7 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -2503,6 +2503,21 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.4.tgz#2f5cc589c81db316628627004ea4e37b93391d8e" + integrity sha512-VcQfhuGD51vQUQtKIq2fjGDLDbL6N1DTQVpYzxZ7LPIXw3HqTuIz6uxRmpV1qf8i31LHf2kjiaGI+GdHwRgbnQ== + dependencies: + cross-spawn "^6.0.5" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -2868,6 +2883,13 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -3523,6 +3545,11 @@ is-stream@^1.0.0, is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + is-subset@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" @@ -4586,6 +4613,11 @@ merge-stream@^1.0.1: dependencies: readable-stream "^2.0.1" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + merge2@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" @@ -4627,6 +4659,11 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + minimatch@3, minimatch@^3.0.0, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -5026,6 +5063,13 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== + dependencies: + path-key "^3.0.0" + "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.2, npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -5106,6 +5150,13 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -5179,6 +5230,11 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + p-is-promise@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" @@ -5379,6 +5435,11 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +path-key@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3" + integrity sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg== + path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -6380,6 +6441,11 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" From 3f7de40e7f3ae27741159167b5ecc0a793165823 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Mon, 16 Sep 2019 04:54:32 +0200 Subject: [PATCH 3/6] cleanup utils package, update typescript --- package.json | 2 +- packages/utils/package.json | 33 ++------------------------------- packages/utils/src/execute.ts | 24 +----------------------- packages/utils/src/index.ts | 3 ++- packages/utils/src/using.ts | 2 +- yarn.lock | 8 ++++---- 6 files changed, 11 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 8f9b489..4e99566 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "ts-node": "^7.0.1", "tsconfig-paths": "^3.7.0", "tslint": "^5.11.0", - "typescript": "^3.1.6", + "typescript": "^3.6.3", "typestrict": "^1.0.1", "wsrun": "^5.0.0" }, diff --git a/packages/utils/package.json b/packages/utils/package.json index 4b63963..be9bc12 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -26,48 +26,19 @@ }, "dependencies": { "@types/debug": "^4.1.5", - "bluebird": "^3.5.3", - "chalk": "^2.4.2", - "commander": "^2.19.0", "debug": "^4.1.1", - "execa": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.1.15", - "js-yaml": "^3.13.1", - "json5": "^2.1.0", + "execa": "^2.0.4", "lodash": "^4.17.15", - "marked": "^0.7.0", - "marked-terminal": "^3.3.0", - "mkdirp": "^0.5.1", - "ms": "^2.1.1", "promise": "^8.0.2", "promise-all": "^1.0.0", - "request": "^2.88.0", - "request-promise": "^4.2.2", "tmp-promise": "^2.0.2", "ts-essentials": "^3.0.2", "ts-node": "^8.0.2", "url-join": "^4.0.0" }, "devDependencies": { - "@codechecks/ban-deps-codecheck": "^0.1.0", - "@types/bluebird": "^3.5.26", - "@types/execa": "^0.9.0", - "@types/fs-extra": "^8.0.0", - "@types/glob": "^7.1.1", - "@types/graceful-fs": "^4.1.3", - "@types/js-yaml": "^3.12.1", "@types/lodash": "^4.14.138", - "@types/marked": "^0.6.5", - "@types/marked-terminal": "^3.1.1", - "@types/mkdirp": "^0.5.2", - "@types/mock-fs": "^3.6.30", - "@types/ms": "^0.7.30", - "@types/request-promise": "^4.1.42", - "@types/tmp": "^0.1.0", - "execa": "^2.0.4", - "fs-extra": "^8.1.0", - "mock-fs": "^4.10.1" + "@types/tmp": "^0.1.0" }, "files": [ "dist/**/*" diff --git a/packages/utils/src/execute.ts b/packages/utils/src/execute.ts index f6b1d61..aef089c 100644 --- a/packages/utils/src/execute.ts +++ b/packages/utils/src/execute.ts @@ -1,5 +1,4 @@ import * as execa from "execa"; -import * as stream from "stream"; interface SharedOptions extends execa.CommonOptions {} @@ -18,26 +17,5 @@ export function execute(options: ExecuteOptions): ExecuteResult { } export function executeCommand(options: ExecuteCommandOptions): ExecuteResult { - return execa.command(options.cmd, options); -} - -function timeoutIfNoData(stream: stream.Readable, interval: number, fn: Function): void { - // probably we could convert nodejs stream to rxjs and avoid this code - let timeoutHook = setTimeout(fn, interval); - - stream.on("data", () => { - clearTimeout(timeoutHook); - timeoutHook = setTimeout(fn, interval); - }); - - stream.on("error", () => { - clearTimeout(timeoutHook); - }); - - stream.on("close", () => { - clearTimeout(timeoutHook); - }); - stream.on("end", () => { - clearTimeout(timeoutHook); - }); + return (execa as any).command(options.cmd, options); } diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index ecf5f30..99abba9 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,3 +1,4 @@ export * from "./createDebug"; export * from "./using"; -export * from "./tmpDir"; \ No newline at end of file +export * from "./tmpDir"; +export * from "./execute"; diff --git a/packages/utils/src/using.ts b/packages/utils/src/using.ts index 4c2218e..2bd89ee 100644 --- a/packages/utils/src/using.ts +++ b/packages/utils/src/using.ts @@ -19,7 +19,7 @@ export async function using AsyncOrSync d()); const resources = await promiseAll(allDisposablePromises); - await fn(resources as any); + await fn(resources); const disposeAllResources = mapValues(resources, r => r.dispose()); await promiseAll(disposeAllResources); diff --git a/yarn.lock b/yarn.lock index cd30242..da5092c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6914,10 +6914,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.1.6: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== +typescript@^3.6.3: + version "3.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da" + integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw== typestrict@^1.0.1: version "1.0.2" From 4e130f97c02db5d06bccbbfefe44c5a84d47cd00 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Tue, 17 Sep 2019 01:21:47 +0200 Subject: [PATCH 4/6] package metadata fixes --- README.md | 1 + packages/client/package.json | 2 +- packages/client/src/file-handling/settings.ts | 3 +- packages/utils/README.md | 66 +------------------ packages/utils/package.json | 12 +--- yarn.lock | 5 -- 6 files changed, 8 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 5438ca6..3ca4f03 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Particular codechecks can be distributed as **npm** packages and can be setup in | Package | Version | Description | | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | [`@codechecks/client`](/packages/client) | [![npm](https://img.shields.io/npm/v/@codechecks/client.svg)](https://www.npmjs.com/package/@codechecks/client) | TypeScript/JavaScript client used for executing codechecks | +| [`@codechecks/client`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@codechecks/utils.svg)](https://www.npmjs.com/package/@codechecks/utils) | Utils to simplify codechecks plugins development | Note: Currently we are in the process of open sourcing whole platform. diff --git a/packages/client/package.json b/packages/client/package.json index 69d0384..5090445 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -42,7 +42,7 @@ "promise": "^8.0.2", "request": "^2.88.0", "request-promise": "^4.2.2", - "ts-essentials": "^1.0.2", + "ts-essentials": "^3.0.2", "ts-node": "^8.0.2", "url-join": "^4.0.0" }, diff --git a/packages/client/src/file-handling/settings.ts b/packages/client/src/file-handling/settings.ts index d57b220..014bdd7 100644 --- a/packages/client/src/file-handling/settings.ts +++ b/packages/client/src/file-handling/settings.ts @@ -3,7 +3,6 @@ import { join, extname } from "path"; import { existsSync } from "fs"; import { loadJson } from "../file-executors/executeJson"; import { loadYaml } from "../file-executors/executeYaml"; -import { DeepPartial } from "ts-essentials"; import { crash } from "../utils/errors"; const CODECHECKS_SETTINGS_FILES_NAMES = ["codechecks.yml", "codechecks.yaml", "codechecks.json"]; @@ -37,7 +36,7 @@ function loadSettingsFromFile(filePath: string): CodeChecksSettings | undefined } } -function normalizeSettings(userProvidedSettings: DeepPartial = {}): CodeChecksSettings { +function normalizeSettings(userProvidedSettings: Partial = {}): CodeChecksSettings { return { speculativeBranchSelection: userProvidedSettings.speculativeBranchSelection === false ? false : true, branches: userProvidedSettings.branches || ["master"], diff --git a/packages/utils/README.md b/packages/utils/README.md index a09e1dc..7c343fe 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -1,8 +1,8 @@

codechecks.io -

Code Checks

+

Code Checks Utils

- Open source platform for code review automation ✅ + Utils to simplify codechecks plugins development

Build Status @@ -11,65 +11,3 @@ codechecks.io

- -**CodeChecks.io** is a framework for code review automation. It allows writing plugins (codechecks) in **JavaScript** -that: - -- execute directly on your **CI** (like CircleCI or TravisCI) and communicate with our backend -- can inspect all **Pull Request** data (title, content, changed files etc.) -- can attach feedback information back to **GitHub** as check (success/failure status, additional message) -- can upload, retrieve and calculate difference between arbitrary **artifacts** (like JSON values describing build size - or screenshots of views of a frontend app) -- require only one **GitHub App** — [Codechecks App](https://github.com/apps/codechecks) installed in order to work - -```typescript -import { codechecks } from "@codechecks/client"; - -export default async () => { - await codechecks.success({ - name: "Hello world!", - shortDescription: "It's so easy!", - longDescription: "# Hello! 👋", - }); -}; -``` - -![](images/demo.gif) - -Particular codechecks can be distributed as **npm** packages and can be setup in a declarative way in -[`codechecks.yml`](https://github.com/codechecks/docs/blob/master/configuration.md#codechecksyml) file. - -## Install - -```sh -npm add --save-dev @codechecks/client -``` - -## Docs 📚 - -- [Awesome codechecks](https://github.com/codechecks/awesome-codechecks) -- [Getting started guide](https://github.com/codechecks/docs/blob/master/getting-started.md) -- [Full documentation](https://github.com/codechecks/docs) - -## Contributors ✨ - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - - - - - - - -
Chris Kaczor
Chris Kaczor

💻 🤔 📖 💼 🚇
cgewecke
cgewecke

🔌 🤔 💻
Evgeniy Timokhov
Evgeniy Timokhov

🔌
Michał Załęcki
Michał Załęcki

💻 🔌
Craig Thompson
Craig Thompson

💻
Jakub Ziółkowski
Jakub Ziółkowski

💻 🔌
Deric Cain
Deric Cain

💻
- - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. -Contributions of any kind welcome! [Read more](./CONTRIBUTING.md)! diff --git a/packages/utils/package.json b/packages/utils/package.json index be9bc12..16ac7ed 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,19 +1,13 @@ { "name": "@codechecks/utils", - "description": "Open source platform for code review automation", + "description": "Utils to simplify codechecks plugins development", "keywords": [ - "code-review", - "code", - "review", "codechecks", - "automation", - "continuous-review", - "github", - "pull-request" + "utils" ], "repository": "codechecks/monorepo", "author": "Chris Kaczor ", - "version": "0.1.0", + "version": "0.1.1", "main": "dist/index.js", "bin": { "codechecks": "dist/runner.js" diff --git a/yarn.lock b/yarn.lock index da5092c..c3089e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6735,11 +6735,6 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -ts-essentials@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.2.tgz#ae3e50824e06ea8fbe7e25179a41c3618f79b798" - integrity sha512-D9TbEdIS+809h3tEESsHwgRFz0FtaCUEXCadqyFW9dw1/eMWjMeGzBsfkestAPexfNxMky6Fu1acI25XrgpIrw== - ts-essentials@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-3.0.2.tgz#143a60857a97c0e431b12bddbc4f3a7d7f3c40d4" From 13d93b3f976466ba367babb9b5824ba4185bb6c8 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Tue, 17 Sep 2019 02:22:39 +0200 Subject: [PATCH 5/6] add logging for execute utils --- packages/utils/src/execute.ts | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/utils/src/execute.ts b/packages/utils/src/execute.ts index aef089c..1f126c4 100644 --- a/packages/utils/src/execute.ts +++ b/packages/utils/src/execute.ts @@ -1,4 +1,7 @@ import * as execa from "execa"; +import { Readable } from "stream"; +import { createDebug } from "./createDebug"; +import { Debugger } from "debug"; interface SharedOptions extends execa.CommonOptions {} @@ -13,9 +16,27 @@ interface ExecuteCommandOptions extends SharedOptions { type ExecuteResult = execa.ExecaChildProcess; export function execute(options: ExecuteOptions): ExecuteResult { - return execa(options.file, options.args, options); + const executionResult = execa(options.file, options.args, options); + logResult(executionResult, "execute"); + return executionResult; } export function executeCommand(options: ExecuteCommandOptions): ExecuteResult { - return (execa as any).command(options.cmd, options); + const executionResult = (execa as any).command(options.cmd, options); + logResult(executionResult, "executeCommand"); + return executionResult; +} + +function logResult(result: ExecuteResult, namespace: string): void { + function logStream(stream: Readable, debug: Debugger): void { + stream.on("close", () => debug("close")); + stream.on("error", (e: any) => debug("error", e)); + stream.on("end", () => debug("end")); + stream.on("data", (data: any) => debug(data.toString())); + } + + const outDebug = createDebug(`utils:${namespace}:out`); + logStream(result.stdout, outDebug); + const errDebug = createDebug(`utils:${namespace}:err`); + logStream(result.stderr, errDebug); } From c2bafae5226b8a9b97a4a8371245415ed3b0cef1 Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Tue, 17 Sep 2019 02:23:02 +0200 Subject: [PATCH 6/6] bump version --- packages/utils/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/package.json b/packages/utils/package.json index 16ac7ed..604577d 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -7,7 +7,7 @@ ], "repository": "codechecks/monorepo", "author": "Chris Kaczor ", - "version": "0.1.1", + "version": "0.1.2", "main": "dist/index.js", "bin": { "codechecks": "dist/runner.js"