File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env zx
2- import { cp , mkdir , writeFile } from 'fs/promises' ;
2+ import { cp , mkdir , writeFile , stat } from 'fs/promises' ;
3+ import { pathExists } from 'fs-extra' ;
34import { exit } from 'process' ;
45
56import { $ , cd } from 'zx' ;
67
78import { getDeploymentVersion } from './get-deployment-version.mjs' ;
89
910try {
10-
1111 // Enable colours in output
1212 process . env . FORCE_COLOR = '1' ;
1313
8080 console . log ( 'Dependencies installed, packing...' ) ;
8181
8282 // Now we'll pack everything in the pre-pack directory to the release directory
83- await $ `tar -czf ./deploy/release/unraid-api-${ deploymentVersion } .tgz ./deploy/pre-pack/` ;
84- console . log ( 'Packing complete, build finished.' ) ;
83+ await cd ( './deploy/pre-pack' ) ;
84+ const tarballPath = `../release/unraid-api-${ deploymentVersion } .tgz` ;
85+ await $ `tar -czf ${ tarballPath } .` ;
86+ // Ensure the tarball exists
87+ if ( ! ( await pathExists ( tarballPath ) ) ) {
88+ console . error ( `Failed to create tarball at ${ tarballPath } ` ) ;
89+ process . exit ( 1 ) ;
90+ }
91+ const packageSize = Math . round ( ( await stat ( tarballPath ) ) . size / 1024 / 1024 ) ;
92+ console . log (
93+ `Package created at: ${ tarballPath } with size ${ packageSize } MB`
94+ ) ;
8595} catch ( error ) {
8696 // Error with a command
8797 if ( Object . keys ( error ) . includes ( 'stderr' ) ) {
You can’t perform that action at this time.
0 commit comments