-
Notifications
You must be signed in to change notification settings - Fork 3
Plugin packages #11
Comments
Database extensionsAny module in a plugin package's import { Database, DatabaseConfig } from 'tusken'
const DEFAULT_FOO = 1
export default class extends Database {
// Instance properties
private _foo: number
// Read and manipulate the config and/or initialize properties
constructor(config: DatabaseConfig & { foo?: number }) {
super(config)
this._foo = config.foo ?? DEFAULT_FOO
}
// Define new methods
foo() {...}
} Similar runtime extensions will be supported as well. Like → Compiled extension When the runtime extension above is compiled by import * as tusken from 'tusken'
export interface DatabaseConfig extends tusken.DatabaseConfig {
foo?: number
}
const DEFAULT_FOO = 1
class Database extends tusken.Database {
private _foo: number
constructor(config: DatabaseConfig) {
super(config)
this._foo = config.foo ?? DEFAULT_FOO
}
foo() {...}
}
export default new Database({
/* generated options go here */
}) The generated |
Partial pluginsIn your Tusken config, you can specify which extensions of a plugin you wish to use: export default defineConfig({
include: [
// The default if a plugin isn't specified, but required if the package name
// doesn't include "tusken-plugin-" or similar
'tusken-plugin-admin/*',
// Use only the "map" extension from the tusken-plugin-array package.
'tusken-plugin-array/map',
}) The Probably also want support for shorthand objects: { 'tusken-plugin-array': ['map', 'forEach'] }, And we should probably just omit the 'array/*',
'array/map',
{ array: ['map', 'filter'] }, |
node_modules
are loaded automaticallytusken
instead ofbabel
db
,pg
, andt
objectstusken.config.js
tusken apply
brings up a multi-select prompt of unapplied plugins?The text was updated successfully, but these errors were encountered: