Skip to content

Commit 1464c6a

Browse files
committed
refactor(questions): minor refactor
1 parent bc05c97 commit 1464c6a

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ export async function runGenerator(args: IArgs, data: Data = {}) {
2929
process.stdout.write('\n');
3030

3131
if (directory) {
32-
config.path = path.resolve(process.cwd(), directory);
32+
config.update({
33+
path: path.resolve(process.cwd(), directory),
34+
});
3335
}
3436

3537
if (wrap != null) {
36-
config.wrapFolder = wrap;
38+
config.update({ wrapFolder: wrap });
3739
}
3840

3941
switch (type) {

src/questions/questionTypes.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ export function getComponentQuestions() {
1818
mods.push('propTypes');
1919
}
2020

21-
const questionList = [
22-
questions.name('Component'),
23-
questions.test(),
24-
questions.barrel(),
25-
questions.hooks(reactHooks),
26-
];
21+
const questionList = [];
22+
23+
questionList.push(questions.name('Component'));
24+
25+
questionList.push(questions.test());
26+
27+
if (config.wrapFolder) {
28+
questionList.push(questions.barrel());
29+
}
30+
31+
questionList.push(questions.hooks(reactHooks));
2732

2833
if (mods.length) {
2934
questionList.push(questions.mods(mods));

0 commit comments

Comments
 (0)