Skip to content

Commit 78ae90e

Browse files
committed
prepare-dist - force rebuild of quarto-preview
1 parent 7526406 commit 78ae90e

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

package/src/common/prepare-dist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function prepareDist(
105105

106106
// build quarto-preview.js
107107
info("Building Quarto Web UI");
108-
const result = buildQuartoPreviewJs(config.directoryInfo.src);
108+
const result = buildQuartoPreviewJs(config.directoryInfo.src, undefined, true);
109109
if (!result.success) {
110110
throw new Error();
111111
}

src/core/previewjs.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66

77
import { join } from "path/mod.ts";
88

9-
export function buildQuartoPreviewJs(srcDir: string, denoDir?: string) {
9+
export function buildQuartoPreviewJs(
10+
srcDir: string,
11+
denoDir?: string,
12+
force?: boolean,
13+
) {
14+
const args = ["run", "-A", "build.ts"];
15+
if (force) {
16+
args.push("--force");
17+
}
1018
const buildCmd = new Deno.Command(Deno.execPath(), {
11-
args: ["run", "-A", "build.ts"],
19+
args: args,
1220
cwd: quartoPreviewJsDir(srcDir),
1321
env: denoDir ? { DENO_DIR: denoDir } : undefined,
1422
stderr: "inherit",

src/webui/quarto-preview/build.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// ensure this is treated as a module
22
export {};
33

4+
const args = Deno.args;
5+
46
// establish target js build time
57
const kQuartoPreviewJs = "../../resources/preview/quarto-preview.js";
68
let jsBuildTime: number;
@@ -11,7 +13,7 @@ try {
1113
}
1214

1315
// check if any of our repo files have a later time
14-
let build = false;
16+
let build = args.length > 0 && args.includes("--force");
1517
try {
1618
const command = new Deno.Command("git", { args: ["ls-files"] });
1719
const cmdOutput = await command.output();
@@ -21,7 +23,7 @@ try {
2123
build = files.some((file) =>
2224
Deno.statSync(file).mtime!.valueOf() > jsBuildTime
2325
);
24-
} else {
26+
} else {
2527
// not in a git repo, rebuild
2628
build = true;
2729
}

0 commit comments

Comments
 (0)