Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/package/src/bld.ts
6449 views
1
/*
2
* package.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*/
6
import { Command } from "cliffy/command/mod.ts";
7
import { packageCommand } from "./cmd/pkg-cmd.ts";
8
import { configure } from "./common/configure.ts";
9
import { mainRunner } from "../../src/core/main.ts";
10
11
import { prepareDist } from "./common/prepare-dist.ts";
12
import { updateHtmlDependencies } from "./common/update-html-dependencies.ts";
13
import { makeInstallerDeb, makeInstallerRpm } from "./linux/installer.ts";
14
import { makeInstallerMac } from "./macos/installer.ts";
15
import {
16
compileQuartoLatexmkCommand,
17
} from "./common/compile-quarto-latexmk.ts";
18
import { makeInstallerWindows } from "./windows/installer.ts";
19
20
import { appendLogOptions } from "../../src/core/log.ts";
21
import {
22
cycleDependenciesCommand,
23
parseSwcLogCommand,
24
} from "./common/cyclic-dependencies.ts";
25
import {
26
archiveBinaryDependencies,
27
checkBinaryDependencies,
28
} from "./common/archive-binary-dependencies.ts";
29
import { updatePandoc } from "./common/update-pandoc.ts";
30
import { validateBundle } from "./common/validate-bundle.ts";
31
import { makeInstallerExternal } from "./ext/installer.ts";
32
33
// Core command dispatch
34
export async function quartoBld(args: string[]) {
35
const rootCommand = new Command()
36
.name("quarto-bld [command]")
37
.version("0.1")
38
.description(
39
"Utility that implements packaging and distribution of quarto cli",
40
)
41
.option(
42
"-s, --signing-identity [id:string]",
43
"Signing identity to use when signing any files.",
44
{ global: true },
45
)
46
.throwErrors();
47
48
getCommands().forEach((command) => {
49
rootCommand.command(command.getName(), appendLogOptions(command));
50
});
51
52
await rootCommand.parse(args);
53
}
54
55
if (import.meta.main) {
56
await mainRunner(() => quartoBld(Deno.args));
57
}
58
59
// Supported package commands
60
function getCommands() {
61
// deno-lint-ignore no-explicit-any
62
const commands: Command<any>[] = [];
63
commands.push(
64
packageCommand(configure, "configure")
65
.description(
66
"Configures this machine for running developer version of Quarto",
67
),
68
);
69
commands.push(
70
packageCommand(updateHtmlDependencies, "update-html-dependencies")
71
.description(
72
"Updates Bootstrap, themes, and JS/CSS dependencies based upon the version in configuration",
73
),
74
);
75
commands.push(
76
packageCommand(archiveBinaryDependencies, "archive-bin-deps")
77
.description("Downloads and archives our binary dependencies."),
78
);
79
commands.push(
80
packageCommand(checkBinaryDependencies, "check-bin-deps")
81
.description("Checks the paths and URLs of our binary dependencies."),
82
);
83
commands.push(
84
packageCommand(prepareDist, "prepare-dist")
85
.description("Prepares the distribution directory for packaging."),
86
);
87
commands.push(
88
packageCommand(validateBundle, "validate-bundle")
89
.description("Validate a JS bundle built using prepare-dist")
90
);
91
commands.push(
92
packageCommand(makeInstallerMac, "make-installer-mac")
93
.description("Builds Mac OS installer"),
94
);
95
commands.push(
96
packageCommand(makeInstallerDeb, "make-installer-deb")
97
.description("Builds Linux deb installer"),
98
);
99
commands.push(
100
packageCommand(makeInstallerRpm, "make-installer-rpm")
101
.description("Builds Linux rpm installer"),
102
);
103
commands.push(
104
packageCommand(makeInstallerWindows, "make-installer-win")
105
.description("Builds Windows installer"),
106
);
107
commands.push(
108
packageCommand(makeInstallerExternal, "make-installer-dir")
109
.description("Copies Quarto-only files, omitting dependencies, to specified location (for use in third party packaging)"),
110
);
111
commands.push(
112
compileQuartoLatexmkCommand(),
113
);
114
commands.push(
115
cycleDependenciesCommand(),
116
);
117
commands.push(
118
parseSwcLogCommand(),
119
);
120
commands.push(
121
updatePandoc(),
122
);
123
124
return commands;
125
}
126
127