Skip to content

Commit

Permalink
chore(docs): update README for plugin SDK setup and usage
Browse files Browse the repository at this point in the history
Renamed project in README and added detailed setup instructions.
  • Loading branch information
gentlementlegen committed Nov 7, 2024
1 parent a0479e3 commit a63f464
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
bun commitlint --edit "$1"
85 changes: 35 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,55 @@
# `@ubiquity/ts-template`
# `@ubiquity-os/plugin-sdk`

This template repository includes support for the following:
This project provides a software development kit (SDK) for creating plugins using the Ubiquity OS framework. It supports the following features:

- TypeScript
- Environment Variables
- Conventional Commits
- Automatic deployment to Cloudflare Pages
- Creating a plugin instance
- Injection of the context
- Provider with a logger, an authenticated Octokit instance and the event payload

## Testing

### Cypress

To test with Cypress Studio UI, run

```shell
yarn cy:open
```
## Key Functions

Otherwise, to simply run the tests through the console, run
### `createActionsPlugin`

```shell
yarn cy:run
```
The `createActionsPlugin` function allows users to create plugins that will be able to run on GitHub Actions.

### Jest
### `createPlugin`

To start Jest tests, run
The `createPlugin` function enables users to create a plugin that will run on Cloudflare Workers environment.

```shell
yarn test
```
## Getting Started

## Sync any repository to latest `ts-template`
To set up the project locally, `bun` is the preferred package manager.

A bash function that can do this for you:
1. Install the dependencies:
```sh
bun install
```

```bash
sync-branch-to-template() {
local branch_name
branch_name=$(git rev-parse --abbrev-ref HEAD)
local original_remote
original_remote=$(git remote show | head -n 1)
2. Build the SDK
```
bun build
```
3. Link it locally to another plugin
```
bun link
```
# Add the template remote
git remote add template https://github.com/ubiquity/ts-template
## Scripts
# Fetch from the template remote
git fetch template development
The project provides several npm scripts for various tasks:
if [ "$branch_name" != "HEAD" ]; then
# Create a new branch and switch to it
git checkout -b "chore/merge-${branch_name}-template"
- `bun run build`: Compiles the TypeScript code.
- `bun run test`: Runs the tests.
- `bun run lint`: Runs the linter.
- `bun run format`: Formats the code using Prettier.
# Merge the changes from the template remote
git merge template/development --allow-unrelated-histories
## Testing
# Switch back to the original branch
git checkout "$branch_name"
### Jest
# Push the changes to the original remote
git push "$original_remote" HEAD:"$branch_name"
else
echo "You are in a detached HEAD state. Please checkout a branch first."
fi
To start Jest tests, run:
# Remove the template remote
# git remote remove template
}
```sh
bun run test
```

0 comments on commit a63f464

Please sign in to comment.