-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
36 lines (31 loc) · 969 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* eslint-disable @typescript-eslint/no-unused-vars */
import {
PluginInitParams,
PluginInitReturn,
} from "@/creatorSettings/creatorSettings.type";
import { IPluginOptions, OutAnswers } from "./interfaces";
import inquirer from "inquirer";
import { questions } from "./questions";
import { StyleLibrary } from "@/features/reactJS/interfaces";
export { questions } from "./questions";
export { defaultSettings } from "./interfaces";
export const pluginName = "chakraUI";
export async function initPlugin({
options,
globalOptions,
answersUntilNow,
}: PluginInitParams<IPluginOptions, OutAnswers>): Promise<
PluginInitReturn<IPluginOptions>
> {
const answers = (await inquirer.prompt(questions, {
...options,
answersUntilNow,
})) as Required<IPluginOptions>;
// we need this for handlebars template
answers.enabled =
answers.answersUntilNow?.reactJS?.answers.styleLibrary ===
StyleLibrary.ChakraUI;
return {
answers,
};
}