Skip to content

Commit

Permalink
Only prompt for component js if in Components category
Browse files Browse the repository at this point in the history
  • Loading branch information
mel-miller committed Oct 3, 2022
1 parent e80571b commit 041746b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Generate `local.twig` files unless in `Components` category.
- Prevent generation of `scss` file for `Recipes`.
- Only prompt for component `js` if in `Components` category.

## [v0.1.3] - 2022-09-26

Expand Down
19 changes: 12 additions & 7 deletions generators/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ module.exports = class extends Generator {
choices: ['Components', 'Foundations', 'Utilities', 'Recipes'],
default: 'Components',
},
{
type: 'confirm',
name: 'js',
message: 'Include a component .js file?',
default: false,
},
]);

if (this.answers.category === 'Components') {
this.extras = await this.prompt([
{
type: 'confirm',
name: 'js',
message: 'Include a component .js file?',
default: false,
},
]);
}
}
}

Expand All @@ -66,8 +71,8 @@ module.exports = class extends Generator {
label: toTitleCase(this.answers.name),
category: this.answers.category,
categoryDir: this.answers.category.toLowerCase(),
includeJs: this.answers.js,
local: this.answers.category === 'Components' ? '' : '.local',
includeJs: this.answers.category === 'Components' ? this.extras.js : null,
};

// File types needed for component.
Expand Down

0 comments on commit 041746b

Please sign in to comment.