Skip to content

Commit 90553d1

Browse files
committed
starting docs
1 parent 896ace1 commit 90553d1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/sv/lib/core/addon/config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@ export type Addon<Args extends OptionDefinition> = {
3333
options: Args;
3434
setup?: (
3535
workspace: Workspace & {
36+
/** On what official addons does this addon depend on? */
3637
dependsOn: (name: string) => void;
38+
39+
/** Why is this addon not supported?
40+
*
41+
* @example
42+
* if (!kit) unsupported('Requires SvelteKit');
43+
*/
3744
unsupported: (reason: string) => void;
45+
46+
/** On what official addons does this addon run after? */
3847
runsAfter: (addonName: string) => void;
3948
}
4049
) => MaybePromise<void>;
@@ -103,6 +112,18 @@ export type OptionBuilder<T extends OptionDefinition> = {
103112
};
104113

105114
// Initializing with an empty object is intended given that the starting state _is_ empty.
115+
/**
116+
* Example:
117+
* ```ts
118+
* const options = defineAddonOptions()
119+
* .add('demo', {
120+
* question: `Do you want to include a demo? ${style.optional('(includes a login/register page)')}`
121+
* type: 'boolean' | 'string' | 'number' | 'select' | 'multiselect' | 'boolean',
122+
* default: true,
123+
* })
124+
* .build();
125+
* ```
126+
*/
106127
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
107128
export function defineAddonOptions(): OptionBuilder<{}> {
108129
return createOptionBuilder({});

0 commit comments

Comments
 (0)