@datashow/super-visual-cli 0.1.0-rc.3 → 0.1.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datashow/super-visual-cli",
3
- "version": "0.1.0-rc.3",
3
+ "version": "0.1.0-rc.4",
4
4
  "description": "CLI for validating, compiling, packaging, verifying, and deploying Super Visual projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,10 +25,10 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@datashow/super-visual-adapter-claude-dashboard": "0.1.0-rc.3",
29
- "@datashow/super-visual-compiler": "0.1.0-rc.3",
30
- "@datashow/super-visual-contracts": "0.1.0-rc.3",
31
- "@datashow/super-visual-fabric": "0.1.0-rc.3",
28
+ "@datashow/super-visual-adapter-claude-dashboard": "0.1.0-rc.4",
29
+ "@datashow/super-visual-compiler": "0.1.0-rc.4",
30
+ "@datashow/super-visual-contracts": "0.1.0-rc.4",
31
+ "@datashow/super-visual-fabric": "0.1.0-rc.4",
32
32
  "@fontsource/source-serif-4": "5.3.1",
33
33
  "@nivo/bar": "0.99.0",
34
34
  "@nivo/line": "0.99.0",
package/src/main.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { cp, mkdir, mkdtemp, readFile, readdir, rename, writeFile } from "node:fs/promises";
2
+ import { writeSync } from "node:fs";
2
3
  import { execFile } from "node:child_process";
3
4
  import os from "node:os";
4
5
  import path from "node:path";
@@ -15,12 +16,20 @@ import { resolveProjectTarget, targetUpdate, writeProjectTarget } from "./projec
15
16
  import { runSemanticPreviewTest, startSemanticPreview } from "./semantic-preview.mjs";
16
17
 
17
18
  const run = promisify(execFile);
18
- const VERSION = "0.1.0-rc.3";
19
+ const VERSION = "0.1.0-rc.4";
19
20
  const FABRIC_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20
21
  const SPINNER_FRAMES = ["|", "/", "-", "\\"];
21
22
  const progressStream = process.stderr;
22
23
  let activeProgress = null;
23
24
 
25
+ function writeProgress(value) {
26
+ try {
27
+ writeSync(2, value);
28
+ } catch {
29
+ progressStream.write(value);
30
+ }
31
+ }
32
+
24
33
  export class CliUserError extends Error {
25
34
  constructor(message, { summary, guidance } = {}) {
26
35
  super(message);
@@ -52,19 +61,19 @@ function output(value, json) {
52
61
  export function stopActiveProgress() {
53
62
  if (!activeProgress) return;
54
63
  clearInterval(activeProgress.timer);
55
- progressStream.write(`\r${" ".repeat(activeProgress.width)}\r`);
64
+ writeProgress(`\r${" ".repeat(activeProgress.width)}\r`);
56
65
  activeProgress = null;
57
66
  }
58
67
 
59
68
  export function writeInitProgress(event) {
60
69
  if (event.status === "running") {
61
70
  stopActiveProgress();
62
- progressStream.write(`> ${event.message}\n`);
71
+ writeProgress(`> ${event.message}\n`);
63
72
  if (!progressStream.isTTY) return;
64
73
  let frame = 0;
65
74
  const render = () => {
66
75
  const line = `${SPINNER_FRAMES[frame % SPINNER_FRAMES.length]} Working...`;
67
- progressStream.write(`\r${line}`);
76
+ writeProgress(`\r${line}`);
68
77
  activeProgress.width = Math.max(activeProgress.width, line.length);
69
78
  frame += 1;
70
79
  };
@@ -75,7 +84,7 @@ export function writeInitProgress(event) {
75
84
  }
76
85
  stopActiveProgress();
77
86
  const marker = event.status === "passed" ? "✓" : "!";
78
- progressStream.write(`${marker} ${event.message}\n`);
87
+ writeProgress(`${marker} ${event.message}\n`);
79
88
  }
80
89
 
81
90
  function semanticInventory(model) {
@@ -325,14 +334,19 @@ function createProgram() {
325
334
  validateFabricId(options.workspaceId, "--workspace-id");
326
335
  validateFabricId(options.semanticModelId, "--semantic-model-id");
327
336
  const json = jsonEnabled(command);
328
- if (!json) progressStream.write(`\nSuper Visual init\n\n`);
337
+ if (!json) writeProgress(`\nSuper Visual init\n\n`);
329
338
  let liveValidation = null;
330
339
  if (options.workspaceId && options.semanticModelId && !options.skipLiveValidation) {
331
- if (!json) writeInitProgress({ status: "running", message: "Verifying the Fabric workspace and Power BI semantic model (read-only)" });
332
340
  let inspected;
333
341
  try {
334
342
  const client = new FabricHttpClient({ timeoutSeconds: Number(options.timeout) });
335
- inspected = await inspectSemanticModel({ client, workspaceId: options.workspaceId, workspaceName: options.workspaceName, semanticModelId: options.semanticModelId });
343
+ inspected = await inspectSemanticModel({
344
+ client,
345
+ workspaceId: options.workspaceId,
346
+ workspaceName: options.workspaceName,
347
+ semanticModelId: options.semanticModelId,
348
+ onProgress: json ? null : writeInitProgress,
349
+ });
336
350
  } catch (error) {
337
351
  throw new CliUserError(error instanceof Error ? error.message : String(error), {
338
352
  summary: "Super Visual could not verify the Fabric workspace and semantic model.",
@@ -349,9 +363,9 @@ function createProgram() {
349
363
  };
350
364
  if (!json) writeInitProgress({ status: "passed", message: `Verified workspace ${inspected.workspace.displayName} and semantic model ${inspected.semanticModel.displayName}` });
351
365
  } else if (!json && options.skipLiveValidation) {
352
- progressStream.write("! Live Fabric validation skipped by request\n");
366
+ writeProgress("! Live Fabric validation skipped by request\n");
353
367
  } else if (!json) {
354
- progressStream.write("! No complete Fabric binding supplied; live validation was not run\n");
368
+ writeProgress("! No complete Fabric binding supplied; live validation was not run\n");
355
369
  }
356
370
  const result = await initializeProject({
357
371
  directory,
@@ -10,6 +10,6 @@
10
10
  "verify": "supervisual verify ."
11
11
  },
12
12
  "devDependencies": {
13
- "@datashow/super-visual-cli": "0.1.0-rc.3"
13
+ "@datashow/super-visual-cli": "0.1.0-rc.4"
14
14
  }
15
15
  }
@@ -10,6 +10,6 @@
10
10
  "verify": "supervisual verify ."
11
11
  },
12
12
  "devDependencies": {
13
- "@datashow/super-visual-cli": "0.1.0-rc.3"
13
+ "@datashow/super-visual-cli": "0.1.0-rc.4"
14
14
  }
15
15
  }