Skip to content

Commit 4446be2

Browse files
committed
first commit
0 parents  commit 4446be2

File tree

15 files changed

+4085
-0
lines changed

15 files changed

+4085
-0
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: 16
17+
- name: Make the production plugin bundle
18+
run: |
19+
release_version=$(cat package.json | jq -r '.version')
20+
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
21+
yarn
22+
yarn build
23+
- name: Perform Github Release
24+
uses: softprops/action-gh-release@v1
25+
with:
26+
name: v${{ env.RELEASE_VERSION }}
27+
tag_name: v${{ env.RELEASE_VERSION }}
28+
generate_release_notes: true
29+
files: |
30+
dist/*.tar.gz

.gitignore

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
.idea/

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.github
3+
rollup.config.js

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Bb-code-block
2+
This is a readme for your new Budibase plugin.
3+
4+
# Description
5+
Display your code in budibase no matter what language your code is written in.
6+
7+
Find out more about [Budibase](https://github.com/Budibase/budibase).
8+
9+
## Instructions
10+
11+
To build your new plugin run the following in your Budibase CLI:
12+
```
13+
budi plugins --build
14+
```
15+
16+
You can also re-build everytime you make a change to your plugin with the command:
17+
```
18+
budi plugins --watch
19+
```
20+

docker-compose.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "3"
2+
services:
3+
budibase:
4+
restart: unless-stopped
5+
image: budibase/budibase:latest
6+
ports:
7+
- 10001:80
8+
environment:
9+
JWT_SECRET: z6BbHt3Ert3IkA8R7DTSNNbCAIAMo1Jt
10+
MINIO_ACCESS_KEY: E9fNaujFlfIABZbuZ8blz5PfAgr9ATUf
11+
MINIO_SECRET_KEY: ZnKO5ZV5wt4gmaRuz5vKlUj1RPkRzCVY
12+
REDIS_PASSWORD: PsQUVKue346tQhlGvZE7LyzOxAFfKcAf
13+
INTERNAL_API_KEY: WOgjBGLfzDtJDNnIv57cXEhcGhJHfkhR
14+
COUCHDB_USER: admin
15+
COUCHDB_PASSWORD: QMplPoFC2c9P8HP3II7OOm0Ki6wmkJpO
16+
PLUGINS_DIR: /plugins
17+
BB_ADMIN_USER_EMAIL: [email protected]
18+
BB_ADMIN_USER_PASSWORD: neb6fn
19+
volumes:
20+
- budibase_data:/data
21+
- /Users/yahavrosner/Documents/budibase-instance/plugins/bb-code-block:/plugins
22+
volumes:
23+
budibase_data:
24+
driver: local

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Wrapper from "./lib/Wrapper.svelte"
2+
import schema from "./schema.json"
3+
import pkg from "./package.json"
4+
5+
if (window) {
6+
const plugin = { Component: Wrapper, schema, version: pkg.version }
7+
if (!window["##BUDIBASE_CUSTOM_COMPONENTS##"]) {
8+
window["##BUDIBASE_CUSTOM_COMPONENTS##"] = []
9+
}
10+
window["##BUDIBASE_CUSTOM_COMPONENTS##"].push(plugin)
11+
if (window.registerCustomComponent) {
12+
window.registerCustomComponent(plugin)
13+
}
14+
}
15+
16+
export const Component = Wrapper
17+
export const version = pkg.version
18+
export { schema }

lib/Boundary.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Boundary from "./Boundary.svelte"
2+
import { createBoundary } from "@crownframework/svelte-error-boundary"
3+
4+
export default createBoundary(Boundary);

lib/Boundary.svelte

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
<script>
3+
import pkg from "../package.json"
4+
import { getContext } from "svelte"
5+
6+
export let error = null
7+
8+
const { styleable } = getContext("sdk")
9+
const component = getContext("component")
10+
11+
$: styles = {
12+
normal: {},
13+
id: $component.id,
14+
interactive: true
15+
}
16+
</script>
17+
18+
{#if $error}
19+
<div class="error" use:styleable={styles}>
20+
<b>There was an error running the "{pkg.name}" plugin:</b>
21+
<div class="detail">
22+
{$error}
23+
</div>
24+
</div>
25+
{:else}
26+
<slot />
27+
{/if}
28+
29+
<style>
30+
.error {
31+
background: var(--spectrum-global-color-red-400);
32+
color: white;
33+
border-radius: 4px;
34+
padding: 16px;
35+
display: flex;
36+
flex-direction: column;
37+
justify-content: flex-start;
38+
align-items: stretch;
39+
gap: 8px;
40+
min-width: 400px;
41+
}
42+
.detail {
43+
font-family: monospace;
44+
font-size: 10px;
45+
padding: 8px;
46+
background: rgba(0, 0, 0, 0.1);
47+
border-radius: 4px;
48+
max-height: 100px;
49+
overflow: auto;
50+
}
51+
</style>

lib/Wrapper.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script>
2+
import Component from "../src/Component.svelte"
3+
import Boundary from "./Boundary.js"
4+
</script>
5+
6+
<Boundary>
7+
<Component {...$$props}>
8+
<slot/>
9+
</Component>
10+
</Boundary>

package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "bb-code-block",
3+
"version": "1.0.0",
4+
"description": "Display your code in budibase no matter what language your code is written in.",
5+
"license": "MIT",
6+
"svelte": "index.js",
7+
"module": "dist/plugin.min.js",
8+
"author": "Yahav Rosner",
9+
"scripts": {
10+
"build": "rollup -c",
11+
"watch": "rollup -cw"
12+
},
13+
"dependencies": {
14+
"@crownframework/svelte-error-boundary": "^1.0.3",
15+
"highlight.js": "^11.6.0",
16+
"svelte": "^3.49.0",
17+
"svelte-highlight": "^6.2.1"
18+
},
19+
"devDependencies": {
20+
"@rollup/plugin-commonjs": "^18.0.0",
21+
"@rollup/plugin-node-resolve": "^11.2.1",
22+
"npm-run-all": "^4.1.5",
23+
"postcss": "^8.2.10",
24+
"rollup": "^2.44.0",
25+
"rollup-plugin-copy2": "^0.3.1",
26+
"rollup-plugin-json": "^4.0.0",
27+
"rollup-plugin-polyfill-node": "^0.8.0",
28+
"rollup-plugin-postcss": "^4.0.0",
29+
"rollup-plugin-svelte": "^7.1.0",
30+
"rollup-plugin-svg": "^2.0.0",
31+
"rollup-plugin-terser": "^7.0.2",
32+
"tar": "^6.1.11"
33+
}
34+
}

0 commit comments

Comments
 (0)