diff --git a/packages/cli/src/template/plugin/build/ts/build:contents/template.txt b/packages/cli/src/template/plugin/build/ts/build:contents/template.txt index 3cc49a4..af8729e 100644 --- a/packages/cli/src/template/plugin/build/ts/build:contents/template.txt +++ b/packages/cli/src/template/plugin/build/ts/build:contents/template.txt @@ -2,27 +2,43 @@ // Build contents plugin template // -------------------------------------------------------------- // -import { Builder, Plugin } from '@obsidian_blogger/build_system' +import { Plugin } from '@obsidian_blogger/build_system' -export interface {{plugin_name}}Options { - option1: string - option2: string +export type {{plugin_name}}StaticConfig = Plugin.BuildContentsPluginStaticConfig & { + static1: string + static2: string } -export class {{plugin_name}}Plugin extends Plugin.BuildContentsPlugin { - public constructor(private readonly options: {{plugin_name}}Options) { - super() - } - - public getConfig(): Plugin.BuildContentsPluginConfig { +export type {{plugin_name}}DynamicConfig = Plugin.BuildContentsDynamicConfig & { + dynamicProperty?: string +} +export class {{plugin_name}}Plugin extends Plugin.BuildContentsPlugin< + {{plugin_name}}StaticConfig, + {{plugin_name}}DynamicConfig +> { + public defineStaticConfig(): {{plugin_name}}StaticConfig { return { name: '{{plugin_name}}', - disableCache: false, + description: '{{plugin_name}} plugin description', + // If you want to add a user-input based configuration, you can define it here + dynamicConfigSchema: { + dynamicProperty: { + type: 'string', + description: 'dynamic1 description', + defaultValue: 'default value for dynamic1', + optional: true, + }, + }, + // user-defined static configuration + static1: 'static1', + static2: 'static2', } } - - public async buildContents(context: { - buildStore: Builder.BuildStoreList - }): Promise> { + public async buildContents({ + buildStore, + }: Parameters[0]): Promise< + Array<{ newContent: string; writePath: string }> + > { + // Implement the buildContents logic here return [] } -} \ No newline at end of file +} diff --git a/packages/cli/src/template/plugin/build/ts/build:tree/template.txt b/packages/cli/src/template/plugin/build/ts/build:tree/template.txt index affcc6b..6c8b3c8 100644 --- a/packages/cli/src/template/plugin/build/ts/build:tree/template.txt +++ b/packages/cli/src/template/plugin/build/ts/build:tree/template.txt @@ -2,31 +2,42 @@ // Build tree plugin template // -------------------------------------------------------------- // -import { Node, Plugin } from '@obsidian_blogger/build_system' +import { Plugin } from '@obsidian_blogger/build_system' -export interface {{plugin_name}}Options { - option1: string - option2: string +export type {{plugin_name}}StaticConfig = Plugin.BuildTreePluginStaticConfig & { + static1: string + static2: string } -export class {{plugin_name}}Plugin extends Plugin.BuildTreePlugin { - public constructor(private readonly options: {{plugin_name}}Options) { - super() - } - - public getConfig(): Plugin.BuildTreePluginConfig { +export type {{plugin_name}}DynamicConfig = Plugin.BuildTreePluginDynamicConfig & { + dynamicProperty?: string +} +export class {{plugin_name}}Plugin extends Plugin.BuildTreePlugin< + {{plugin_name}}StaticConfig, + {{plugin_name}}DynamicConfig +> { + public defineStaticConfig(): {{plugin_name}}StaticConfig { return { name: '{{plugin_name}}', - disableCache: false, - exclude: [], - skipFolderNode: true, + description: '{{plugin_name}} plugin description', + // If you want to add a user-input based configuration, you can define it here + dynamicConfigSchema: { + dynamicProperty: { + type: 'string', + description: 'dynamic1 description', + defaultValue: 'default value for dynamic1', + optional: true, + }, + }, + // user-defined static configuration + static1: 'static1', + static2: 'static2', } } public async walk( - node: Node.FTreeNode, - i: number, - peerNodes: Array + node: Parameters[0], + context: Parameters[1] ): Promise { - return + // Implement the build logic here } } diff --git a/packages/cli/src/template/plugin/build/ts/walk:tree/template.txt b/packages/cli/src/template/plugin/build/ts/walk:tree/template.txt index f356bdf..44585ad 100644 --- a/packages/cli/src/template/plugin/build/ts/walk:tree/template.txt +++ b/packages/cli/src/template/plugin/build/ts/walk:tree/template.txt @@ -2,31 +2,42 @@ // Walk tree plugin template // -------------------------------------------------------------- // -import { Node, Plugin } from '@obsidian_blogger/build_system' +import { Plugin } from "@obsidian_blogger/build_system"; -export interface {{plugin_name}}Options { - option1: string - option2: string -} -export class {{plugin_name}}Plugin extends Plugin.BuildTreePlugin { - public constructor(private readonly options: {{plugin_name}}Options) { - super() - } - - public getConfig(): Plugin.BuildTreePluginConfig { - return { - name: '{{plugin_name}}', - disableCache: false, - exclude: [], - skipFolderNode: true, - } - } +export type {{plugin_name}}StaticConfig = Plugin.WalkTreePluginStaticConfig & { + static1: string; + static2: string; +}; +export type {{plugin_name}}DynamicConfig = Plugin.WalkTreePluginDynamicConfig & { + dynamicProperty?: string; +}; +export class {{plugin_name}}Plugin extends Plugin.WalkTreePlugin< + {{plugin_name}}StaticConfig, + {{plugin_name}}DynamicConfig +> { + public defineStaticConfig(): {{plugin_name}}StaticConfig { + return { + name: "{{plugin_name}}", + description: "{{plugin_name}} plugin description", + // If you want to add a user-input based configuration, you can define it here + dynamicConfigSchema: { + dynamicProperty: { + type: "string", + description: "dynamic1 description", + defaultValue: "default value for dynamic1", + optional: true, + }, + }, + // user-defined static configuration + static1: "static1", + static2: "static2", + }; + } - public async walk( - node: Node.FTreeNode, - i: number, - peerNodes: Array - ): Promise { - return - } + public async walk( + node: Parameters[0], + context: Parameters[1] + ): Promise { + // Implement the walk logic here + } }