From 9ee22cfc9c69b099f3447747fd113d0cde3413e7 Mon Sep 17 00:00:00 2001 From: kelvinhammond Date: Mon, 11 May 2026 09:50:48 -0400 Subject: [PATCH 1/6] Update EditorConfig cpp spacing to 2 --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 8a0aafb..93354d0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ insert_final_newline = true indent_style = tab [*.{c,h,cpp,cpp,hpp}] -indent_size = 4 +indent_size = 2 [*.{js,ts}] indent_size = 2 From e453dc3350f8bd724c932d7054900790a1699875 Mon Sep 17 00:00:00 2001 From: kelvinhammond Date: Mon, 11 May 2026 09:53:35 -0400 Subject: [PATCH 2/6] Added: Creator.addAlias --- src/creator.h | 24 ++++++++++++++++++++++++ test/zim.test.ts | 1 + 2 files changed, 25 insertions(+) diff --git a/src/creator.h b/src/creator.h index 0be1ec7..7168b68 100644 --- a/src/creator.h +++ b/src/creator.h @@ -342,6 +342,29 @@ class Creator : public Napi::ObjectWrap { } } + void addAlias(const Napi::CallbackInfo &info) { + try { + auto env = info.Env(); + if (info.Length() < 3) { + throw Napi::Error::New(env, + "addAlias requires arguments: path, title, " + "targetPath, [hints]"); + } + + auto path = info[0].As().Utf8Value(); + auto title = info[1].As().Utf8Value(); + auto targetPath = info[2].As().Utf8Value(); + if (info[3].IsObject()) { + auto hints = Object2Hints(info[3].ToObject()); + creator_->addAlias(path, title, targetPath, hints); + } else { + creator_->addAlias(path, title, targetPath); + } + } catch (const std::exception &err) { + throw Napi::Error::New(info.Env(), err.what()); + } + } + void setMainPath(const Napi::CallbackInfo &info) { try { auto env = info.Env(); @@ -387,6 +410,7 @@ class Creator : public Napi::ObjectWrap { InstanceMethod<&Creator::addMetadata>("addMetadata"), InstanceMethod<&Creator::addIllustration>("addIllustration"), InstanceMethod<&Creator::addRedirection>("addRedirection"), + InstanceMethod<&Creator::addAlias>("addAlias"), InstanceMethod<&Creator::setMainPath>("setMainPath"), InstanceMethod<&Creator::setUuid>("setUuid"), diff --git a/test/zim.test.ts b/test/zim.test.ts index e45385b..cf5d10b 100644 --- a/test/zim.test.ts +++ b/test/zim.test.ts @@ -222,6 +222,7 @@ describe("Creator", () => { creator.addRedirection("redirect/test1", "Redirect to test 1", "test1", { COMPRESS: 1, }); + creator.addAlias("alias/test1", "Alias to test 1", "test1", { COMPRESS: 1 }); creator.setMainPath("redirect/test1"); creator.setUuid("1234567890ABCDEF"); } finally { From d56a9c9a49337c779fe99c520ce449b435cacf86 Mon Sep 17 00:00:00 2001 From: kelvinhammond Date: Mon, 11 May 2026 09:54:00 -0400 Subject: [PATCH 3/6] Updated: Libzim to 9.7.0 from 9.5.1 --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 07a3e21..811a406 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -LIBZIM_VERSION=9.5.1 +LIBZIM_VERSION=9.7.0 From b5e65de029c171bd7a64875c530808a24a4a581f Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Mon, 11 May 2026 13:56:06 +0000 Subject: [PATCH 4/6] [CodeFactor] Apply fixes --- test/zim.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/zim.test.ts b/test/zim.test.ts index cf5d10b..0cc9d0b 100644 --- a/test/zim.test.ts +++ b/test/zim.test.ts @@ -222,7 +222,9 @@ describe("Creator", () => { creator.addRedirection("redirect/test1", "Redirect to test 1", "test1", { COMPRESS: 1, }); - creator.addAlias("alias/test1", "Alias to test 1", "test1", { COMPRESS: 1 }); + creator.addAlias("alias/test1", "Alias to test 1", "test1", { + COMPRESS: 1, + }); creator.setMainPath("redirect/test1"); creator.setUuid("1234567890ABCDEF"); } finally { From 901c762e4ee7ad24f0f59a361432768739c964a0 Mon Sep 17 00:00:00 2001 From: kelvinhammond Date: Mon, 11 May 2026 09:59:13 -0400 Subject: [PATCH 5/6] Fixed: Add missing addAlias to type definitions --- src/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.d.ts b/src/index.d.ts index 21552a7..bb8631e 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -118,6 +118,12 @@ export class Creator { targetPath: string, hints?: Hint, ): void; + addAlias( + path: string, + title: string, + targetPath: string, + hints?: Hint, + ): void; setMainPath(mainPath: string): void; setUuid(uuid: string): void; finishZimCreation(): Promise; From 5423079daede85fbc01ecf5144128c98d51c9231 Mon Sep 17 00:00:00 2001 From: kelvinhammond Date: Mon, 11 May 2026 10:08:09 -0400 Subject: [PATCH 6/6] Pretty types for Creator.addAlias --- src/index.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index bb8631e..02c08b6 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -118,12 +118,7 @@ export class Creator { targetPath: string, hints?: Hint, ): void; - addAlias( - path: string, - title: string, - targetPath: string, - hints?: Hint, - ): void; + addAlias(path: string, title: string, targetPath: string, hints?: Hint): void; setMainPath(mainPath: string): void; setUuid(uuid: string): void; finishZimCreation(): Promise;