Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
25ce733
Add clipanion 4.0.0-rc.4 to dependencies
winniehell Nov 6, 2024
c4b8099
Migrate AddCommand from cliffy to clipanion
winniehell Oct 23, 2024
eaabc34
Migrate BuildJsCommand from cliffy to clipanion
winniehell Oct 23, 2024
dce68f8
Migrate CapabilitiesCommand from cliffy to clipanion
winniehell Oct 24, 2024
fdff36c
Migrate CheckCommand from cliffy to clipanion
winniehell Oct 24, 2024
c11315e
Migrate ConvertCommand from cliffy to clipanion
winniehell Oct 24, 2024
c137de3
Migrate CreateCommand from cliffy to clipanion
winniehell Oct 24, 2024
ff6a8ab
Migrate CreateProjectCommand from cliffy to clipanion
winniehell Oct 23, 2024
292afca
Migrate CrossrefCommand from cliffy to clipanion
winniehell Oct 24, 2024
b0802ea
Migrate InspectCommand from cliffy to clipanion
winniehell Oct 24, 2024
a364fe3
Migrate InstallCommand from cliffy to clipanion
winniehell Oct 24, 2024
f2eb981
Migrate ListCommand from cliffy to clipanion
winniehell Oct 24, 2024
6303eae
Split ListCommand into ListExtensionsCommand and ListToolsCommand
winniehell Oct 24, 2024
41a88bf
Migrate PandocCommand from cliffy to clipanion
winniehell Oct 24, 2024
3d02ab0
Introduce PandocWrapperCommand
winniehell Oct 26, 2024
a18f1ef
Migrate RenderCommand from cliffy to clipanion
winniehell Oct 25, 2024
cca4d8b
Migrate PreviewCommand from cliffy to clipanion
winniehell Oct 24, 2024
ad6e0e3
Migrate PublishCommand from cliffy to clipanion
winniehell Nov 1, 2024
185551c
Migrate RemoveCommand from cliffy to clipanion
winniehell Nov 1, 2024
f5e6969
Migrate RunCommand from cliffy to clipanion
winniehell Nov 1, 2024
804f355
Migrate ServeCommand from cliffy to clipanion
winniehell Nov 1, 2024
bb75737
Migrate toolsCommands from cliffy to clipanion
winniehell Nov 1, 2024
e5af383
Migrate TypstCommand from cliffy to clipanion
winniehell Nov 1, 2024
a3a23f7
Migrate UninstallCommand from cliffy to clipanion
winniehell Nov 1, 2024
731bb8d
Migrate UpdateCommand from cliffy to clipanion
winniehell Nov 1, 2024
81b585d
Migrate useCommands from cliffy to clipanion
winniehell Nov 1, 2024
45f348e
Migrate appendLogOptions() / initializeLogger() from cliffy to clipanion
winniehell Nov 1, 2024
1fc553a
Migrate appendProfileArg() / setProfileFromArg() from cliffy to clipa…
winniehell Nov 3, 2024
9d6c24d
Migrate quartoCommand from cliffy to clipanion
winniehell Oct 30, 2024
6e0b017
Migrate ArchiveBinaryDependenciesCommand and CheckBinaryDependenciesC…
winniehell Nov 6, 2024
6bf59a8
Migrate CompileQuartoLatexmkCommand from cliffy to clipanion
winniehell Nov 6, 2024
8dc9255
Migrate ConfigureCommand from cliffy to clipanion
winniehell Nov 5, 2024
2b740e9
Migrate CycleDependenciesCommand and ParseSwcLogCommand from cliffy t…
winniehell Nov 6, 2024
71c3540
Migrate MakeInstallerDebCommand from cliffy to clipanion
winniehell Nov 6, 2024
e67955b
Migrate MakeInstallerMacCommand from cliffy to clipanion
winniehell Nov 6, 2024
0ae111e
Migrate MakeInstallerWindowsCommand from cliffy to clipanion
winniehell Nov 6, 2024
dccb46e
Migrate PackageCommand from cliffy to clipanion
winniehell Nov 5, 2024
de6cecb
Migrate PrepareDistCommand from cliffy to clipanion
winniehell Nov 6, 2024
088420e
Migrate UpdateHTMLDependenciesCommand from cliffy to clipanion
winniehell Nov 5, 2024
0b191fc
Migrate UpdatePandocCommand from cliffy to clipanion
winniehell Nov 6, 2024
5415c51
Migrate ValidateBundleCommand from cliffy to clipanion
winniehell Nov 6, 2024
3839170
Migrate quartoBld from cliffy to clipanion
winniehell Nov 1, 2024
3adc7b3
Migrate pdfCommand from cliffy to clipanion
winniehell Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -651,5 +651,8 @@
"src/resources/projects/website/search/fuse.min.js",
"src/resources/projects/website/search/quarto-search.js"
]
},
"imports": {
"clipanion": "npm:clipanion@^4.0.0-rc.4"
}
}
165 changes: 54 additions & 111 deletions package/src/bld.ts
Original file line number Diff line number Diff line change
@@ -1,131 +1,74 @@
/*
* package.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
* Copyright (C) 2020-2024 Posit Software, PBC
*/
import { Command } from "cliffy/command/mod.ts";
import { packageCommand } from "./cmd/pkg-cmd.ts";
import { configure } from "./common/configure.ts";
import { Builtins, Cli } from "npm:clipanion";
import { ConfigureCommand } from "./common/configure.ts";
import { mainRunner } from "../../src/core/main.ts";
import { PackageCommand } from "./cmd/pkg-cmd.ts";

