tdl Extension Template
Introduction
This template provides instructions on how to use the tdl extension template.
The template helps you create, build, and publish extensions for the tdl.
[!WARNING]
tdl Extensions are in the beta stage. The API may change in the future.
Prerequisites
Go programming language installed (version 1.21 or higher)
Git installed
tdl command-line tool installed
Getting Started
-
Create a New Repository
Click on the "Use this template" button to create a new repository based on this template.
[!IMPORTANT]
GitHub repository name should be in the format tdl-<extension-name>
[!TIP]
Add tdl-extension topic to the repository for better discoverability.
-
Clone the Repository
Clone the template repository to your local machine:
git clone https://github.com/<username>/<repository>.git
cd <repository>
-
Update the go.mod File
Update the go.mod file with the correct module name:
module github.com/<username>/<repository>
-
Install Dependencies
Navigate to the project directory and install the required dependencies:
go mod tidy
Develop
To develop the extension more effectively, consider using tdl/core, a Go library that exposes core functionality of tdl for use with less third-party dependencies.
Run the following command to install the library:
go get -u github.com/iyear/tdl/core
Build
To build the extension, run the following command:
go build
This will create an executable in the project directory.
Test
To test the extension, run the following commands:
tdl extension install --force ./tdl-extension
tdl <global-config-flags> <extension-name> <extension-flags>
This will install the extension in the tdl extension directory as local extension.
Publish
To publish your extension, follow these steps:
-
Create a New Tag
Create a new semver tag and push it to the repository:
git tag v0.1.0
git push origin v0.1.0
-
Wait for the GitHub Action to Complete
The GitHub Action release will build and publish the extension to a new release.
-
Edit the draft release
Edit the draft release and publish it.