Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - Add composables directory #32

Open
nmarshall23 opened this issue Feb 23, 2022 · 1 comment
Open

Feature request - Add composables directory #32

nmarshall23 opened this issue Feb 23, 2022 · 1 comment
Assignees
Labels
feat Issue or task about adding new feature
Projects
Milestone

Comments

@nmarshall23
Copy link

Something I found missing was boilerplate for composables. As I have adopted the composables api, I'm refactoring out features and reactive code to be reused.

My Feature request is add an option to generate this boilerplate.
For the cli switch because composables are often named useX, -u makes sense to me.

vgent make -u <composable_name>

The default directory for composables is src/composables.

Here is an example template for a composable named useFeature.ts

export interface UseFeatureOptions {}

/**
 * useFeature
 */
export function useFeature(options: UseFeatureOptions = {}) {
  const {
    // add default for each option
  } = options

  return {}
}

export type UseFeatureReturn = ReturnType<typeof useFeature>

Anywhere that useFeature is should be replaced with <composable_name>.

For TypeScript that's the minimum common boilerplate.

@armankuanysh armankuanysh self-assigned this Feb 24, 2022
@armankuanysh armankuanysh added the feat Issue or task about adding new feature label Feb 24, 2022
@armankuanysh armankuanysh added this to To do in VGENT via automation Feb 24, 2022
@armankuanysh armankuanysh added this to the v2.0.0 milestone Feb 24, 2022
@armankuanysh
Copy link
Owner

Hello! Thank you for your feedback. I've added this request to milestone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue or task about adding new feature
Projects
VGENT
To do
Development

No branches or pull requests

2 participants