Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
Hexagon/pup-plugin# @pup/plugin
Purpose:
The cornerstone for developing custom Pup plugins. Full documentation on creating plugins are available at https://pup.56k.guru/examples/plugins/readme/
Usage
Install the @pup/plugin
and @pup/api-client
packages within your plugin
project:
deno add @pup/plugin @pup/api-client
Then, extend the provided base classes and implement the necessary interfaces to define your plugin's specific functionality.
Minimal example:
import { PupPluginImplementation } from "@pup/plugin"; import { PupRestClient } from "@pup/api-client"; export class PupPlugin extends PupPluginImplementation { private client: PupRestClient; constructor( config: PupPluginConfiguration, apiUrl: string, apiToken: string, ) { super(config, apiUrl, apiToken); // Setup the Pup rest client using the automatically supplied credentials this.client = new PupRestClient(apiUrl, apiToken); // Plugin identification metadata this.meta = { name: "My Custom Plugin", version: "1.0.0", api: "1.0.0", // The used version of @pup/plugin - for compatibility check repository: "https://github.com/my-user-or-org/my-pup-plugin", }; } // Example usage of PupRestClient within your plugin: async fetchProcessData(): Promise<ApiProcessData[]> { const response = await this.client.getProcesses(); if (response.status === 200) { return response.data; } else { throw new Error(`Failed to fetch process data: ${response.status}`); } } // ... other plugin logic here }
License
This package is released under the MIT License. See LICENSE for details.
Built and signed on
GitHub Actions
Add Package
deno add jsr:@pup/plugin
Import symbol
import * as plugin from "@pup/plugin";
Import directly with a jsr specifier
import * as plugin from "jsr:@pup/plugin";
Add Package
pnpm i jsr:@pup/plugin
pnpm dlx jsr add @pup/plugin
Import symbol
import * as plugin from "@pup/plugin";
Add Package
yarn add jsr:@pup/plugin
yarn dlx jsr add @pup/plugin
Import symbol
import * as plugin from "@pup/plugin";
Add Package
vlt install jsr:@pup/plugin
Import symbol
import * as plugin from "@pup/plugin";
Add Package
npx jsr add @pup/plugin
Import symbol
import * as plugin from "@pup/plugin";
Add Package
bunx jsr add @pup/plugin
Import symbol
import * as plugin from "@pup/plugin";