Skip to content

Commit 36fc62f

Browse files
committed
chore: keep changelog manual through v2.0.0, re-enable automation afterward
1 parent 05bea5c commit 36fc62f

File tree

15 files changed

+619
-31
lines changed

15 files changed

+619
-31
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ jobs:
4343
- name: Build package
4444
run: pnpm run build
4545

46+
- name: Ensure bundled LAME binary
47+
env:
48+
LAME_FORCE_DOWNLOAD: "1"
49+
run: node ./scripts/install-lame.mjs
50+
51+
- name: Diagnose bundled LAME binary
52+
run: node ./scripts/diagnose-lame.mjs
53+
4654
- name: Run examples
4755
run: |
4856
pnpm run example:wav-to-mp3

.github/workflows/prepare-release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ jobs:
4949
- name: Integration tests
5050
run: pnpm run test:integration
5151

52+
- name: Determine changelog mode
53+
id: changelog
54+
run: |
55+
git fetch --tags --force >/dev/null 2>&1 || true
56+
if git rev-parse "v2.0.0" >/dev/null 2>&1; then
57+
echo "skip=0" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "skip=1" >> "$GITHUB_OUTPUT"
60+
fi
61+
5262
- name: Configure git
5363
run: |
5464
git config user.name "github-actions[bot]"
@@ -58,6 +68,8 @@ jobs:
5868
id: version
5969
env:
6070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
SKIP_CHANGELOG: ${{ steps.changelog.outputs.skip }}
6173
run: |
6274
set -eo pipefail
6375
pnpm run release:version > version.log 2>&1 || STATUS=$?

AI_AGENT_INSTRUCTIONS.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ You operate as a senior Node.js and TypeScript backend engineer focused on maint
115115
- `package.json` exports map `.` to the compiled bundle with typed entry points; adjust both ESM and CJS paths when restructuring.
116116
- Keep `files` whitelist minimal.
117117
- Update README examples when public API changes, ensuring both buffer and file workflows remain documented.
118-
- `CHANGELOG.md` is generated from Conventional Commits during the release workflow; do not edit it manually.
118+
- `CHANGELOG.md` is generated from Conventional Commits during the release workflow for releases after 2.0.0; that release was curated manually, so avoid regenerating it automatically.
119+
- The release helper `scripts/release-version.mjs` honors `SKIP_CHANGELOG=1` for manual runs (used when finalizing 2.0.0); do not set it for subsequent releases so Lerna can emit the changelog.
120+
- The CI release workflow automatically toggles `SKIP_CHANGELOG` based on whether tag `v2.0.0` exists; until that tag is present (i.e., while preparing the 2.0.0 release) the changelog is kept manual, and all later releases revert to Conventional Commits output.
119121
- Maintain parity between runtime behaviour and README option tables; treat the table as authoritative for user-facing docs.
120122
- Generated outputs (`dist/**`, `coverage/**`, `vendor/**`) must never be checked into source control manually.
121123

@@ -128,6 +130,7 @@ You operate as a senior Node.js and TypeScript backend engineer focused on maint
128130
- Start with unit tests to capture expected behaviour, then adjust implementation, and finish by running the full test suite.
129131
- When modifying CLI behaviour, test on at least one supported platform or enhance integration tests with synthetic binaries.
130132
- Prefer extending existing classes and helpers over introducing new modules; if a new module is required, place it under `src/core` (runtime logic) or `src/internal` (supporting utilities).
131-
- Document behavioural changes in commit messages following Conventional Commit rules; the release tooling will derive `CHANGELOG.md` automatically.
132-
- Never edit `CHANGELOG.md` by hand; rely on the release workflow or explicit project tooling to populate it.
133+
- Document behavioural changes in commit messages following Conventional Commit rules so the release tooling can derive `CHANGELOG.md` for future releases.
134+
- Manual edits to `CHANGELOG.md` are only allowed for the 2.0.0 release; subsequent entries must come from the automated workflow.
133135
- After finishing any feature implementation, include in your final response a Conventional Commit-style message suggestion that downstream tooling can use.
136+
- When referencing Node.js types, import them explicitly (e.g. `import type { ProcessEnv } from "node:process";`) instead of relying on the `NodeJS.*` namespace to keep ESLint satisfied.

