@frontmatter/extensibility
Advanced tools
@@ -9,2 +9,19 @@ import { MediaArguments } from "../models/ScriptArguments.js"; | ||
| static getArguments(): MediaArguments | undefined; | ||
| /** | ||
| * Copies the metadata from the source file to the destination file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| static copyMetadata(sourcePath: string, destinationPath: string): void; | ||
| /** | ||
| * Copies the metadata from the source file to the destination file and deletes the source file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| static copyMetadataAndDelete(sourcePath: string, destinationPath: string): void; | ||
| /** | ||
| * Deletes a media file. | ||
| * @param filePath - The path of the file to be deleted. | ||
| */ | ||
| static delete(filePath: string): void; | ||
| } |
@@ -31,3 +31,37 @@ import { CustomScript } from "./CustomScript.js"; | ||
| } | ||
| /** | ||
| * Copies the metadata from the source file to the destination file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| static copyMetadata(sourcePath, destinationPath) { | ||
| console.log(JSON.stringify({ | ||
| fmAction: "copyMediaMetadata", | ||
| fmSourcePath: sourcePath, | ||
| fmDestinationPath: destinationPath, | ||
| })); | ||
| } | ||
| /** | ||
| * Copies the metadata from the source file to the destination file and deletes the source file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| static copyMetadataAndDelete(sourcePath, destinationPath) { | ||
| console.log(JSON.stringify({ | ||
| fmAction: "copyMediaMetadataAndDelete", | ||
| fmSourcePath: sourcePath, | ||
| fmDestinationPath: destinationPath, | ||
| })); | ||
| } | ||
| /** | ||
| * Deletes a media file. | ||
| * @param filePath - The path of the file to be deleted. | ||
| */ | ||
| static delete(filePath) { | ||
| console.log(JSON.stringify({ | ||
| fmAction: "deleteMedia", | ||
| fmPath: filePath, | ||
| })); | ||
| } | ||
| } | ||
| //# sourceMappingURL=MediaScript.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"MediaScript.js","sourceRoot":"","sources":["../../src/scripts/MediaScript.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,YAAY;IAC3C;;;OAGG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;YAC7B,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAE1B,wCAAwC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACjB,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAA+B,CAAC,CAAC;QAEpC,OAAO;YACL,OAAO;YACP,UAAU;YACV,aAAa;YACb,SAAS;YACT,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SAC/D,CAAC;IACJ,CAAC;CACF"} | ||
| {"version":3,"file":"MediaScript.js","sourceRoot":"","sources":["../../src/scripts/MediaScript.ts"],"names":[],"mappings":"AACA,OA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iBAAiB,EAAE,eAAe;SACnC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,qBAAqB,CACjC,UAAkB,EAClB,eAAuB;QAEvB,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,EAAE,4BAA4B;YACtC,YAAY,EAAE,UAAU;YACxB,iBAAiB,EAAE,eAAe;SACnC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,QAAgB;QACnC,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,QAAQ;SACjB,CAAC,CACH,CAAC;IACJ,CAAC;CACF"} |
+1
-1
| { | ||
| "name": "@frontmatter/extensibility", | ||
| "version": "0.0.15", | ||
| "version": "0.0.16", | ||
| "description": "Front Matter CMS extensibility library", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+6
-0
@@ -106,2 +106,8 @@ <p align="center"> | ||
| Additionally, they provide the following methods: | ||
| - `MediaScript.copyMetadata(source, destination)`: This method will copy the metadata from the source file to the destination file. | ||
| - `MediaScript.copyMetadataAndDelete(source, destination)`; This method will copy the metadata from the source file to the destination file and delete the source file. | ||
| - `MediaScript.delete(source)`: This method will delete the source file. | ||
| ### Placeholder scripts | ||
@@ -108,0 +114,0 @@ |
@@ -37,2 +37,51 @@ import { MediaArguments } from "../models/ScriptArguments.js"; | ||
| } | ||
| /** | ||
| * Copies the metadata from the source file to the destination file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| public static copyMetadata( | ||
| sourcePath: string, | ||
| destinationPath: string | ||
| ): void { | ||
| console.log( | ||
| JSON.stringify({ | ||
| fmAction: "copyMediaMetadata", | ||
| fmSourcePath: sourcePath, | ||
| fmDestinationPath: destinationPath, | ||
| }) | ||
| ); | ||
| } | ||
| /** | ||
| * Copies the metadata from the source file to the destination file and deletes the source file. | ||
| * @param sourcePath - The path of the source file. | ||
| * @param destinationPath - The path of the destination file. | ||
| */ | ||
| public static copyMetadataAndDelete( | ||
| sourcePath: string, | ||
| destinationPath: string | ||
| ): void { | ||
| console.log( | ||
| JSON.stringify({ | ||
| fmAction: "copyMediaMetadataAndDelete", | ||
| fmSourcePath: sourcePath, | ||
| fmDestinationPath: destinationPath, | ||
| }) | ||
| ); | ||
| } | ||
| /** | ||
| * Deletes a media file. | ||
| * @param filePath - The path of the file to be deleted. | ||
| */ | ||
| public static delete(filePath: string): void { | ||
| console.log( | ||
| JSON.stringify({ | ||
| fmAction: "deleteMedia", | ||
| fmPath: filePath, | ||
| }) | ||
| ); | ||
| } | ||
| } |
44634
10.43%853
12.83%358
1.7%