import { prepareDist } from "./common/prepare-dist.ts";
import { updateHtmlDependencies } from "./common/update-html-dependencies.ts";
import { makeInstallerDeb } from "./linux/installer.ts";
import { makeInstallerMac } from "./macos/installer.ts";
import { PrepareDistCommand } from "./common/prepare-dist.ts";
import { UpdateHTMLDependenciesCommand } from "./common/update-html-dependencies.ts";
import { MakeInstallerDebCommand } from "./linux/installer.ts";
import { MakeInstallerMacCommand } from "./macos/installer.ts";
import {
compileQuartoLatexmkCommand,
CompileQuartoLatexmkCommand,
} from "./common/compile-quarto-latexmk.ts";
import { makeInstallerWindows } from "./windows/installer.ts";
import { MakeInstallerWindowsCommand } from "./windows/installer.ts";

import { appendLogOptions } from "../../src/core/log.ts";
import { addLoggingOptions } from "../../src/core/log.ts";
import {
cycleDependenciesCommand,
parseSwcLogCommand,
CycleDependenciesCommand,
ParseSwcLogCommand,
} from "./common/cyclic-dependencies.ts";
import {
archiveBinaryDependencies,
checkBinaryDependencies,
ArchiveBinaryDependenciesCommand,
CheckBinaryDependenciesCommand,
} from "./common/archive-binary-dependencies.ts";
import { updatePandoc } from "./common/update-pandoc.ts";
import { validateBundle } from "./common/validate-bundle.ts";
import { makeInstallerExternal } from "./ext/installer.ts";
import { UpdatePandocCommand } from "./common/update-pandoc.ts";
import { ValidateBundleCommand } from "./common/validate-bundle.ts";
import { MakeInstallerExternalCommand } from "./ext/installer.ts";

