packages/plugin-api/DEVELOPMENT.md
npm install @super-productivity/plugin-api
Create a tsconfig.json in your plugin project:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020", "DOM"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
my-plugin/
├── src/
│ └── plugin.ts
├── dist/
│ └── plugin.js
├── manifest.json
├── index.html (optional)
├── icon.svg (optional)
├── package.json
└── tsconfig.json
Add to your package.json:
{
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch",
"dev": "tsc --watch"
},
"devDependencies": {
"@super-productivity/plugin-api": "^1.0.0",
"typescript": "^5.0.0"
}
}
See example/my-plugin.ts for a complete TypeScript plugin example.
When adding new features to the plugin system:
src/types.ts with new interfaces/typessrc/index.ts to export new typesREADME.md with usage examplesThe main Super Productivity project should eventually import types from this package instead of maintaining local definitions:
// Before:
import { PluginManifest } from './plugin-api.model';
// After:
import type { PluginManifest } from '@super-productivity/plugin-api';
npm run buildnpm link in this directorynpm link @super-productivity/plugin-apinpm version patch|minor|majornpm run buildnpm pack --dry-runnpm publish --access publicPluginAPI - Main API interfacePluginManifest - Plugin configurationPluginBaseCfg - Runtime configurationPluginHooks - Available hook eventsPluginHookHandler - Hook function signatureTaskData - Task informationProjectData - Project informationTagData - Tag informationPluginCreateTaskData - Task creation dataDialogCfg - Dialog configurationDialogButtonCfg - Dialog button configurationSnackCfg - Notification configurationNotifyCfg - System notification configurationPluginMenuEntryCfg - Menu entry configurationPluginShortcutCfg - Keyboard shortcut configurationPluginHeaderBtnCfg - Header button configuration