@@ -10,14 +10,14 @@ import { info } from "log/mod.ts";
1010import { dirname , extname , join } from "path/mod.ts" ;
1111import { lines } from "../../../src/core/text.ts" ;
1212import { runCmd } from "../util/cmd.ts" ;
13- import { Repo , withRepo } from "../util/git.ts" ;
13+ import { applyGitPatches , Repo , withRepo } from "../util/git.ts" ;
1414
1515import { download , unzip } from "../util/utils.ts" ;
1616import { Configuration } from "./config.ts" ;
1717import { visitLines } from "../../../src/core/file.ts" ;
1818import { copyMinimal } from "../../../src/core/copy.ts" ;
1919
20- export async function updateHtmlDepedencies ( config : Configuration ) {
20+ export async function updateHtmlDependencies ( config : Configuration ) {
2121 info ( "Updating Bootstrap with version info:" ) ;
2222
2323 // Read the version information from the environment
@@ -57,6 +57,18 @@ export async function updateHtmlDepedencies(config: Configuration) {
5757 "dist" ,
5858 ) ;
5959
60+ // For applying git patch to what we retreive
61+ const patchesDir = join (
62+ config . directoryInfo . pkg ,
63+ "src" , "common" , "patches"
64+ )
65+
66+ function resolvePatches ( patches : string [ ] ) {
67+ return patches . map ( patch => {
68+ return join ( patchesDir , patch )
69+ } )
70+ }
71+
6072 // Anchor
6173 const anchorJs = join ( formatDir , "anchor" , "anchor.min.js" ) ;
6274 await updateUnpkgDependency (
@@ -360,6 +372,7 @@ export async function updateHtmlDepedencies(config: Configuration) {
360372 "plugins" ,
361373 "pdfexport" ,
362374 ) ;
375+
363376 await updateGithubSourceCodeDependency (
364377 "reveal-pdfexport" ,
365378 "McShelby/reveal-pdfexport" ,
@@ -374,7 +387,10 @@ export async function updateHtmlDepedencies(config: Configuration) {
374387 return Promise . resolve ( ) ;
375388 } ,
376389 false , // not a commit
377- false , // no v prefix
390+ false , // no v prefix,
391+ resolvePatches ( [
392+ "0001-Patch-PdfExport-RevealJS-plugin-to-export-toggle-fun.patch"
393+ ] )
378394 ) ;
379395
380396 // Github CSS (used for GFM HTML preview)
@@ -492,6 +508,7 @@ export async function updateHtmlDepedencies(config: Configuration) {
492508 info (
493509 "\n** Done- please commit any files that have been updated. **\n" ,
494510 ) ;
511+
495512}
496513
497514async function updatePdfJs (
@@ -786,9 +803,10 @@ async function updateGithubSourceCodeDependency(
786803 onDownload : ( dir : string , version : string ) => Promise < void > ,
787804 commit = false , // set to true when commit is used instead of a tag
788805 vPrefix = true , // set to false if github tags don't use a v prefix
806+ patches ?: string [ ]
789807) {
790808 info ( `Updating ${ name } ...` ) ;
791- const version = Deno . env . get ( versionEnvVar ) ;
809+ const version = Deno . env . get ( versionEnvVar ) ?. trim ( ) ;
792810 if ( version ) {
793811 const fileName = `${ name } .zip` ;
794812 const distUrl = join (
@@ -805,6 +823,7 @@ async function updateGithubSourceCodeDependency(
805823 await unzip ( zipFile , working ) ;
806824
807825 await onDownload ( working , version ) ;
826+ if ( patches ) await applyGitPatches ( patches )
808827 } else {
809828 throw new Error ( `${ versionEnvVar } is not defined` ) ;
810829 }
0 commit comments