Create Acode Plugin
Overview
Acode opens up a world of possibilities with its extensibility through plugins. In this guide, you'll learn how to create plugins using JavaScript, with the added option of TypeScript. Whether you're customizing your coding experience or adding entirely new features, creating plugins for Acode is a straightforward and rewarding process.
Plugin Structure
Acode plugins follow a specific structure within a zip file. The necessary components include:
plugin.json:
- Contains crucial information about the plugin, such as its name, version, author, and more.
main.js:
- The heart of the plugin, this file contains the actual plugin code.
readme.md:
- Contains the description or about plugin
Plugin Templates
To make your journey smoother, we provide comprehensive plugin templates, which are preconfigured and catering to various use cases:
JavaScript Template official : Javascript based template for plugin development and comes preconfigured
TypeScript Template community : Typescript template for plugin development and comes with type checking and all typescript feature
Mobile Template community : Fork of official JavaScript Template with some tweaks and additional configuration to work on Termux
TIP
acode-cli : A community driven cli tool to develop acode plugins easily. Its fast and easy to use and written in rust
Getting Started
Clone the Plugin Template:
- Choose the template that suits your needs and clone it.
Customize plugin.json:
- Open the
plugin.json
file and update it with your plugin's information.
- Open the
Install the dependency:
- Install the required dependency by your package manager but first navigate to the plugin template folder by
cd acode-template
sh$ npm install
sh$ pnpm install
sh$ yarn install
sh$ bun install
- Install the required dependency by your package manager but first navigate to the plugin template folder by
Develop Locally:
- Use given commands to initiate a development server that watches for changes.
- The development server automatically creates a plugin zip file, ready for installation.
sh$ npm run start-dev
sh$ pnpm start-dev
sh$ yarn start-dev
sh$ bun run start-dev
- Or you can build every time manually on changes using :
sh$ npm run build
sh$ pnpm build
sh$ yarn build
sh$ bun run build
Install the Plugin:
- Use the REMOTE option in Acode's plugin manager.
- Provide the plugin URL (e.g.,
http://\<ip\>:3000/dist.zip
) when prompted. - Or if you are building manually then you can use the Local option in Acode's plugin manager and select the plugin zip
INFO
Development server will only build the zip on file changes but for testing in Acode, You will need to install plugin in Acode on changes to see effect
Building and Publishing
To share your plugin with the Acode community, follow these steps:
Bundle for production:
- Use
build-release
command to create a production build. which will be lower in size
sh$ npm run build-release
sh$ pnpm build-release
sh$ yarn build-release
sh$ bun run build-release
- Use
Publish:
Tutorial
Checkout a small tutorial of 👉 How to create Acode Plugins?
Tutorial for creating plugin using
acode-cli
: Here
Customization
Certainly! You have the flexibility to either utilize your own template or start your plugin from scratch. Additionally, you're free to employ alternative bundlers and tools. We'll delve deeper into these customization possibilities in subsequent sections.
Happy coding, and may your plugins bring new dimensions to your Acode experience! 🚀✨