diff --git a/package-lock.json b/package-lock.json index ade1b65..8ea97e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "dependencies": { "@metacall/protocol": "^0.1.19", "busboy": "^1.4.0", + "colors": "^1.4.0", "dotenv": "^16.0.3", "express": "^4.18.2", "git-clone": "^0.2.0", @@ -909,6 +910,14 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -4243,6 +4252,11 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", diff --git a/package.json b/package.json index 0b66803..25ad7f8 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "dependencies": { "@metacall/protocol": "^0.1.19", "busboy": "^1.4.0", + "colors": "^1.4.0", "dotenv": "^16.0.3", "express": "^4.18.2", "git-clone": "^0.2.0", diff --git a/src/api.ts b/src/api.ts index b365d46..f902d0d 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,9 +1,9 @@ import { spawn } from 'child_process'; +import colors from 'colors'; +import { NextFunction, Request, Response } from 'express'; import { hostname } from 'os'; import * as path from 'path'; -import { NextFunction, Request, Response } from 'express'; - import upload from './controller/upload'; import { @@ -34,6 +34,8 @@ import { appsDirectory } from './utils/config'; const appsDir = appsDirectory(); +colors.enable(); + export const callFnByName = ( req: Request, res: Response, @@ -220,9 +222,12 @@ export const deploy = catchAsync( currentFile }); - // proc.stdout?.on('data', (data: Buffer) => { - // console.log('CP console log: -->>', data.toString()); - // }); + proc.stdout?.on('data', (data: Buffer) => { + console.log(data.toString().green); + }); + proc.stderr?.on('data', (data: Buffer) => { + console.log(data.toString().red); + }); proc.on('message', (data: childProcessResponse) => { if (data.type === protocol.g) {