Shared utils -> extra-utils
Because they need dev dependencies
This commit is contained in:
parent
4ee7a4c9ac
commit
94565d52bb
131 changed files with 250 additions and 238 deletions
24
shared/extra-utils/cli/cli.ts
Normal file
24
shared/extra-utils/cli/cli.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { exec } from 'child_process'
|
||||
|
||||
import { ServerInfo } from '../server/servers'
|
||||
|
||||
function getEnvCli (server?: ServerInfo) {
|
||||
return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`
|
||||
}
|
||||
|
||||
async function execCLI (command: string) {
|
||||
return new Promise<string>((res, rej) => {
|
||||
exec(command, (err, stdout, stderr) => {
|
||||
if (err) return rej(err)
|
||||
|
||||
return res(stdout)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
execCLI,
|
||||
getEnvCli
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue