Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
- run: bun run build
- run: bun run typecheck
- run: bun run test
- name: Smoke test packed production dependencies
run: bash scripts/package-smoke.sh
container-smoke:
name: Test production container
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to `m4k` are documented here.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.7]

### Fixed

- Declared `tasque` and `@ffmpeg-installer/ffmpeg` as runtime dependencies so production-only consumers can import and use the published package without workspace development dependencies.

## [0.3.6]

### Added
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "m4k",
"version": "0.3.6",
"version": "0.3.7",
"description": "Media toolkit for node, bun, and deno",
"keywords": [
"audio",
Expand Down Expand Up @@ -33,12 +33,12 @@
"test": "bun test"
},
"dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@huggingface/transformers": "3.8.1",
"@m4k/common": "workspace:^"
"@m4k/common": "workspace:^",
"tasque": "^0.1.2"
},
"devDependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"tasque": "^0.1.2",
"typescript": "^7.0.2"
},
"peerDependencies": {
Expand Down
19 changes: 19 additions & 0 deletions scripts/package-smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
mkdir -p "$scratch/packs" "$scratch/consumer" "$scratch/work"
for package in common core client; do
(cd "$root/packages/$package" && bun pm pack --destination "$scratch/packs" --quiet)
done
common=("$scratch"/packs/m4k-common-*.tgz)
# Resolve internal dependencies to this pack even when its version is not published yet.
bun -e 'console.log(JSON.stringify({private:true,type:"module",overrides:{"@m4k/common":`file:${Bun.argv[1]}`}}))' "${common[0]}" > "$scratch/consumer/package.json"
# Copy the runner too: executing it from the repository would resolve workspace dependencies.
cp "$root/scripts/package-smoke.ts" "$scratch/consumer/smoke.ts"
(
cd "$scratch/consumer"
bun add --production --ignore-scripts "$scratch"/packs/*.tgz
env -u NODE_PATH -u FFMPEG_PATH M4K_TMP_DIR="$scratch/work" bun run smoke.ts "$root/fixtures"
)
40 changes: 40 additions & 0 deletions scripts/package-smoke.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copied into an isolated production-only consumer by package-smoke.sh.
import assert from "node:assert/strict";
import { ProcessedFile } from "@m4k/common";
import { classifyImage as classifyRemote } from "@m4k/client";
import { classifyImage, processAudio, processImage } from "m4k";

const fixtures = Bun.argv[2];
assert(fixtures, "Fixture directory is required");
assert.equal(process.env.FFMPEG_PATH, undefined);
assert.equal(process.env.NODE_PATH, undefined);
assert.equal(typeof classifyImage, "function");
assert.equal(typeof classifyRemote, "function");

const images = processImage(`${fixtures}/image.jpeg`, { format: "webp" });
assert(images);
let imageOutputs = 0;
for await (const part of images) {
if (!(part instanceof ProcessedFile)) continue;
assert.equal(part.type, "image/webp");
assert(part.stream);
let size = 0;
for await (const chunk of part.stream) size += chunk.byteLength;
assert(size > 0);
imageOutputs++;
}
assert.equal(imageOutputs, 1);

const audio = processAudio(`${fixtures}/audio.mp3`, { format: "ogg", codec: "libvorbis" });
assert(audio);
let audioOutputs = 0;
for await (const part of audio) {
if (!(part instanceof ProcessedFile)) continue;
assert.equal(part.type, "audio/ogg");
assert(Bun.file(part.name).size > 0);
audioOutputs++;
}
assert.equal(audioOutputs, 1);
console.log(
"Package smoke passed: isolated production imports, JPEG → WebP and bundled FFmpeg MP3 → Ogg",
);
Loading