Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/check-bun-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: check-bun-dependencies
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
call-check-bun-dependencies:
uses: flowscripter/.github/.github/workflows/check-bun-dependencies.yml@v1
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/lint-pr-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: lint-pr-message
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
call-lint-pr-message:
uses: flowscripter/.github/.github/workflows/lint-pr-message.yml@v1
secrets: inherit
8 changes: 8 additions & 0 deletions .github/workflows/release-bun-library.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: release-bun-library
on:
push:
branches: [main]
jobs:
call-release-bun-library:
uses: flowscripter/.github/.github/workflows/release-bun-library.yml@v1
secrets: inherit
8 changes: 8 additions & 0 deletions .github/workflows/validate-bun-library-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: validate-bun-library-pr
on:
pull_request:
branches: [main]
jobs:
call-validate-bun-library-pr:
uses: flowscripter/.github/.github/workflows/validate-bun-library-pr.yml@v1
secrets: inherit
177 changes: 177 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

# Logs

logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Caches

.cache

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
docs/
/.releaserc
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,65 @@
# example-plugin
Example plugin for the (https://github.com/flowscripter/dynamic-plugin-framework

[![version](https://img.shields.io/github/v/release/flowscripter/example-plugin?sort=semver)](https://github.com/flowscripter/example-plugin/releases)
[![build](https://img.shields.io/github/actions/workflow/status/flowscripter/example-plugin/release-bun-library.yml)](https://github.com/flowscripter/example-plugin/actions/workflows/release-bun-library.yml)
[![coverage](https://codecov.io/gh/flowscripter/example-plugin/branch/main/graph/badge.svg?token=EMFT2938ZF)](https://codecov.io/gh/flowscripter/example-plugin)
[![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/example-plugin/index.html)
[![license: MIT](https://img.shields.io/github/license/flowscripter/example-plugin)](https://github.com/flowscripter/example-plugin/blob/main/LICENSE)

> Example plugin for the
> [dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)

## Bun Module Usage

Add the module:

`bun add @flowscripter/example-plugin`

Use the module:

```typescript
import { ExampleExtension } from "@flowscripter/example-plugin";

const extension = new ExampleExtension();

extension.sayHello();
```

## Development

Test:

`bun test`

**NOTE**: The following tasks use Deno as it excels at these and Bun does not
currently provide such functionality:

Format:

`deno fmt`

Lint:

`deno lint index.ts src/ tests/`

Generate HTML API Documentation:

`deno doc --html --name=example-plugin index.ts`

## Documentation

### Overview

Refer to the
[dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)
for an overview of what this example is demonstrating.

### API

Link to auto-generated API docs for the library:

[API Documentation](https://flowscripter.github.io/example-plugin/index.html)

## License

MIT © Flowscripter
35 changes: 35 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "@flowscripter/example-plugin",
"dependencies": {
"@flowscripter/dynamic-plugin-framework": "^1.3.8",
"@flowscripter/example-plugin-api": "^1.0.0",
},
"devDependencies": {
"@types/bun": "^1.2.4",
},
"peerDependencies": {
"typescript": "^5.8.2",
},
},
},
"packages": {
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@1.3.8", "", { "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-/XEYnDORtgazu/7lOcqhwbnwyyErzs3p3aMfzRXFDtJNi+uBwNdJDVw81huHOqaf+UDoUPFu3L6SwSZv6LXFMg=="],

"@flowscripter/example-plugin-api": ["@flowscripter/example-plugin-api@1.0.0", "", { "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-6IND3SxnkIKspmmRUQqe3lITS+tQNNa7gKEkROSu1G1FYae8Gi5AnLDUOx1+JwhcHha+607az+ciXZ35Q/gNtw=="],

"@types/bun": ["@types/bun@1.2.4", "", { "dependencies": { "bun-types": "1.2.4" } }, "sha512-QtuV5OMR8/rdKJs213iwXDpfVvnskPXY/S0ZiFbsTjQZycuqPbMW8Gf/XhLfwE5njW8sxI2WjISURXPlHypMFA=="],

"@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],

"@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],

"bun-types": ["bun-types@1.2.4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="],

"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],

"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
}
}
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default, exampleExtension } from "./src/ExamplePlugin.ts";
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@flowscripter/example-plugin",
"module": "index.ts",
"type": "module",
"version": "0.0.0",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@types/bun": "^1.2.4"
},
"peerDependencies": {
"typescript": "^5.8.2"
},
"dependencies": {
"@flowscripter/dynamic-plugin-framework": "^1.3.8",
"@flowscripter/example-plugin-api": "^1.0.0"
}
}
42 changes: 42 additions & 0 deletions src/ExamplePlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
EXTENSION_POINT_1,
type ExtensionPoint1,
} from "@flowscripter/example-plugin-api";
import type {
ExtensionDescriptor,
ExtensionFactory,
Plugin,
} from "@flowscripter/dynamic-plugin-framework";

export const exampleExtension: ExtensionPoint1 = {
sayHello: () => {
console.info("hello world");
},
};

const exampleExtensionFactory: ExtensionFactory = {
create: () => {
return Promise.resolve(exampleExtension);
},
};

const exampleExtensionDescriptor: ExtensionDescriptor = {
extensionPoint: EXTENSION_POINT_1,

factory: exampleExtensionFactory,

extensionData: new Map<string, string>([[
"extension_foo",
"extension_bar",
]]),
};

const examplePlugin: Plugin = {
extensionDescriptors: [
exampleExtensionDescriptor,
],

pluginData: new Map<string, string>([["plugin_foo", "plugin_bar"]]),
};

export default examplePlugin;
Loading
Loading