mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix: staging build issues
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env zx
|
#!/usr/bin/env zx
|
||||||
import { cp, mkdir, writeFile, stat } from 'fs/promises';
|
import { cp, mkdir, stat, writeFile } from 'fs/promises';
|
||||||
import { pathExists } from 'fs-extra';
|
|
||||||
import { exit } from 'process';
|
import { exit } from 'process';
|
||||||
|
|
||||||
|
import { pathExists } from 'fs-extra';
|
||||||
import { $, cd } from 'zx';
|
import { $, cd } from 'zx';
|
||||||
|
|
||||||
import { getDeploymentVersion } from './get-deployment-version.mjs';
|
import { getDeploymentVersion } from './get-deployment-version.mjs';
|
||||||
@@ -64,24 +64,23 @@ try {
|
|||||||
);
|
);
|
||||||
// # Create final tgz
|
// # Create final tgz
|
||||||
await cp('./README.md', './deploy/pre-pack/README.md');
|
await cp('./README.md', './deploy/pre-pack/README.md');
|
||||||
|
|
||||||
await cp('./node_modules', './deploy/pre-pack/node_modules', { recursive: true });
|
|
||||||
// Install production dependencies
|
// Install production dependencies
|
||||||
|
|
||||||
console.log('Installing dependencies...');
|
console.log('Installing dependencies...');
|
||||||
|
|
||||||
$.verbose = true;
|
$.verbose = true;
|
||||||
await $`npm --prefix ./deploy/pre-pack prune --omit=dev`;
|
|
||||||
await $`npm --prefix ./deploy/pre-pack install --omit=dev`;
|
await cd('./deploy/pre-pack');
|
||||||
|
|
||||||
|
await $`npm install --omit=dev`;
|
||||||
|
|
||||||
// Ensure that we don't have any dev dependencies left
|
// Ensure that we don't have any dev dependencies left
|
||||||
console.log('Installed dependencies:');
|
console.log('Installed dependencies:');
|
||||||
await $`npm --prefix ./deploy/pre-pack ls --omit=dev --depth=0`;
|
await $`npm ls --omit=dev --depth=0`;
|
||||||
|
|
||||||
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 cd('./deploy/pre-pack');
|
|
||||||
const tarballPath = `../release/unraid-api-${deploymentVersion}.tgz`;
|
const tarballPath = `../release/unraid-api-${deploymentVersion}.tgz`;
|
||||||
await $`tar -czf ${tarballPath} .`;
|
await $`tar -czf ${tarballPath} .`;
|
||||||
// Ensure the tarball exists
|
// Ensure the tarball exists
|
||||||
@@ -90,9 +89,7 @@ try {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const packageSize = Math.round((await stat(tarballPath)).size / 1024 / 1024);
|
const packageSize = Math.round((await stat(tarballPath)).size / 1024 / 1024);
|
||||||
console.log(
|
console.log(`Package created at: ${tarballPath} with size ${packageSize} MB`);
|
||||||
`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