Skip to content

Commit

Permalink
fix: run build:api failed
Browse files Browse the repository at this point in the history
  • Loading branch information
hughfenghen committed May 27, 2024
1 parent b0ff329 commit d611437
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/av-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test": "vitest --config test-vite.config.ts",
"test:coverage": "vitest run --coverage",
"build": "vite build && tsc -p build.tsconfig.json --outDir dist",
"build:api": "typedoc src/index.ts --out ../../doc-site/public/_api/av-canvas",
"build:api": "typedoc src/index.ts --tsconfig build.tsconfig.json --out ../../doc-site/public/_api/av-canvas",
"prepublishOnly": "yarn build",
"preview": "vite preview"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/av-cliper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:coverage": "vitest run --coverage",
"build": "vite build && tsc -p build.tsconfig.json --outDir dist",
"build:dev": "vite build --watch --emptyOutDir false & tsc -p build.tsconfig.json --outDir dist --watch",
"build:api": "typedoc src/index.ts --out ../../doc-site/public/_api/av-cliper",
"build:api": "typedoc src/index.ts --tsconfig build.tsconfig.json --out ../../doc-site/public/_api/av-cliper",
"prepublishOnly": "yarn build"
},
"files": [
Expand Down
26 changes: 2 additions & 24 deletions packages/av-cliper/src/__tests__/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ Object.assign(global, {
}),
});

Object.assign(global, {
AudioData: class {
constructor(init) {
Object.assign(this, init);
}
},
});

export const AudioBufferMock = {
duration: 0,
sampleRate: 48000,
Expand Down Expand Up @@ -193,30 +185,16 @@ Object.assign(global, {
}),
});

Object.assign(global, {
VideoFrame: vi.fn().mockImplementation((a, b) => {
const that = Object.assign(
Object.create(VideoFrame.prototype),
{
clone: () => ({ ...that }),
close: vi.fn(),
},
b,
);
return that;
}),
});

class Worker {
url: string;
onmessage: (msg: string) => void;

constructor(stringUrl) {
constructor(stringUrl: string) {
this.url = stringUrl;
this.onmessage = () => {};
}

postMessage(msg) {
postMessage(msg: string) {
this.onmessage(msg);
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/av-cliper/src/mp4-utils/__tests__/mp4-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ describe('file2stream', () => {
test('enqueue data to stream', () => {
const file = mp4box.createFile();
file.boxes.push(
// @ts-expect-error
...Array(5)
.fill(0)
.map(() => ({
write: (ds) => {
write: (ds: any) => {
ds.writeUint8Array(new Uint8Array([1]));
},
})),
Expand All @@ -38,6 +39,7 @@ describe('file2stream', () => {

test('stop stream', () => {
const file = mp4box.createFile();
// @ts-expect-error
file.boxes = Array(5)
.fill(0)
.map(() => ({ write: vi.fn(), data: new ArrayBuffer(0) }));
Expand All @@ -54,6 +56,7 @@ describe('file2stream', () => {

test('cancel stream', () => {
const file = mp4box.createFile();
// @ts-expect-error
file.boxes = Array(5)
.fill(0)
.map(() => ({ write: vi.fn(), data: new ArrayBuffer(0) }));
Expand Down
2 changes: 1 addition & 1 deletion packages/av-recorder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test": "vitest",
"test:coverage": "vitest run --coverage",
"build": "vite build && tsc -p build.tsconfig.json --outDir dist",
"build:api": "typedoc src/av-recorder.ts --out ../../doc-site/public/_api/av-recorder",
"build:api": "typedoc src/av-recorder.ts --tsconfig build.tsconfig.json --out ../../doc-site/public/_api/av-recorder",
"prepublishOnly": "yarn build"
},
"files": [
Expand Down

0 comments on commit d611437

Please sign in to comment.