Skip to content

Commit 014a3a0

Browse files
authored
Merge pull request #37 from khus29/patch-2
Patch 2
2 parents af10cae + bd7a897 commit 014a3a0

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/generate-plop.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,39 @@ Based on all details provided generate-tool will create follwoing files:
5151
- ````{name}.style.ts```` Style file for the component using [Styled Component framework](https://styled-components.com/)
5252
- ````{name}.story.ts```` [Storybook](https://storybook.js.org/) created for the component.
5353

54+
### Hooks
55+
You can create [React custom hooks](https://reactjs.org/docs/hooks-custom.html). You
56+
will need to provide name for the hook.
57+
The custom hook will be created in ````src/hooks ```` directory. generate-tool
58+
will create the following files:
59+
- ````index.ts```` React custom hook.
60+
- ````test.ts```` Unit test basic structure for the hook using [React Test Library](https://testing-library.com/docs/react-testing-library/intro/)
61+
62+
### Pages
63+
You can create [Next pages](https://nextjs.org/docs/basic-features/pages).
64+
- You will need to provide the name of the page.
65+
- You can provide directory where you want to create the page, default directory
66+
is ````src/pages````.
67+
- Tool will create ````index.ts```` Export statement for the custom hook.
68+
- It will update the route as well in ````src/routes/paths.ts```` file.
69+
70+
### Stores
71+
You can create [React context](https://reactjs.org/docs/context.html). Context created
72+
is [smart-context](https://www.npmjs.com/package/smart-context). It makes state management
73+
simple. You will need to provide store name. Files created by the tool are:
74+
- ````index.ts```` Export statement for the store.
75+
- ````contextProvider.ts```` Context will return the provider wrapped component.
76+
77+
### Services
78+
You can create services using [react-query](https://react-query.tanstack.com/) to fetch
79+
cache ad create data. You have an option to create rest based services or [graphql](https://graphql.org/) based
80+
services.
81+
- Service will be created in ````packages/services```` directory.
82+
- You will need to choose if it is a graphql call or not.
83+
- You will need to provide the name of the service.
84+
Files created by generate-plop tool are:
85+
- ````{name}.ts```` Service created using react-query
86+
- ````types/common.ts```` Interface for default props used in the service (*Only for Typescript*)
87+
88+
## Refrences
89+
[Plop documetation](https://plopjs.com/documentation/)

0 commit comments

Comments
 (0)