mirror of
https://github.com/unraid/api.git
synced 2026-01-02 06:30:02 -06:00
feat: log size and only tar files
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env zx
|
#!/usr/bin/env zx
|
||||||
import { cp, mkdir, writeFile } from 'fs/promises';
|
import { cp, mkdir, writeFile, stat } from 'fs/promises';
|
||||||
|
import { pathExists } from 'fs-extra';
|
||||||
import { exit } from 'process';
|
import { exit } from 'process';
|
||||||
|
|
||||||
import { $, cd } from 'zx';
|
import { $, cd } from 'zx';
|
||||||
@@ -7,7 +8,6 @@ import { $, cd } from 'zx';
|
|||||||
import { getDeploymentVersion } from './get-deployment-version.mjs';
|
import { getDeploymentVersion } from './get-deployment-version.mjs';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Enable colours in output
|
// Enable colours in output
|
||||||
process.env.FORCE_COLOR = '1';
|
process.env.FORCE_COLOR = '1';
|
||||||
|
|
||||||
@@ -80,8 +80,18 @@ try {
|
|||||||
console.log('Dependencies installed, packing...');
|
console.log('Dependencies installed, packing...');
|
||||||
|
|
||||||
// Now we'll pack everything in the pre-pack directory to the release directory
|
// Now we'll pack everything in the pre-pack directory to the release directory
|
||||||
await $`tar -czf ./deploy/release/unraid-api-${deploymentVersion}.tgz ./deploy/pre-pack/`;
|
await cd('./deploy/pre-pack');
|
||||||
console.log('Packing complete, build finished.');
|
const tarballPath = `../release/unraid-api-${deploymentVersion}.tgz`;
|
||||||
|
await $`tar -czf ${tarballPath} .`;
|
||||||
|
// Ensure the tarball exists
|
||||||
|
if (!(await pathExists(tarballPath))) {
|
||||||
|
console.error(`Failed to create tarball at ${tarballPath}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const packageSize = Math.round((await stat(tarballPath)).size / 1024 / 1024);
|
||||||
|
console.log(
|
||||||
|
`Package created at: ${tarballPath} with size ${packageSize} MB`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Error with a command
|
// Error with a command
|
||||||
if (Object.keys(error).includes('stderr')) {
|
if (Object.keys(error).includes('stderr')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user