CHANGELOG.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
## <small>2.0.0 (2025-11-09)</small>
2+
3+
### Breaking Changes
4+
5+
- Postinstall now auto-downloads a platform-specific LAME binary into `vendor/lame/<platform>-<arch>/`. Pipelines must permit the download step or configure `LAME_BINARY`, `LAME_SKIP_DOWNLOAD`, or `LAME_FORCE_DOWNLOAD` to control it (more details see `README.md`).
6+
- The minimum Node.js version is 20 and the library is published as an ESM-first package with explicit `exports`. CommonJS imports are still supported. Deep imports like `require("node-lame/lib/...")` are no longer supported.
7+
8+
### Features
9+
10+
- Introduced duplex streaming helpers (`createLameEncoderStream` / `createLameDecoderStream`) so audio can flow through stdin/stdout while progress events continue to fire ([#11](https://github.com/devowlio/node-lame/issues/11)).
11+
- `Lame#setBuffer` accepts `ArrayBuffer` and all typed arrays, automatically normalizing samples to the requested bit depth and endianness ([#33](https://github.com/devowlio/node-lame/issues/33)).
12+
- Broadened CLI option support: gapless playback controls, priority/disptime tuning, channel swapping, gain, decode delay trimming, VBR fine-tuning, verbosity toggles, and custom ID3 frames via `meta.custom`.
13+
- Exported `resolveBundledLameBinary` and `resolveLameBinary` so applications can inspect or override the binary chosen at runtime.
14+
15+
### Improvements
16+
17+
- `spawnLameProcess` now drives all CLI interaction, guaranteeing consistent progress parsing and normalized warning/error messages.
18+
- Temp files live under `join(tmpdir(), "node-lame")`, are created lazily, and are cleaned up automatically, even after failures.
19+
- Documentation now covers the installer environment variables, typed-array ingestion, gapless workflows, and streaming usage.
20+
21+
### Tooling & Quality
22+
23+
- Builds now originate from modern TypeScript sources compiled by `tsup` into dual ESM/CJS bundles with generated typings.
24+
- Vitest-based unit and integration suites stub binaries, simulate streaming backpressure, and assert option coverage.
25+
- The installer maintains a deterministic vendor layout, making binary resolution reproducible across platforms.
26+
- Introduced CI/CD pipelines that lint, type-check, run unit and integration suites, and gate release publishing so every change ships through the same automated path.
27+
128
## <small>1.5.1 (2025-10-28)</small>
229

3-
All releases up to this version were created without a changelog. Please refer to the comment messages for details on changes.
30+
All releases up to this version were created **without** a changelog. Please refer to the comment messages for details on changes!
31+
32+
**Summary of features in version 1.x:**
33+
34+
- Promise-based Node.js wrapper for the native LAME CLI that can both encode WAV/MP1/MP2/MP3 sources to MP3 and decode MP3 files back to WAV while reporting progress through `getStatus()` and an `EventEmitter` (`progress`, `finish`, `error`).
35+
- Supports file- and buffer-based workflows for both inputs and outputs, including optional in-memory pipelines, configurable temp directories, and custom binary paths so projects can bundle their own LAME builds.
36+
- Provides raw PCM ingestion controls (sample frequency, bit width, signed/unsigned, endian toggles) and format hints (`mp2Input`, `mp3Input`) so the CLI can be tuned for atypical sources.
37+
- Exposes the majority of LAME’s encoding knobs: stereo/joint/mono modes, mono downmix (`to-mono`), block-size tweaks, ReplayGain detection, channel scaling, presets, CPU feature flags, quality ladders, and the full suite of bitrate strategies (constant, forced, average, variable with quality targets, and noise-shaping helpers).
38+
- Includes resampling plus low-pass/high-pass filter controls and ISO-compliance/reservoir toggles for shaping output to device requirements or archival specs.
39+
- Ships rich ID3 tooling that can embed titles, artists, albums, years, comments, tracks, genres, artwork, genre lists, padding, and ID3v1/v2 variants while allowing strict tag validation.
40+
- Publishes TypeScript typings alongside the compiled library and maintains a Mocha/Chai suite that exercises encode/decode happy paths, buffer handling, metadata arguments, and failure cases (bad files, invalid options, unexpected process exits).

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2017-2021, devowl.io GmbH and Jan Karres
1+
Copyright (c) 2017-2025, devowl.io GmbH and Jan Karres
22

33
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
44

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-lame",
33
"version": "1.5.1",
44
"description": "LAME MP3 encoder for Node.js",
5-
"homepage": "https://github.com/devowlio/node-lame",
5+
"homepage": "https://www.npmjs.com/package/node-lame",
66
"repository": {
77
"type": "git",
88
"url": "git+https://github.com/devowlio/node-lame.git"
@@ -54,7 +54,7 @@
5454
"prepublishOnly": "pnpm run build",
5555
"prepare": "husky",
5656
"changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s",
57-
"release:version": "HUSKY=0 pnpm lerna version --yes --no-commit-hooks",
57+
"release:version": "node ./scripts/release-version.mjs",
5858
"release:publish": "pnpm lerna publish from-git --yes --create-release github",
5959
"release": "pnpm run release:version && pnpm run release:publish"
6060
},
@@ -80,12 +80,15 @@
8080
"@typescript-eslint/parser": "~8.46.2",
8181
"@vitest/coverage-istanbul": "~4.0.4",
8282
"conventional-changelog-cli": "^5.0.0",
83+
"conventional-changelog-conventionalcommits": "~9.1.0",
84+
"conventional-recommended-bump": "~11.2.0",
8385
"eslint": "~9.38.0",
8486
"eslint-config-prettier": "~10.1.8",
8587
"globals": "~16.4.0",
8688
"husky": "~9.1.7",
8789
"lerna": "~9.0.0",
8890
"prettier": "~3.6.2",
91+
"semver": "^7.7.3",
8992
"tsup": "~8.5.0",
9093
"tsx": "~4.20.6",
9194
"typescript": "~5.9.3",

pnpm-lock.yaml

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/diagnose-lame.mjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env node
2+
3+
import { existsSync, readdirSync, statSync } from "node:fs";
4+
import { spawnSync } from "node:child_process";
5+
import { platform } from "node:os";
6+
7+
const {
8+
resolveLameBinary,
9+
resolveBundledLibraryDirectory,
10+
} = await import(new URL("../dist/index.cjs", import.meta.url));
11+
12+
function logSection(title) {
13+
console.log(`[lame-diagnostics] ${title}`);
14+
}
15+
16+
const binaryPath = resolveLameBinary();
17+
logSection(`Resolved binary: ${binaryPath}`);
18+
19+
try {
20+
const stats = statSync(binaryPath);
21+
logSection(
22+
`File stats -> size=${stats.size} mode=${stats.mode.toString(8)} mtime=${stats.mtime.toISOString()}`,
23+
);
24+
} catch (error) {
25+
logSection(`stat() failed: ${error instanceof Error ? error.message : error}`);
26+
}
27+
28+
const runCommand = (cmd, args) => {
29+
const result = spawnSync(cmd, args, {
30+
encoding: "utf-8",
31+
});
32+
33+
logSection(
34+
`${cmd} ${args.join(" ")} exited ${result.status} (signal: ${result.signal ?? "none"})`,
35+
);
36+
37+
if (result.stdout) {
38+
console.log(result.stdout.trim());
39+
}
40+
41+
if (result.stderr) {
42+
console.error(result.stderr.trim());
43+
}
44+
};
45+
46+
runCommand(binaryPath, ["--version"]);
47+
48+
if (platform() === "linux") {
49+
runCommand("ldd", [binaryPath]);
50+
}
51+
52+
const libraryDir = resolveBundledLibraryDirectory();
53+
logSection(
54+
`Bundled library directory: ${libraryDir ?? "not found (not expected on this platform?)"}`,
55+
);
56+
if (libraryDir && existsSync(libraryDir)) {
57+
const entries = readdirSync(libraryDir);
58+
if (entries.length === 0) {
59+
logSection("Bundled library directory is empty");
60+
} else {
61+
logSection(
62+
`Bundled libraries:\n${entries.map((entry) => ` - ${entry}`).join("\n")}`,
63+
);
64+
}
65+
}

0 commit comments

Comments
 (0)