UNPKG

create-kt-plugin

Version:

A template for creating a KT plugins for ExtendScript

170 lines (119 loc) โ€ข 4.94 kB
![KT Plugin Template Banner](docs/img/banner_plugin_template.jpg) # Create KT Plugin [![npm version](https://badge.fury.io/js/create-kt-plugin.svg)](https://badge.fury.io/js/create-kt-plugin) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC) A CLI tool for creating KT (KT Framework) plugins for Adobe ExtendScript applications. This template generator creates a structured project with TypeScript support, testing capabilities, and build configurations optimized for Adobe Creative Suite applications. ## ๐Ÿš€ Quick Start Create a new KT plugin project instantly: ```bash npx create-kt-plugin ``` Or install globally: ```bash npm install -g create-kt-plugin create-kt-plugin ``` ## ๐Ÿ“‹ What You'll Get The CLI will prompt you for: - **Plugin Name**: The name of your plugin (alphanumeric and hyphens only) - **Target Program**: Choose from: - After Effects - ExtendScript (generic) - Photoshop - Premiere Pro - Illustrator - **App Version**: Automatically detects available versions for your chosen program - **Author**: Your name - **Description**: Brief description of your plugin - **Install Dependencies**: Whether to automatically install npm dependencies ## ๐Ÿ—๏ธ Project Structure The generated project includes: ``` your-plugin-name/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ index.ts # Main entry point โ”‚ โ”œโ”€โ”€ YourPlugin.ts # Main plugin class โ”‚ โ””โ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ index.test.ts # Unit tests โ”œโ”€โ”€ dist/ # Compiled output โ”œโ”€โ”€ package.json # Dependencies and scripts โ”œโ”€โ”€ tsconfig.json # TypeScript configuration โ”œโ”€โ”€ tsconfig.tests.json # TypeScript config for tests โ”œโ”€โ”€ vite.config.ts # Vite build configuration โ””โ”€โ”€ vite.es.config.ts # ExtendScript-specific build config ``` ## ๐Ÿ”ง Available Scripts The generated project comes with these npm scripts: - `npm run build` - Build the plugin for production - `npm run watch` - Build and watch for changes during development - `npm run build-tests` - Build test files - `npm run prepublishOnly` - Pre-publish build process - `npm run postpublish` - Post-publish cleanup ## ๐Ÿงช Testing The template includes a testing framework with: - **kt-testing-suite-ts**: TypeScript testing suite for KT plugins - Pre-configured test structure - Example tests for your plugin class Run tests with: ```bash npm run build-tests ``` ## ๐Ÿ› ๏ธ Technology Stack - **TypeScript**: Full TypeScript support with proper Adobe types - **Vite**: Modern build tool with fast development - **KT Core**: KT framework for plugin architecture - **types-for-adobe**: Adobe application type definitions - **Babel**: JavaScript compilation and transformation - **Rollup**: Module bundling ## ๐Ÿ“ฆ Dependencies ### Core Dependencies - `kt-core`: KT framework core functionality ### Development Dependencies - TypeScript compiler and tooling - Vite build system with plugins - Adobe types from `types-for-adobe` - Testing suite (`kt-testing-suite-core`) - Build tools (Babel, Rollup plugins) ## ๐ŸŽฏ Target Applications This template supports creating plugins for: - **After Effects**: Motion graphics and visual effects - **Photoshop**: Image editing and manipulation - **Premiere Pro**: Video editing - **Illustrator**: Vector graphics - **Generic ExtendScript**: Cross-application scripts ## ๐Ÿ” Features - **Interactive CLI**: User-friendly prompts for project setup - **TypeScript Support**: Full type safety and IntelliSense - **Hot Reload**: Development with watch mode - **Testing Framework**: Built-in testing capabilities - **Adobe Types**: Automatic inclusion of appropriate Adobe application types - **Modern Build Tools**: Vite + Rollup for optimized builds - **KT Framework Integration**: Built on the KT plugin architecture ## ๐Ÿ“– Example Usage After creating your plugin, the basic structure looks like: ```typescript // src/YourPlugin.ts export class YourPlugin { private name = "YourPlugin"; private version = "1.0.0"; constructor() { $.writeln("YourPlugin constructor"); } } // src/index.ts import { KT } from "kt-core"; import { YourPlugin } from "./YourPlugin"; KT.Module("YourPlugin", YourPlugin); export { YourPlugin }; ``` ## ๐Ÿšฆ Requirements - **Node.js**: Version 14.0.0 or higher - **npm**: For package management ## ๐Ÿค Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## ๐Ÿ“„ License This project is licensed under the ISC License. ## ๐Ÿ‘จโ€๐Ÿ’ป Author Miguel de Mendoza --- **Happy coding with KT plugins!** ๐ŸŽ‰