Skip to content

Commit d4be860

Browse files
authored
Merge pull request #16 from Rain120/dev
plop create code and docs model
2 parents 1554150 + 8ef0e62 commit d4be860

File tree

5 files changed

+78
-9
lines changed

5 files changed

+78
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1.0.0 (2020-03-02)
1+
# 1.0.0 (2020-03-03)
22

33

44
### Bug Fixes
@@ -46,6 +46,8 @@
4646
* new ([e1b1495](https://github.com/Rain120/awesome-javascript-code-implementation/commit/e1b1495c204bb8936a45356eaa8b7266020ba055))
4747
* object.is ([437d64a](https://github.com/Rain120/awesome-javascript-code-implementation/commit/437d64a8f5fb0ad357cadc41b11d68286aa81b3e))
4848
* observer pattern ([77c78f7](https://github.com/Rain120/awesome-javascript-code-implementation/commit/77c78f7359161c0e64b3143e3a66fea3f5d4eb46))
49+
* plop create code and docs model ([2dece76](https://github.com/Rain120/awesome-javascript-code-implementation/commit/2dece76fbfd83514551dbabadf7c54d73674730d))
50+
* plop new code and docs template ([61a936b](https://github.com/Rain120/awesome-javascript-code-implementation/commit/61a936b58bc52a1cf984dc6156746b43f65da7f1))
4951
* proxy design ([e615f39](https://github.com/Rain120/awesome-javascript-code-implementation/commit/e615f39497043f4c2357c7366cb13226b57208e6))
5052
* sort -> bubbleSort(algorithm, readme, test) ([36fab7b](https://github.com/Rain120/awesome-javascript-code-implementation/commit/36fab7b029d425ac129b6c4f202b18a9a3852fef))
5153
* sort -> bucket, radix; algorithm -> binaryTree; add some types; docs: update readme; fix: tests format, ([b1d166c](https://github.com/Rain120/awesome-javascript-code-implementation/commit/b1d166c7e56e37f35ab0bc7628186eeae15a4b60))
@@ -54,10 +56,10 @@
5456
* update netlify status ([013b5ca](https://github.com/Rain120/awesome-javascript-code-implementation/commit/013b5ca5847873adabbff93a89daa41500ccf153))
5557
* update readme for plans ([b427b96](https://github.com/Rain120/awesome-javascript-code-implementation/commit/b427b9667cc97c77df75ef0af56eb84b6b4c3ba6))
5658
* update test.yml -> ci.yml and set command ([43b96b6](https://github.com/Rain120/awesome-javascript-code-implementation/commit/43b96b63fc2788a5ea37fa7567c6a6dced4b875f))
57-
* update xmind ([4256758](https://github.com/Rain120/awesome-javascript-code-implementation/commit/4256758c5fe0a036ce3ececc43f848e48964d7a0))
58-
* update xmind ([408ca68](https://github.com/Rain120/awesome-javascript-code-implementation/commit/408ca685142dc425e90be64a284016d57d580893))
5959
* update xmind ([71317c6](https://github.com/Rain120/awesome-javascript-code-implementation/commit/71317c67376bc8196f80e25391adfdc9b2496380))
6060
* update xmind ([cb23933](https://github.com/Rain120/awesome-javascript-code-implementation/commit/cb23933f46152c59a7b08f84d7355b35bba25002))
61+
* update xmind ([408ca68](https://github.com/Rain120/awesome-javascript-code-implementation/commit/408ca685142dc425e90be64a284016d57d580893))
62+
* update xmind ([4256758](https://github.com/Rain120/awesome-javascript-code-implementation/commit/4256758c5fe0a036ce3ececc43f848e48964d7a0))
6163
* update: plans; fix: readme bug ([d44e559](https://github.com/Rain120/awesome-javascript-code-implementation/commit/d44e559def7834fcccbb19797a1d29bf5cc4e5b7))
6264
* vuepress docs v1.0.0 ([785caeb](https://github.com/Rain120/awesome-javascript-code-implementation/commit/785caeb41beeff7a0f53646fc952d1c89ebb61d5))
6365
* zh-cn and plans ([62b460f](https://github.com/Rain120/awesome-javascript-code-implementation/commit/62b460f200a2f76ee36cd3cae94d1660ed4ff3c2))

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ npm run template
5959
npm run docs
6060
```
6161

62+
同时生成 `code` `docs`模板
63+
```
64+
npm run template-docs
65+
```
66+
6267
[how-to-write-docs](docs/zh/how-to-write-docs/README.md)
6368

6469
#### 🤝 Contributing

docs/zh/guide/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ npm run template
5959
npm run docs
6060
```
6161

62+
同时生成 `code` `docs`模板
63+
```
64+
npm run template-docs
65+
```
66+
6267
[how-to-write-docs](docs/zh/how-to-write-docs/README.md)
6368

6469
## 🤝 Contributing

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"plop": "./node_modules/.bin/plop",
2121
"template": "npm run plop template",
2222
"docs": "npm run plop docs",
23+
"template-docs": "npm run plop model-template-docs",
2324
"docs:dev": "vuepress dev docs",
2425
"docs:build": "vuepress build docs",
2526
"deploy": "bash deploy.sh"

plopfile.js

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: Rainy
33
* @Date: 2020-03-01 19:29:27
44
* @LastEditors: Rainy
5-
* @LastEditTime: 2020-03-01 21:01:15
5+
* @LastEditTime: 2020-03-03 10:25:16
66
*/
77

88
module.exports = plop => {
@@ -51,7 +51,7 @@ module.exports = plop => {
5151
}
5252
});
5353
plop.setGenerator('docs', {
54-
description: 'Create root zh docs',
54+
description: 'Create zh docs',
5555
prompts: [
5656
{
5757
type: 'input',
@@ -68,11 +68,67 @@ module.exports = plop => {
6868
],
6969
actions: answer => {
7070
return [
71+
{
72+
type: 'add',
73+
path: '{{path}}/{{name}}/README.md',
74+
templateFile: 'plop-templates/docs/zh/README.md.hbs'
75+
}
76+
];
77+
}
78+
});
79+
plop.setGenerator('model-template-docs', {
80+
description: 'Create root template and zh docs',
81+
prompts: [
82+
{
83+
type: 'input',
84+
name: 'name',
85+
message: 'please input the name: ',
86+
default: 'template'
87+
},
7188
{
72-
type: 'add',
73-
path: '{{path}}/{{name}}/README.md',
74-
templateFile: 'plop-templates/docs/zh/README.md.hbs'
75-
}];
89+
type: 'confirm',
90+
name: 'needTest',
91+
message: 'Do you want test file ? '
92+
},
93+
{
94+
type: 'input',
95+
name: 'templatePath',
96+
message: 'generator path (etc: src/template) ?',
97+
default: 'src'
98+
},
99+
{
100+
type: 'input',
101+
name: 'docsPath',
102+
message: 'generator model path (etc: docs/zh/model) ?',
103+
default: 'docs/zh'
104+
}
105+
],
106+
actions: answer => {
107+
let actions = [
108+
{
109+
type: 'add',
110+
path: '{{templatePath}}/{{name}}/index.ts',
111+
templateFile: 'plop-templates/code/index.ts.hbs'
112+
},
113+
{
114+
type: 'add',
115+
path: '{{templatePath}}/{{name}}/README.md',
116+
templateFile: 'plop-templates/code/README.md.hbs'
117+
},
118+
{
119+
type: 'add',
120+
path: '{{docsPath}}/{{name}}/README.md',
121+
templateFile: 'plop-templates/docs/zh/README.md.hbs'
122+
}
123+
];
124+
if (answer.needTest) {
125+
actions.push({
126+
type: 'add',
127+
path: '{{templatePath}}/{{name}}/__tests__.ts',
128+
templateFile: 'plop-templates/code/__tests__.ts.hbs'
129+
});
130+
}
131+
return actions;
76132
}
77133
});
78134
};

0 commit comments

Comments
 (0)