Skip to content

Commit ecd20b3

Browse files
committed
feat: 🎸 add strucutre inner generators;
1 parent b0910d0 commit ecd20b3

20 files changed

Lines changed: 183 additions & 139 deletions

‎.yo-rc.json.dist‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"generator-codibly-ts": {
3+
"rootDir": "src",
4+
"styling": "jss" | "emotion" | "styled-components"
5+
}
6+
}

‎README.md‎

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
1212
## Installation
1313

14-
We assume that you already have installed:
14+
##### Prerequisites
1515

1616
- [`yarn`](https://yarnpkg.com/) _- it's our default package manager_
1717
- [`yeoman`](https://yeoman.io/) (`yarn global add yo`)
1818

19-
Then you can install this generator:
19+
##### Installation command
2020

2121
```
2222
yarn global add generator-codibly-ts
@@ -29,6 +29,46 @@ And that's it - you are ready to generate ✨
2929
To generate something use `yo codibly-ts` command - it will guide you through the
3030
generation process.
3131

32+
There four types of frames you can generate
33+
34+
- **Structure** creates choosen part of an app structure according to Codibly guidelines
35+
- **Library**
36+
- **Application**
37+
- **Configuration**
38+
39+
## Structure🚧🚧💅
40+
41+
To generate part of an app structure according to Codibly guidelines run `yo codibly-ts:strucutre`.
42+
43+
You will be asked to choose one of four parts of the structure
44+
45+
- **Module** creates structure for business model - generates **API** and **Model** structures under given **Module** name
46+
- **API** creates `APIStrucutre` with given structure name
47+
- **Component** creates `ComponentStrucutre` with given structure name
48+
- **Model** creates `ModelStrucutre` with given structure name🚧
49+
- **Store** under construction
50+
51+
## Config
52+
53+
You can customize the generator output by creating `.yo-rc.json` file in your project. and setting up its values.
54+
55+
Important thing is to put `"generator-codibly-ts"` field into this file.
56+
Under this key you can put the following fields:
57+
58+
| field | value |
59+
| ------- | ------------------------------------------------- |
60+
| styling | "jss" | "styled-components" | "emotion" |
61+
62+
Example config
63+
64+
```
65+
{
66+
"generator-codibly-ts": {
67+
"styling": "emotion"
68+
}
69+
}
70+
```
71+
3272
## License
3373

3474
MIT

‎generators/structure-component/templates/component.class.tsx‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ import { compose } from 'redux';
33

44
import { Wrapper } from './<%= name %>.style';
55

6-
type StatProps = {
6+
export namespace <%= name %> {
7+
export type StatProps = {};
78

8-
}
9-
10-
type DispatchProps = {
11-
12-
}
9+
export type DispatchProps = {};
1310

14-
type Props = StatProps & DispatchProps & {
11+
type OwnProps = {};
1512

13+
export type Props = OwnProps & StatProps & DispatchProps;
1614
}
1715

18-
class <%= name %>Pure extends React.Component<Props> {
16+
class <%= name %>Pure extends React.Component<<%= name %>.Props> {
1917

2018
render() {
2119
return (
Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
import * as React from 'react';
2-
import { compose } from 'redux';
32

43
import { Wrapper } from './<%= name %>.style';
54

6-
type StatProps = {
5+
type Props = { };
76

7+
export const <%= name %> = (props: Props) => {
8+
return (
9+
<Wrapper>
10+
</Wrapper>
11+
);
812
}
9-
10-
type DispatchProps = {
11-
12-
}
13-
14-
type Props = StatProps & DispatchProps & {
15-
16-
}
17-
18-
class <%= name %>Pure extends React.Component<Props> {
19-
20-
render() {
21-
return (
22-
<Wrapper>
23-
</Wrapper>
24-
)
25-
}
26-
}
27-
28-
export const <%= name %> = compose(
29-
30-
)(<%= name %>Pure);
Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +0,0 @@
1-
import * as React from 'react';
2-
import { compose } from 'redux';
3-
4-
import { Wrapper } from './<%= name %>.style';
5-
6-
type StatProps = {
7-
8-
}
9-
10-
type DispatchProps = {
11-
12-
}
13-
14-
type Props = StatProps & DispatchProps & {
15-
16-
}
17-
18-
class <%= name %>Pure extends React.Component<Props> {
19-
20-
render() {
21-
return (
22-
<Wrapper>
23-
</Wrapper>
24-
)
25-
}
26-
}
27-
28-
export const <%= name %> = compose(
29-
30-
)(<%= name %>Pure);
Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +0,0 @@
1-
import * as React from 'react';
2-
import { compose } from 'redux';
3-
4-
import { Wrapper } from './<%= name %>.style';
5-
6-
type StatProps = {
7-
8-
}
9-
10-
type DispatchProps = {
11-
12-
}
13-
14-
type Props = StatProps & DispatchProps & {
15-
16-
}
17-
18-
class <%= name %>Pure extends React.Component<Props> {
19-
20-
render() {
21-
return (
22-
<Wrapper>
23-
</Wrapper>
24-
)
25-
}
26-
}
27-
28-
export const <%= name %> = compose(
29-
30-
)(<%= name %>Pure);

‎generators/structure-component/templates/style.emotion.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import styled from '@emotion/styled'
1+
import styled from '@emotion/styled';
22

33
export const Wrapper = styled.div({
44

‎generators/structure-component/templates/style.jss.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import styled from '@emotion/styled'
1+
import styled from 'jss';
22

33
export const Wrapper = styled.div({
44

‎generators/structure-component/templates/style.styled-components.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import styled from '@emotion/styled'
1+
import styled from 'styled-components';
22

33
export const Wrapper = styled.div({
44

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
]
8787
},
8888
"dependencies": {
89+
"camel-case": "^3.0.0",
8990
"chalk": "^2.1.0",
9091
"fs-extra": "^8.0.1",
9192
"node-emoji": "^1.10.0",

0 commit comments

Comments
 (0)