Skip to content

Commit dda1d24

Browse files
authored
fix: initial implementation of example host application and tests (#1)
* fix: initial implementation of example host application and tests * chore: deno fmt * fix: fix gitignore * fix: fix functional test driver * fix: fix workflows * fix: update docs as windows install/run not yet working * fix: remove unused script * doc: update readme * fix: looks to be working
1 parent 385d085 commit dda1d24

19 files changed

+632
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: check-bun-dependencies
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
jobs:
10+
call-check-bun-dependencies:
11+
uses: flowscripter/.github/.github/workflows/check-bun-dependencies.yml@v1
12+
secrets: inherit

.github/workflows/lint-pr-message.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: lint-pr-message
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
permissions:
9+
contents: read
10+
jobs:
11+
call-lint-pr-message:
12+
uses: flowscripter/.github/.github/workflows/lint-pr-message.yml@v1
13+
secrets: inherit
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: release-bun-executable
2+
on:
3+
push:
4+
branches: [main]
5+
permissions:
6+
contents: write
7+
issues: write
8+
pull-requests: write
9+
id-token: write
10+
pages: write
11+
jobs:
12+
call-release-bun-executable:
13+
uses: flowscripter/.github/.github/workflows/release-bun-executable.yml@v1
14+
secrets: inherit
15+
with:
16+
executable-name: "example-host-application"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: validate-bun-executable-pr
2+
on:
3+
pull_request:
4+
branches: [main]
5+
permissions:
6+
contents: read
7+
jobs:
8+
call-validate-bun-executable-pr:
9+
uses: flowscripter/.github/.github/workflows/validate-bun-executable-pr.yml@v1
10+
secrets: inherit

.gitignore

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2+
3+
# Logs
4+
5+
logs
6+
_.log
7+
npm-debug.log_
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Caches
14+
15+
.cache
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
19+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
20+
21+
# Runtime data
22+
23+
pids
24+
_.pid
25+
_.seed
26+
*.pid.lock
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
30+
lib-cov
31+
32+
# Coverage directory used by tools like istanbul
33+
34+
coverage
35+
*.lcov
36+
37+
# nyc test coverage
38+
39+
.nyc_output
40+
41+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42+
43+
.grunt
44+
45+
# Bower dependency directory (https://bower.io/)
46+
47+
bower_components
48+
49+
# node-waf configuration
50+
51+
.lock-wscript
52+
53+
# Compiled binary addons (https://nodejs.org/api/addons.html)
54+
55+
build/Release
56+
57+
# Dependency directories
58+
59+
node_modules/
60+
jspm_packages/
61+
62+
# Snowpack dependency directory (https://snowpack.dev/)
63+
64+
web_modules/
65+
66+
# TypeScript cache
67+
68+
*.tsbuildinfo
69+
70+
# Optional npm cache directory
71+
72+
.npm
73+
74+
# Optional eslint cache
75+
76+
.eslintcache
77+
78+
# Optional stylelint cache
79+
80+
.stylelintcache
81+
82+
# Microbundle cache
83+
84+
.rpt2_cache/
85+
.rts2_cache_cjs/
86+
.rts2_cache_es/
87+
.rts2_cache_umd/
88+
89+
# Optional REPL history
90+
91+
.node_repl_history
92+
93+
# Output of 'npm pack'
94+
95+
*.tgz
96+
97+
# Yarn Integrity file
98+
99+
.yarn-integrity
100+
101+
# dotenv environment variable files
102+
103+
.env
104+
.env.development.local
105+
.env.test.local
106+
.env.production.local
107+
.env.local
108+
109+
# parcel-bundler cache (https://parceljs.org/)
110+
111+
.parcel-cache
112+
113+
# Next.js build output
114+
115+
.next
116+
out
117+
118+
# Nuxt.js build / generate output
119+
120+
.nuxt
121+
dist
122+
123+
# Gatsby files
124+
125+
# Comment in the public line in if your project uses Gatsby and not Next.js
126+
127+
# https://nextjs.org/blog/next-9-1#public-directory-support
128+
129+
# public
130+
131+
# vuepress build output
132+
133+
.vuepress/dist
134+
135+
# vuepress v2.x temp and cache directory
136+
137+
.temp
138+
139+
# Docusaurus cache and generated files
140+
141+
.docusaurus
142+
143+
# Serverless directories
144+
145+
.serverless/
146+
147+
# FuseBox cache
148+
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
153+
.dynamodb/
154+
155+
# TernJS port file
156+
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
161+
.vscode-test
162+
163+
# yarn v2
164+
165+
.yarn/cache
166+
.yarn/unplugged
167+
.yarn/build-state.yml
168+
.yarn/install-state.gz
169+
.pnp.*
170+
171+
# IntelliJ based IDEs
172+
.idea
173+
174+
# Finder (MacOS) folder config
175+
.DS_Store
176+
docs/
177+
template-bun-executable
178+
/.releaserc
179+
functional_tests/features/support/__pycache__
180+
example-host-application
181+
functional_tests/.venv

README.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,94 @@
11
# example-host-application
2-
Example host application executable for the https://github.com/flowscripter/dynamic-plugin-framework
2+
3+
[![version](https://img.shields.io/github/v/release/flowscripter/example-host-application?sort=semver)](https://github.com/flowscripter/example-host-application/releases)
4+
[![build](https://img.shields.io/github/actions/workflow/status/flowscripter/example-host-application/release-bun-executable.yml)](https://github.com/flowscripter/example-host-application/actions/workflows/release-bun-executable.yml)
5+
[![coverage](https://codecov.io/gh/flowscripter/example-host-application/branch/main/graph/badge.svg?token=EMFT2938ZF)](https://codecov.io/gh/flowscripter/example-host-application)
6+
[![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/example-host-application/index.html)
7+
[![license: MIT](https://img.shields.io/github/license/flowscripter/example-host-application)](https://github.com/flowscripter/example-host-application/blob/main/LICENSE)
8+
9+
> Example host application executable for the
10+
> [dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)
11+
12+
## Binary Executable Usage
13+
14+
**NOTE**: The binaries are 10's of megabytes in size as the entire Bun runtime
15+
is included.
16+
17+
#### MacOS
18+
19+
Via [Homebrew](https://brew.sh/):
20+
21+
`brew install flowscripter/tap/example-host-application`
22+
23+
#### Linux
24+
25+
In a terminal:
26+
27+
`curl -fsSL https://raw.githubusercontent.com/flowscripter/example-host-application/main/script/install.sh | sh`
28+
29+
#### Windows
30+
31+
Via [Winget](https://github.com/microsoft/winget-cli):
32+
33+
`winget install Flowscripter.example-host-application`
34+
35+
#### Manual Install
36+
37+
You can download and extract the binary zip files from the
38+
[releases](https://github.com/flowscripter/example-host-application/releases)
39+
page.
40+
41+
## Functional Tests
42+
43+
Refer to [functional_tests/README.md](functional_tests/README.md)
44+
45+
## Development
46+
47+
Install dependencies:
48+
49+
`bun install`
50+
51+
Test:
52+
53+
`bun test`
54+
55+
Run:
56+
57+
`bun run index.ts`
58+
59+
Compile binary:
60+
61+
`bun build index.ts --compile --outfile /tmp/example-host-application`
62+
63+
**NOTE**: The following tasks use Deno as it excels at these and Bun does not
64+
currently provide such functionality:
65+
66+
Format:
67+
68+
`deno fmt`
69+
70+
Lint:
71+
72+
`deno lint index.ts src/ tests/`
73+
74+
Generate HTML API Documentation:
75+
76+
`deno doc --html --name=example-host-application index.ts`
77+
78+
## Documentation
79+
80+
### Framework API
81+
82+
Refer to the
83+
[dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)
84+
for an overview of what this example is demonstrating.
85+
86+
### API
87+
88+
Link to auto-generated API docs:
89+
90+
[API Documentation](https://flowscripter.github.io/example-host-application/index.html)
91+
92+
## License
93+
94+
MIT © Flowscripter

bun.lock

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"lockfileVersion": 1,
3+
"workspaces": {
4+
"": {
5+
"name": "@flowscripter/example-host-application",
6+
"dependencies": {
7+
"@flowscripter/dynamic-plugin-framework": "^1.3.18",
8+
"@flowscripter/example-plugin-api": "^1.0.8",
9+
},
10+
"devDependencies": {
11+
"@types/bun": "^1.2.10",
12+
},
13+
"peerDependencies": {
14+
"typescript": "^5.8.2",
15+
},
16+
},
17+
},
18+
"packages": {
19+
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@1.3.18", "", { "peerDependencies": { "typescript": "^5.8.3" } }, "sha512-OjH8O4MWXU/Wt1so49ef6OnnHlJkHuKKya8zVLR3nkxXhHbR3jHf2VmWl+mOR6liRyN9YN5IyeCvKonnAG6jTQ=="],
20+
21+
"@flowscripter/example-plugin-api": ["@flowscripter/example-plugin-api@1.0.8", "", { "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-hRF0DRg+8aKmnAwLDQyA7phjRbET0yD9bBYdny2csL2N5JiV/KLFdfwtJSSSL/LlMdkwtl0VKAVroVc78eWAsw=="],
22+
23+
"@types/bun": ["@types/bun@1.2.10", "", { "dependencies": { "bun-types": "1.2.10" } }, "sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg=="],
24+
25+
"@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
26+
27+
"bun-types": ["bun-types@1.2.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ=="],
28+
29+
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
30+
31+
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
32+
}
33+
}

functional_tests/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Executable Functional Tests
2+
3+
#### Setup
4+
5+
Ensure the executable is built:
6+
7+
bun build ../index.ts --compile --outfile /tmp/example-host-application
8+
9+
Install requirements:
10+
11+
pip3 install -r pip-requirements.txt
12+
13+
#### Testing
14+
15+
Run the functional tests:
16+
17+
export EXECUTABLE=/tmp/example-host-application
18+
behave
19+
20+
To run with logging output from the test steps (this is the best set of
21+
arguments I can find):
22+
23+
behave --no-logcapture --no-color --logging-level=DEBUG

0 commit comments

Comments
 (0)