draaft
Version:
A CLI to pull content from https://pilot.pm content collaboration platform and feed your static site generator with markdown files
46 lines (45 loc) • 1.88 kB
TypeScript
import { Channel, ChannelHierarchy, DraaftConfiguration, Item } from "./types";
export declare class Terraformer {
config: DraaftConfiguration;
destFolder: string;
publicationStateIds: number[];
/**
* Terraform pilot content to SSG content
* @param config - Draaft configuration
*/
constructor(config: DraaftConfiguration, destFolder: string, publicationStateIds: number[]);
matterize(content: string, frontmatter: Object): string;
terraformChannel(channel: Channel): void;
writeChannelHierarchy(hierarchy: ChannelHierarchy, parentDirPath: string): void;
/**
* With a channel list and all items depending attached to it (on its children) build a directory of .md files
* with a proper directory structure and filename pattern according to user config
*
* @param items : List of items attached to this channel
*/
terraformItems(items: Array<Item>): Promise<void>;
terraformOneItem(item: Item): Promise<void>;
/**
* Build a filepath for content according to Hugo io local config (i18n)
*
* @param document : Draaft document returned by Api
* @param options : Extension configuration object
*/
getItemDirPath(parentFolder: string, item: Item): string;
getItemSlug(item: Item): string;
/**
* Build a filepath for content according to Hugo io local config (i18n)
*
* @param item : Draaft document returned by Api
* @param options : Extension configuration object
*/
getItemFileName(item: Item): string;
/**
* Prepare file contents before writing it
*
* @param item : Draaft item returned by Api
*/
getItemFileContent(item: any, itemDirPath: string): Promise<string>;
customiseFrontmatter(frontmatter: any, schema?: any): any;
fetchImages(markdown: string, itemDirPath: string): Promise<string>;
}