budibase
budibase copied to clipboard
Budibase CLI - Create Plugin/Component
Specs: https://budibase.atlassian.net/wiki/spaces/PROD/pages/45940739/Custom+Datasources, https://budibase.atlassian.net/wiki/spaces/PROD/pages/46792705/Custom+Components
When I'm using the budibase CLI, I want to be able to generate a new skeleton of a component or datasource in the directory I am currently in.
Commands:
-
budi plugin init --component/datasource funky-component
The CLI will check if you are currently in the directory of a plugin/component (look for package.json) and if not error.
COS
-
budi plugin --init
- creates a new plugin skeleton in the current directory. -
budi component --init
- creates a new component skeleton in the current directory. - Define the NPM build script in the skeleton
- Allow definition of budibase version on skeleton creation
Some notes around plugin creation: GOALS
- Single file that exports the functionality and the schema - plugin.js/main.js
- Skeleton comes with schema.json which default exports schema for datasource/component
- Single JS file for datasources/components with schema etc in it (built and minified) but we include the package.json and schema.json + the js file in a tarball (support prebuilds down the line)
- Skeleton has both TS and JS base impls - CLI asks which one user wants, deletes the other file - build needs to account for this
- There is a specific datasource.js/ts and component.svelte
- Build step should be the same for both datasources and components, this is needed for datasources to handle Typescript and to make sure that the node_modules get included correctly. Rollup initially, Esbuild down the line perhaps
- CJS bundle for datasources, IIFE for components - build can run this based on the schema.json
- We handle the importing of tarballs and the usage of it for datasources and components
- Verify, a post build step - built in, this isn't a separate CLI command, its just part of the build, use JOI to verify the schema.
- Enrichment feature, Typescript in svelte, typecast the stuff gotten from context
- Should we include BBUI - is there a good case for using BBUI components inside a custom component, should components not be granular and add BBUI components to a block inside Budibase