Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
poirazis committed Nov 22, 2022
0 parents commit 205fa60
Show file tree
Hide file tree
Showing 13 changed files with 4,471 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- master
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Make the production plugin bundle
run: |
release_version=$(cat package.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
yarn
yarn build
- name: Perform Github Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.RELEASE_VERSION }}
tag_name: v${{ env.RELEASE_VERSION }}
generate_release_notes: true
files: |
dist/*.tar.gz
106 changes: 106 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# 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/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# 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 variables file
.env
.env.test

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

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# 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

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.idea/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.github
rollup.config.js
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Bb-plugin-TabContainer
This is a readme for your new Budibase plugin.

# Description
A Tab Container Compoenent for Budibase

Find out more about [Budibase](https://github.com/Budibase/budibase).

## Instructions

To build your new plugin run the following in your Budibase CLI:
```
budi plugins --build
```

You can also re-build everytime you make a change to your plugin with the command:
```
budi plugins --watch
```

18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Wrapper from "./lib/Wrapper.svelte"
import schema from "./schema.json"
import pkg from "./package.json"

if (window) {
const plugin = { Component: Wrapper, schema, version: pkg.version }
if (!window["##BUDIBASE_CUSTOM_COMPONENTS##"]) {
window["##BUDIBASE_CUSTOM_COMPONENTS##"] = []
}
window["##BUDIBASE_CUSTOM_COMPONENTS##"].push(plugin)
if (window.registerCustomComponent) {
window.registerCustomComponent(plugin)
}
}

export const Component = Wrapper
export const version = pkg.version
export { schema }
4 changes: 4 additions & 0 deletions lib/Boundary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Boundary from "./Boundary.svelte"
import { createBoundary } from "@crownframework/svelte-error-boundary"

export default createBoundary(Boundary);
51 changes: 51 additions & 0 deletions lib/Boundary.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

<script>
import pkg from "../package.json"
import { getContext } from "svelte"
export let error = null
const { styleable } = getContext("sdk")
const component = getContext("component")
$: styles = {
normal: {},
id: $component.id,
interactive: true
}
</script>

{#if $error}
<div class="error" use:styleable={styles}>
<b>There was an error running the "{pkg.name}" plugin:</b>
<div class="detail">
{$error}
</div>
</div>
{:else}
<slot />
{/if}

<style>
.error {
background: var(--spectrum-global-color-red-400);
color: white;
border-radius: 4px;
padding: 16px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: 8px;
min-width: 400px;
}
.detail {
font-family: monospace;
font-size: 10px;
padding: 8px;
background: rgba(0, 0, 0, 0.1);
border-radius: 4px;
max-height: 100px;
overflow: auto;
}
</style>
10 changes: 10 additions & 0 deletions lib/Wrapper.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
import Component from "../src/Component.svelte"
import Boundary from "./Boundary.js"
</script>

<Boundary>
<Component {...$$props}>
<slot/>
</Component>
</Boundary>
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "bb-plugin-TabContainer",
"version": "1.0.0",
"description": "A Tab Container Compoenent for Budibase",
"license": "MIT",
"svelte": "index.js",
"module": "dist/plugin.min.js",
"scripts": {
"build": "rollup -c",
"watch": "rollup -cw"
},
"dependencies": {
"@crownframework/svelte-error-boundary": "^1.0.3",
"svelte": "^3.49.0"
},
"devDependencies": {
"@budibase/backend-core": "^2.0.13",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.10",
"rollup": "^2.44.0",
"rollup-plugin-copy2": "^0.3.1",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",
"tar": "^6.1.11"
}
}
Loading

0 comments on commit 205fa60

Please sign in to comment.