Skip to content

Commit 93b4a9f

Browse files
committed
Rework how the tar is validated.
1 parent 213744f commit 93b4a9f

File tree

5 files changed

+18
-69
lines changed

5 files changed

+18
-69
lines changed

.github/workflows/linter.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

dist/index.js

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
1919
"package": "npx ncc build src/index.ts -o dist --source-map --license licenses.txt",
2020
"package:watch": "npm run package -- --watch",
21-
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
21+
"all": "npm run format:write && npm run lint && npm run package"
2222
},
2323
"license": "MIT",
2424
"dependencies": {

src/index.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,32 @@ import * as fs from 'node:fs'
55
import { create } from 'tar'
66
import { spawn } from 'child_process'
77

8-
async function verifyTar(filePath: string): Promise<void> {
8+
async function tar(...args: string[]): Promise<void> {
99
return new Promise((resolve, reject) => {
1010
// Launch tar process with test flag
11-
const tar = spawn('tar', ['tzf', filePath])
11+
const process = spawn('tar', args)
1212

13-
let stderr = ''
1413
let hadError = false
1514

1615
// Collect any error output
17-
tar.stderr.on('data', data => {
18-
stderr += data.toString()
16+
process.stderr.on('data', data => {
17+
console.log('%s', data.toString())
1918
})
2019

2120
// Handle process errors
22-
tar.on('error', error => {
21+
process.on('error', error => {
2322
reject(error)
2423
hadError = true
2524
})
2625

2726
// Handle process completion
28-
tar.on('close', code => {
27+
process.on('close', code => {
2928
if (hadError) return // Skip if we already handled an error
3029

3130
if (code === 0) {
3231
resolve()
3332
} else {
34-
reject(new Error(`Verification failed: ${stderr.trim()}`))
33+
reject(new Error(`tar failed with code ${code}}`))
3534
}
3635
})
3736
})
@@ -79,7 +78,7 @@ async function main(): Promise<void> {
7978
)
8079

8180
console.info(`Verifying deployment bundle ${bundlePath}...`)
82-
await verifyTar(bundlePath)
81+
await tar('tzf', bundlePath)
8382

8483
if (deploymentName) {
8584
console.info('Setting deployment name: %s', deploymentName)

0 commit comments

Comments
 (0)