From 760e7d6018359c903a9e768e3362e868937a74fd Mon Sep 17 00:00:00 2001 From: Remy Date: Tue, 17 Sep 2024 16:07:10 +0200 Subject: [PATCH] chore: seq compress as cli arg --- package.json | 2 +- src/compress.ts | 2 +- src/config-default.ts | 1 - src/config-types.ts | 1 - src/index.ts | 4 ++++ src/state.ts | 1 + 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f5d78ef..d41f28e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@divriots/jampack", - "version": "0.27.1", + "version": "0.28.1", "cache-version": { "img": "v1", "img-ext": "v1" diff --git a/src/compress.ts b/src/compress.ts index a0b8884..88e6174 100755 --- a/src/compress.ts +++ b/src/compress.ts @@ -98,7 +98,7 @@ export async function compressFolder( } } - if (!state.options.misc.sequential_compress) { + if (!state.args.sequential_compress) { // "Parallel" processing await Promise.all(paths.map(compressFile)); } else { diff --git a/src/config-default.ts b/src/config-default.ts index b9ff248..8f2e253 100644 --- a/src/config-default.ts +++ b/src/config-default.ts @@ -63,7 +63,6 @@ const default_options: Options = { }, misc: { prefetch_links: 'off', - sequential_compress: false, }, }; diff --git a/src/config-types.ts b/src/config-types.ts index c54ccbe..dc8fac0 100644 --- a/src/config-types.ts +++ b/src/config-types.ts @@ -74,6 +74,5 @@ export type Options = { }; misc: { prefetch_links: 'in-viewport' | 'off'; - sequential_compress: boolean; }; }; diff --git a/src/index.ts b/src/index.ts index dbf1ad7..ca2e9d7 100755 --- a/src/index.ts +++ b/src/index.ts @@ -45,6 +45,10 @@ program .option('--onlyoptim', 'Only optimize (PASS 1).') .option('--onlycomp', 'Only compress (PASS 2).') .option('--cache_folder ', 'Default: .jampack/cache') + .option( + '--sequential_compress', + 'Whether to perform folder compression sequentially. Reduces memoru footprint on compress. Default: false' + ) .option('--cleancache', 'Clean cache before running') .option('--nocache', 'Run with no use of cache') .action(async (dir, options) => { diff --git a/src/state.ts b/src/state.ts index 1be31e6..751f39e 100644 --- a/src/state.ts +++ b/src/state.ts @@ -5,6 +5,7 @@ export type Args = { nowrite?: boolean; nocache?: boolean; cache_folder?: string; + sequential_compress?: boolean; }; export type ReportItem = {