From 6e1d1395d0fcdf25c33f93bdef384d8b96dba2ec Mon Sep 17 00:00:00 2001 From: cm-ayf Date: Fri, 24 May 2024 19:36:45 +0900 Subject: [PATCH 1/3] export OM_SYRINX_VERSION from package.json --- lib/index.d.ts | 2 ++ lib/index.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/index.d.ts b/lib/index.d.ts index 34be0c2..6f0802f 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -12,6 +12,8 @@ export type { SyrinxConfig, } from "./native"; +export const OM_SYRINX_VERSION: string; + import type { Readable } from "node:stream"; import type { SyrinxConfig, SynthesisOption } from "./native"; diff --git a/lib/index.js b/lib/index.js index 639f06d..ebd5777 100644 --- a/lib/index.js +++ b/lib/index.js @@ -16,6 +16,9 @@ exports.EncoderType = EncoderType; exports.Channels = Channels; exports.Application = Application; +const { version: OM_SYRINX_VERSION } = require("../package.json"); +exports.OM_SYRINX_VERSION = OM_SYRINX_VERSION; + class SyrinxStream extends Readable { /** * @param {import("./native").Syrinx} syrinx From 8da075d0db7085495314d35572b9bc7ffd1ca7db Mon Sep 17 00:00:00 2001 From: cm-ayf Date: Fri, 24 May 2024 19:44:59 +0900 Subject: [PATCH 2/3] test --- test/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/index.js b/test/index.js index bb78b29..b931030 100644 --- a/test/index.js +++ b/test/index.js @@ -17,8 +17,13 @@ const { } = require("../lib"); const tar = require("tar-fs"); const TOML = require("@iarna/toml"); +const { OM_SYRINX_VERSION } = require("../lib"); describe("version", () => { + it("should match the version of om-syrinx", () => { + assert.strictEqual(require("../package.json").version, OM_SYRINX_VERSION); + }); + const lockFile = fs.readFileSync("Cargo.lock", "utf-8"); const { package } = TOML.parse(lockFile); From 1bcd8864570ccbee7d725a7b5454197b6905c733 Mon Sep 17 00:00:00 2001 From: cm-ayf Date: Fri, 24 May 2024 19:45:21 +0900 Subject: [PATCH 3/3] one require --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index b931030..0af0311 100644 --- a/test/index.js +++ b/test/index.js @@ -10,6 +10,7 @@ const { pipeline } = require("node:stream/promises"); const { setTimeout } = require("node:timers/promises"); const crypto = require("node:crypto"); const { + OM_SYRINX_VERSION, JPREPROCESS_VERSION, JBONSAI_VERSION, Syrinx, @@ -17,7 +18,6 @@ const { } = require("../lib"); const tar = require("tar-fs"); const TOML = require("@iarna/toml"); -const { OM_SYRINX_VERSION } = require("../lib"); describe("version", () => { it("should match the version of om-syrinx", () => {