Skip to content

Commit c01e109

Browse files
Add typst-gather 0.2.2 as a downloaded binary dependency
Add typst-gather to the dependency system, following the same pattern as Pandoc, Typst, esbuild, and other binary dependencies. Pre-built binaries are downloaded from GitHub releases (quarto-dev/typst-gather). - Add TYPST_GATHER=0.2.2 to configuration - Add typst-gather dependency definition with platform-specific URLs - Register typst-gather in the dependency list
1 parent b9e013e commit c01e109

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

configuration

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export PANDOC=3.8.3
1717
export DARTSASS=1.87.0
1818
export ESBUILD=0.25.10
1919
export TYPST=0.14.2
20+
export TYPST_GATHER=0.2.2
2021
export VERAPDF=1.28.2
2122

2223

package/src/common/dependencies/dependencies.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { esBuild } from "./esbuild.ts";
1515
import { pandoc } from "./pandoc.ts";
1616
import { archiveUrl } from "../archive-binary-dependencies.ts";
1717
import { typst } from "./typst.ts";
18+
import { typstGather } from "./typst-gather.ts";
1819
import { verapdf } from "./verapdf.ts";
1920

2021
// The list of binary dependencies for Quarto
@@ -24,6 +25,7 @@ export const kDependencies = [
2425
dartSass(version("DARTSASS")),
2526
esBuild(version("ESBUILD")),
2627
typst(version("TYPST")),
28+
typstGather(version("TYPST_GATHER")),
2729
verapdf(version("VERAPDF")),
2830
];
2931

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
import { join, dirname } from "../../../../src/deno_ral/path.ts"
3+
import { ensureDirSync, existsSync } from "../../../../src/deno_ral/fs.ts"
4+
5+
import { Configuration } from "../config.ts";
6+
import { Dependency } from "./dependencies.ts";
7+
import { which } from "../../../../src/core/path.ts";
8+
import { unTar } from "../../util/tar.ts";
9+
10+
export function typstGather(version: string): Dependency {
11+
const typstGatherRelease = (filename: string) => {
12+
return {
13+
filename,
14+
url: `https://github.com/quarto-dev/typst-gather/releases/download/v${version}/${filename}`,
15+
configure: async (config: Configuration, path: string) => {
16+
const file = config.os === "windows" ? "typst-gather.exe" : "typst-gather";
17+
const vendor = Deno.env.get("QUARTO_VENDOR_BINARIES");
18+
if (vendor === undefined || vendor === "true") {
19+
const dir = dirname(path);
20+
const targetDir = join(dir, config.arch);
21+
ensureDirSync(targetDir);
22+
23+
// expand
24+
await unTar(path);
25+
26+
// move the binary and cleanup
27+
const extractedPath = join(dir, file);
28+
Deno.renameSync(extractedPath, join(targetDir, file));
29+
} else {
30+
// verify that the binary is on PATH, but otherwise don't do anything
31+
if (which(file) === undefined) {
32+
throw new Error(
33+
`${file} is not on PATH. Please install it and add it to PATH.`,
34+
);
35+
}
36+
}
37+
}
38+
}
39+
}
40+
41+
return {
42+
name: "typst-gather",
43+
bucket: "typst-gather",
44+
version,
45+
archiveOnly: true,
46+
architectureDependencies: {
47+
"x86_64": {
48+
"windows": typstGatherRelease("typst-gather-x86_64-pc-windows-msvc.zip"),
49+
"linux": typstGatherRelease("typst-gather-x86_64-unknown-linux-gnu.tar.gz"),
50+
"darwin": typstGatherRelease("typst-gather-x86_64-apple-darwin.tar.gz"),
51+
},
52+
"aarch64": {
53+
"linux": typstGatherRelease("typst-gather-aarch64-unknown-linux-gnu.tar.gz"),
54+
"darwin": typstGatherRelease("typst-gather-aarch64-apple-darwin.tar.gz"),
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)