// Core command dispatch
export async function quartoBld(args: string[]) {
const rootCommand = new Command()
.name("quarto-bld [command]")
.version("0.1")
.description(
"Utility that implements packaging and distribution of quarto cli",
)
.option(
"-s, --signing-identity [id:string]",
"Signing identity to use when signing any files.",
{ global: true },
)
.throwErrors();
const commands: (typeof PackageCommand)[] = [
ArchiveBinaryDependenciesCommand,
CheckBinaryDependenciesCommand,
CompileQuartoLatexmkCommand,
ConfigureCommand,
CycleDependenciesCommand,
MakeInstallerDebCommand,
MakeInstallerExternalCommand,
MakeInstallerMacCommand,
MakeInstallerWindowsCommand,
ParseSwcLogCommand,
PrepareDistCommand,
UpdateHTMLDependenciesCommand,
UpdatePandocCommand,
ValidateBundleCommand,
]

getCommands().forEach((command) => {
rootCommand.command(command.getName(), appendLogOptions(command));
});

await rootCommand.parse(args);
}
class QuartoBld extends Cli {
constructor() {
super({
binaryLabel: "Utility that implements packaging and distribution of quarto cli",
binaryName: 'quarto-bld',
binaryVersion: "0.1",
});

if (import.meta.main) {
await mainRunner(() => quartoBld(Deno.args));
[
...commands,
Builtins.HelpCommand
].forEach((command) => {
addLoggingOptions(command);
this.register(command);
});
}
}

// Supported package commands
function getCommands() {
// deno-lint-ignore no-explicit-any
const commands: Command<any>[] = [];
commands.push(
packageCommand(configure)
.name("configure")
.description(
"Configures this machine for running developer version of Quarto",
),
);
commands.push(
packageCommand(updateHtmlDependencies)
.name("update-html-dependencies")
.description(
"Updates Bootstrap, themes, and JS/CSS dependencies based upon the version in configuration",
),
);
commands.push(
packageCommand(archiveBinaryDependencies)
.name("archive-bin-deps")
.description("Downloads and archives our binary dependencies."),
);
commands.push(
packageCommand(checkBinaryDependencies)
.name("check-bin-deps")
.description("Checks the paths and URLs of our binary dependencies."),
);
commands.push(
packageCommand(prepareDist)
.name("prepare-dist")
.description("Prepares the distribution directory for packaging."),
);
commands.push(
packageCommand(validateBundle)
.name("validate-bundle")
.description("Validate a JS bundle built using prepare-dist")
);
commands.push(
packageCommand(makeInstallerMac)
.name("make-installer-mac")
.description("Builds Mac OS installer"),
);
commands.push(
packageCommand(makeInstallerDeb)
.name("make-installer-deb")
.description("Builds Linux deb installer"),
);
commands.push(
packageCommand(makeInstallerWindows)
.name("make-installer-win")
.description("Builds Windows installer"),
);
commands.push(
packageCommand(makeInstallerExternal)
.name("make-installer-dir")
.description("Copies Quarto-only files, omitting dependencies, to specified location (for use in third party packaging)"),
);
commands.push(
compileQuartoLatexmkCommand(),
);
commands.push(
cycleDependenciesCommand(),
);
commands.push(
parseSwcLogCommand(),
);
commands.push(
updatePandoc(),
);

return commands;
if (import.meta.main) {
await mainRunner(async () => {
const quartoBld = new QuartoBld();
await quartoBld.runExit(Deno.args);
});
}
57 changes: 20 additions & 37 deletions package/src/cmd/pkg-cmd.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,40 @@
/*
* pkg-cmd.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
* Copyright (C) 2020-2024 Posit Software, PBC
*
*/
import { Command } from "cliffy/command/mod.ts";
import { Command, Option } from "npm:clipanion";
import { join } from "../../../src/deno_ral/path.ts";

import { printConfiguration } from "../common/config.ts";

import {
Configuration,
kValidArch,
kValidOS,
readConfiguration,
} from "../common/config.ts";

export const kLogLevel = "logLevel";
export const kVersion = "setVersion";
export abstract class PackageCommand extends Command {
arch = Option.String("-a,--arch", {description: "Architecture for this command (" + kValidArch.join(", ") + ")"});
os = Option.String("-o,--os", {description: "Operating system for this command (" + kValidOS.join(", ") + ")"});
version = Option.String("-sv,--set-version", {description: "Version to set when preparing this distribution"});

export function packageCommand(run: (config: Configuration) => Promise<void>) {
return new Command().option(
"-sv, --set-version [version:string]",
"Version to set when preparing this distribution",
).option(
"-o, --os [os:string]",
"Operating system for this command (" + kValidOS.join(", ") + ")",
)
.option(
"-a, --arch [arch:string]",
"Architecture for this command (" + kValidArch.join(", ") + ")",
)
// deno-lint-ignore no-explicit-any
.action(async (args: Record<string, any>) => {
const version = args[kVersion];
const os = args["os"];
const arch = args["arch"];
get config() {
return readConfiguration(this.version, this.os, this.arch);
}

// Read the version and configuration
const config = readConfiguration(version, os, arch);

// Set up the bin and share environment for any downstream code
Deno.env.set("QUARTO_BIN_PATH", config.directoryInfo.bin);
Deno.env.set(
async execute() {
// Set up the bin and share environment for any downstream code
const { directoryInfo } = this.config;
Deno.env.set("QUARTO_BIN_PATH", directoryInfo.bin);
Deno.env.set(
"QUARTO_SHARE_PATH",
join(config.directoryInfo.src, "resources"),
);
Deno.env.set("QUARTO_DEBUG", "true");

// Print the configuration
printConfiguration(config);
join(directoryInfo.src, "resources"),
);
Deno.env.set("QUARTO_DEBUG", "true");

// Run the command
await run(config);
});
// Print the configuration
printConfiguration(this.config);
}
}
30 changes: 29 additions & 1 deletion package/src/common/archive-binary-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*
* archive-binary-dependencies.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
* Copyright (C) 2020-2024 Posit Software, PBC
*/
import { join } from "../../../src/deno_ral/path.ts";
import { info } from "../../../src/deno_ral/log.ts";
import { Command } from "npm:clipanion";

import { execProcess } from "../../../src/core/process.ts";
import { Configuration, withWorkingDir } from "./config.ts";
Expand All @@ -14,6 +15,7 @@ import {
kDependencies,
PlatformDependency,
} from "./dependencies/dependencies.ts";
import { PackageCommand } from "../cmd/pkg-cmd.ts";

const kBucket = "s3://rstudio-buildtools/quarto";
const kBucketBaseUrl = "https://s3.amazonaws.com/rstudio-buildtools/quarto";
Expand Down Expand Up @@ -197,3 +199,29 @@ async function download(
);
}
}

export class ArchiveBinaryDependenciesCommand extends PackageCommand {
static paths = [["archive-bin-deps"]];

static usage = Command.Usage({
description: "Downloads and archives our binary dependencies.",
});

async execute() {
await super.execute();
await archiveBinaryDependencies(this.config)
}
}

export class CheckBinaryDependenciesCommand extends PackageCommand {
static paths = [["check-bin-deps"]];

static usage = Command.Usage({
description: "Checks the paths and URLs of our binary dependencies.",
});

async execute() {
await super.execute();
await checkBinaryDependencies(this.config)
}
}
Loading
Loading