Skip to content

Commit d64af63

Browse files
committed
Migrate UpdateHTMLDependenciesCommand from cliffy to clipanion
1 parent 346b4d1 commit d64af63

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

package/src/common/update-html-dependencies.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
22
* bootstrap.ts
33
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
4+
* Copyright (C) 2020-2024 Posit Software, PBC
55
*/
66
import { copySync, ensureDir, ensureDirSync, existsSync, walkSync } from "../../../src/deno_ral/fs.ts";
77
import { info } from "../../../src/deno_ral/log.ts";
88
import { dirname, basename, extname, join } from "../../../src/deno_ral/path.ts";
99
import { lines } from "../../../src/core/text.ts";
10-
import * as ld from "../../../src/core/lodash.ts";
10+
import { Command } from "npm:clipanion";
1111

1212
import { runCmd } from "../util/cmd.ts";
1313
import { applyGitPatches, Repo, withRepo } from "../util/git.ts";
@@ -18,6 +18,7 @@ import { visitLines } from "../../../src/core/file.ts";
1818
import { copyTo } from "../../../src/core/copy.ts";
1919
import { kSourceMappingRegexes } from "../../../src/config/constants.ts";
2020
import { unzip } from "../../../src/core/zip.ts";
21+
import { PackageCommand } from "../cmd/pkg-cmd.ts";
2122

2223
export async function updateHtmlDependencies(config: Configuration) {
2324
info("Updating Bootstrap with version info:");
@@ -224,7 +225,7 @@ export async function updateHtmlDependencies(config: Configuration) {
224225

225226
// Glightbox
226227
const glightboxDir = join(formatDir, "glightbox");
227-
const glightBoxVersion = Deno.env.get("GLIGHTBOX_JS");;
228+
const glightBoxVersion = Deno.env.get("GLIGHTBOX_JS");
228229

229230
info("Updating glightbox");
230231
const fileName = `glightbox-master.zip`;
@@ -660,8 +661,8 @@ async function updateDatatables(
660661
// pdfmake
661662
// https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js
662663
// https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js
663-
const datatablesConfig = Deno.env.get("DATATABLES_CONFIG");;
664-
const pdfMakeVersion = Deno.env.get("PDF_MAKE");;
664+
const datatablesConfig = Deno.env.get("DATATABLES_CONFIG");
665+
const pdfMakeVersion = Deno.env.get("PDF_MAKE");
665666
const dtFiles = ["datatables.min.css", "datatables.min.js"];
666667
const targetDir = join(
667668
config.directoryInfo.src,
@@ -1365,3 +1366,16 @@ revealjsThemePatches["solarized"] = createRevealjsThemePatches(["mainColor", "he
13651366
revealjsThemePatches["white-contrast"] = createRevealjsThemePatches(["backgroundColor", "mainColor", "headingColor", "mainFontSize", "mainFont", "headingFont", "headingTextShadow", "headingLetterSpacing", "headingTextTransform", "headingFontWeight", "linkColor", "linkColorHover", "selectionBackgroundColor", "heading1Size", "heading2Size", "heading3Size", "heading4Size"])
13661367
revealjsThemePatches["white"] = createRevealjsThemePatches(["backgroundColor", "mainColor", "headingColor", "mainFontSize", "mainFont", "headingFont", "headingTextShadow", "headingLetterSpacing", "headingTextTransform", "headingFontWeight", "linkColor", "linkColorHover", "selectionBackgroundColor", "heading1Size", "heading2Size", "heading3Size", "heading4Size"])
13671368
revealjsThemePatches["settings"] = createRevealjsThemePatches(["backgroundColor", "mainFont", "mainFontSize", "mainColor", "blockMargin", "headingFont", "headingColor", "headingLineHeight", "headingLetterSpacing", "headingTextTransform", "headingTextShadow", "headingFontWeight", "heading1TextShadow", "heading1Size", "heading2Size", "heading3Size", "heading4Size", "codeFont", "linkColor", "linkColorHover", "selectionBackgroundColor", "selectionColor"])
1369+
1370+
export class UpdateHTMLDependenciesCommand extends PackageCommand {
1371+
static paths = [["update-html-dependencies"]];
1372+
1373+
static usage = Command.Usage({
1374+
description: "Updates Bootstrap, themes, and JS/CSS dependencies based upon the version in configuration",
1375+
});
1376+
1377+
async execute() {
1378+
await super.execute();
1379+
await updateHtmlDependencies(this.config)
1380+
}
1381+
}

0 commit comments

Comments
 (0)