Skip to content

Commit

Permalink
chore: seq compress as cli arg
Browse files Browse the repository at this point in the history
  • Loading branch information
muryoh committed Sep 17, 2024
1 parent 0118ec6 commit 760e7d6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@divriots/jampack",
"version": "0.27.1",
"version": "0.28.1",
"cache-version": {
"img": "v1",
"img-ext": "v1"
Expand Down
2 changes: 1 addition & 1 deletion src/compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/config-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const default_options: Options = {
},
misc: {
prefetch_links: 'off',
sequential_compress: false,
},
};

Expand Down
1 change: 0 additions & 1 deletion src/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@ export type Options = {
};
misc: {
prefetch_links: 'in-viewport' | 'off';
sequential_compress: boolean;
};
};
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ program
.option('--onlyoptim', 'Only optimize (PASS 1).')
.option('--onlycomp', 'Only compress (PASS 2).')
.option('--cache_folder <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) => {
Expand Down
1 change: 1 addition & 0 deletions src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type Args = {
nowrite?: boolean;
nocache?: boolean;
cache_folder?: string;
sequential_compress?: boolean;
};

export type ReportItem = {
Expand Down

0 comments on commit 760e7d6

Please sign in to comment.