Skip to content

Commit

Permalink
fix(main): add maxItems option to scope prompt (#104)
Browse files Browse the repository at this point in the history
Fixed glitch on small height screen for long scopes list. Base on @clack/prompts@0.7.0 via bombshell-dev/clack#174
  • Loading branch information
exdeniz authored May 8, 2024
1 parent 722b153 commit 2cb2088
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"license": "MIT",
"dependencies": {
"@clack/core": "^0.3.1",
"@clack/prompts": "^0.6.2",
"@clack/prompts": "^0.7.0",
"configstore": "^5.0.1",
"picocolors": "^1.0.0",
"valibot": "^0.30.0"
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
"commit_type": {
"enable": true,
"initial_value": "feat",
"max_items": Infinity,
"infer_type_from_branch": true,
"append_emoji_to_label": false,
"append_emoji_to_commit": false,
Expand Down Expand Up @@ -168,6 +169,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
"enable": true,
"custom_scope": false,
"initial_value": "app",
"max_items": Infinity
"options": [
{
"value": "app",
Expand Down Expand Up @@ -281,6 +283,7 @@ Expand to see explanations and possible values
| `check_status` | If true run interactive `git status` |
| `commit_type.enable` | If true include commit type |
| `commit_type.initial_value` | Initial selection of commit type |
| `commit_type.max_items` | Maximum number of type displayed on the screen |
| `commit_type.infer_type_from_branch` | If true infer type from branch name |
| `commit_type.append_emoji_to_label` | If true append emoji to prompt |
| `commit_type.append_emoji_to_commit` | If true append emoji to commit |
Expand All @@ -292,6 +295,7 @@ Expand to see explanations and possible values
| `commit_scope.enable` | If true include commit scope |
| `commit_scope.custom_scope` | If true allow custom scope at run-time |
| `commit_scope.initial_value` | Default commit scope selected |
| `commit_scope.max_items` | Maximum number of scope displayed on the screen |
| `commit_scope.options.value` | Commit scope value |
| `commit_scope.options.label` | Commit scope label |
| `check_ticket.infer_ticket` | If true infer ticket from branch name |
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export async function main(config: Output<typeof Config>) {
const commit_type = await p.select({
message,
initialValue: initial_value,
maxItems: config.commit_type.max_items,
options: config.commit_type.options,
});
if (p.isCancel(commit_type)) process.exit(0);
Expand All @@ -107,6 +108,7 @@ export async function main(config: Output<typeof Config>) {
let commit_scope = await p.select({
message: "Select a commit scope",
initialValue: config.commit_scope.initial_value,
maxItems: config.commit_scope.max_items,
options: config.commit_scope.options,
});
if (p.isCancel(commit_scope)) process.exit(0);
Expand Down
2 changes: 2 additions & 0 deletions src/valibot-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Config = v.object({
{
enable: v.optional(v.boolean(), true),
initial_value: v.optional(v.string(), "feat"),
max_items: v.optional(v.number(), Infinity),
infer_type_from_branch: v.optional(v.boolean(), true),
append_emoji_to_label: v.optional(v.boolean(), false),
append_emoji_to_commit: v.optional(v.boolean(), false),
Expand Down Expand Up @@ -65,6 +66,7 @@ export const Config = v.object({
{
enable: v.optional(v.boolean(), true),
custom_scope: v.optional(v.boolean(), false),
max_items: v.optional(v.number(), Infinity),
initial_value: v.optional(v.string(), "app"),
options: v.optional(
v.array(
Expand Down

0 comments on commit 2cb2088

Please sign in to comment.