Skip to content

Commit f423519

Browse files
committed
chore: address and remove TODOs
1 parent 6ba5556 commit f423519

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/publish/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# mosaic-publish TODO: Adjust this doc
1+
# mosaic-publish
22

33
A CLI tool for compiling and optimizing specifications. The tool processes spec files, handles dataset optimizations, and provides a configurable way to manage different compile and optimization tasks.
44

packages/publish/src/MosaicPublisher.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export class MosaicPublisher {
267267
*/
268268
private async exportDataFromDuckDB(tables: Record<string, Set<string>>) {
269269
const copy_queries: string[] = [];
270+
let containsPreAggData = false;
270271
for (const node of Object.values(this.data!)) {
271272
if (!(node instanceof ParquetDataNode)) continue;
272273
const table = node.name;
@@ -290,12 +291,15 @@ export class MosaicPublisher {
290291
throw new Error(`Invalid optimization level: ${this.optimize}`);
291292
}
292293
copy_queries.push(query);
294+
295+
if (file.startsWith('.mosaic')) {
296+
containsPreAggData = true;
297+
}
293298
}
294299

295300
if (copy_queries.length > 0) {
296-
// TODO: Make the following conditionally on data needs
297301
fs.mkdirSync(path.join(this.outputPath, 'data'), { recursive: true });
298-
fs.mkdirSync(path.join(this.outputPath, 'data/.mosaic'), { recursive: true });
302+
if (containsPreAggData) fs.mkdirSync(path.join(this.outputPath, 'data/.mosaic'), { recursive: true });
299303

300304
await this.ctx.coordinator.exec(copy_queries);
301305
}

packages/publish/src/util/renderHelpers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import { MosaicClient } from "@uwdata/mosaic-core/src/MosaicClient.js";
22
import { InstantiateContext } from "@uwdata/mosaic-spec";
33
import { Canvas } from "skia-canvas";
44

5-
export function mockCanvas (window: any) {
5+
export function mockCanvas(window: any) {
66
const og = window.document.createElement
77
window.document.createElement = function (tagName: string) {
88
if (tagName !== 'canvas') {
99
return og.call(this, tagName)
1010
} else {
1111
const canvas = new Canvas();
1212
const el = og.call(this, tagName) as HTMLCanvasElement;
13-
// TODO: this is a hack to get around the fact that the canvas is not a real canvas
1413
el.getContext = canvas.getContext.bind(canvas) as unknown as HTMLCanvasElement['getContext'];
1514
el.toDataURL = canvas.toDataURLSync.bind(canvas);
1615
const set = el.setAttribute;
@@ -27,6 +26,6 @@ export function mockCanvas (window: any) {
2726
}
2827

2928
export function clientsReady(ctx: InstantiateContext) {
30-
const clients = [...ctx.coordinator.clients] as MosaicClient[];
31-
return Promise.allSettled(clients.map(c => c.pending));
29+
const clients = [...ctx.coordinator.clients] as MosaicClient[];
30+
return Promise.allSettled(clients.map(c => c.pending));
3231
}

0 commit comments

Comments
 (0)