Skip to content

Commit

Permalink
Small tweaks to zip
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Apr 16, 2024
1 parent 2d04a45 commit b738829
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/RokuDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class RokuDeploy {
options = this.getOptions(options) as any;

//make sure the output folder exists
await fsExtra.ensureDir(options.outDir);

let zipFilePath = this.getOutputZipFilePath(options as any);

Expand Down Expand Up @@ -109,6 +108,11 @@ export class RokuDeploy {
promises.push(promise);
}
await Promise.all(promises);

//ensure the outDir exists
await fsExtra.ensureDir(
path.dirname(zipFilePath)
);
// level 2 compression seems to be the best balance between speed and file size. Speed matters more since most will be calling squashfs afterwards.
const content = await zip.generateAsync({ type: 'nodebuffer', compressionOptions: { level: 2 } });
return fsExtra.writeFile(zipFilePath, content);
Expand Down Expand Up @@ -721,9 +725,7 @@ export class RokuDeploy {
if (!zipFileName.toLowerCase().endsWith('.zip')) {
zipFileName += '.zip';
}
let outFolderPath = path.resolve(options.outDir);

let outZipFilePath = path.join(outFolderPath, zipFileName);
let outZipFilePath = path.resolve(options.cwd, options.outDir, zipFileName);
return outZipFilePath;
}

Expand Down
1 change: 0 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ void yargs
.option('outFile', { type: 'string', description: 'The output file', demandOption: false })
.option('cwd', { type: 'string', description: 'The current working directory to use for relative paths', demandOption: false });
}, (args: any) => {
console.log('args', args);
return new ZipCommand().run(args);
})

Expand Down

0 comments on commit b738829

Please sign in to comment.