Skip to content

Commit

Permalink
feat: allow to choose custom path for resource and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed Apr 29, 2024
1 parent 0671f56 commit ee874c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/actions/guided.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
vueVersionsChoices,
storiesPostfixChoices,
testFrameworkChoices,
cssFrameworkChoices
cssFrameworkChoices,
chooseMyOwnPathChoice
} from '../constants/choices.js'

import { boolAsText } from '../utils/string.js'
Expand Down Expand Up @@ -152,9 +153,11 @@ export async function guidedAction() {
if (choices) {
resourcePath = await select({
message: `What is the folder path that I should create your ${type} in?`,
choices
choices: [...chooseMyOwnPathChoice, ...choices]
})
} else {
}

if (!choices || resourcePath === 'type-path') {
resourcePath = await input({
message: `What is the folder path that I should create your ${type} in? e.g. src/folder/here`
})
Expand All @@ -177,10 +180,13 @@ export async function guidedAction() {
name: `Same as your ${type}: ${resourcePath}`,
value: resourcePath
},
...chooseMyOwnPathChoice,
...choices
]
})
} else {
}

if (!choices || testPath === 'type-path') {
testPath = await input({
message: 'What is the folder path that I should create your tests in? e.g. folder/here'
})
Expand Down Expand Up @@ -222,10 +228,13 @@ export async function guidedAction() {
name: `Same as your ${type}: ${resourcePath}`,
value: resourcePath
},
...chooseMyOwnPathChoice,
...choices
]
})
} else {
}

if (!choices || storyPath === 'type-path') {
storyPath = await input({
message: 'What is the folder path that I should create your story in? e.g. folder/here'
})
Expand Down
2 changes: 2 additions & 0 deletions src/constants/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export const testPostfixChoices = [

export const storiesPostfixChoices = [{ name: '.stories', value: StoryPostfixEnum.stories }]

export const chooseMyOwnPathChoice = [{ name: 'Type my path', value: 'type-path' }]

export const resourcesPaths = {
page: [
{ name: 'src/pages', value: 'src/pages' },
Expand Down

0 comments on commit ee874c7

Please sign in to comment.