@percy/cli-exec
Advanced tools
Comparing version 1.27.5-alpha.0 to 1.27.5-beta.0
@@ -5,2 +5,4 @@ import command from '@percy/cli-command'; | ||
import ping from './ping.js'; | ||
import { getPackageJSON } from '@percy/cli-command/utils'; | ||
const pkg = getPackageJSON(import.meta.url); | ||
export const exec = command('exec', { | ||
@@ -93,3 +95,3 @@ description: 'Start and stop Percy around a supplied command', | ||
log.info(`Running "${[command, ...args].join(' ')}"`); | ||
let [status, error] = yield* spawn(command, args); | ||
let [status, error] = yield* spawn(command, args, percy); | ||
@@ -105,3 +107,3 @@ // stop percy if running (force stop if there is an error); | ||
// with any error encountered while running. Uses a generator pattern to handle interupt signals. | ||
async function* spawn(cmd, args) { | ||
async function* spawn(cmd, args, percy) { | ||
let { | ||
@@ -113,6 +115,31 @@ default: crossSpawn | ||
proc = crossSpawn(cmd, args, { | ||
stdio: 'inherit' | ||
stdio: 'pipe' | ||
}); | ||
proc.on('close', code => closed = code); | ||
// Writing stdout of proc to process | ||
if (proc.stdout) { | ||
proc.stdout.on('data', data => { | ||
process.stdout.write(`${data}`); | ||
}); | ||
} | ||
if (proc.stderr) { | ||
proc.stderr.on('data', data => { | ||
process.stderr.write(`${data}`); | ||
}); | ||
} | ||
proc.on('error', err => error = err); | ||
proc.on('close', code => { | ||
closed = code; | ||
if (code !== 0) { | ||
// Only send event when there is a global error code and | ||
// percy token is present | ||
if (process.env.PERCY_TOKEN) { | ||
const myObject = { | ||
errorKind: 'cli', | ||
cliVersion: pkg.version, | ||
message: '1' | ||
}; | ||
percy.client.sendBuildEvents(percy.build.id, myObject); | ||
} | ||
} | ||
}); | ||
@@ -119,0 +146,0 @@ // run until an event is triggered |
{ | ||
"name": "@percy/cli-exec", | ||
"version": "1.27.5-alpha.0", | ||
"version": "1.27.5-beta.0", | ||
"license": "MIT", | ||
@@ -12,3 +12,3 @@ "repository": { | ||
"access": "public", | ||
"tag": "alpha" | ||
"tag": "latest" | ||
}, | ||
@@ -37,7 +37,7 @@ "engines": { | ||
"dependencies": { | ||
"@percy/cli-command": "1.27.5-alpha.0", | ||
"@percy/cli-command": "1.27.5-beta.0", | ||
"cross-spawn": "^7.0.3", | ||
"which": "^2.0.2" | ||
}, | ||
"gitHead": "8ecc32db25f708a01192b8454d0fdf9c051f48a0" | ||
"gitHead": "5fed59aa21112e7854a414306504ce7243df7365" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13194
248
3
+ Added@percy/cli-command@1.27.5-beta.0(transitive)
+ Added@percy/client@1.27.5-beta.0(transitive)
+ Added@percy/config@1.27.5-beta.0(transitive)
+ Added@percy/core@1.27.5-beta.0(transitive)
+ Added@percy/dom@1.27.5-beta.0(transitive)
+ Added@percy/env@1.27.5-beta.0(transitive)
+ Added@percy/logger@1.27.5-beta.0(transitive)
+ Added@percy/sdk-utils@1.27.5-beta.0(transitive)
+ Added@percy/webdriver-utils@1.27.5-beta.0(transitive)
- Removed@percy/cli-command@1.27.5-alpha.0(transitive)
- Removed@percy/client@1.27.5-alpha.0(transitive)
- Removed@percy/config@1.27.5-alpha.0(transitive)
- Removed@percy/core@1.27.5-alpha.0(transitive)
- Removed@percy/dom@1.27.5-alpha.0(transitive)
- Removed@percy/env@1.27.5-alpha.0(transitive)
- Removed@percy/logger@1.27.5-alpha.0(transitive)
- Removed@percy/sdk-utils@1.27.5-alpha.0(transitive)
- Removed@percy/webdriver-utils@1.27.5-alpha.0(transitive)