Skip to content

Commit 68ca2c1

Browse files
committed
feat: generate customized README after installation
1 parent 314107b commit 68ca2c1

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

tools/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# --libraryname--
2+
3+
[![NPM](https://img.shields.io/npm/v/--libraryname--.svg)](https://www.npmjs.com/package/--libraryname--)
4+
[![npm](https://img.shields.io/npm/dm/--libraryname--.svg)](https://www.npmjs.com/package/--libraryname--)
5+
![GitHub](https://img.shields.io/github/license/--username--/--libraryname--)
6+
7+
## Install
8+
9+
```bash
10+
npm install --save --libraryname--
11+
```
12+
13+
Or with yarn:
14+
15+
```bash
16+
yarn add --libraryname--
17+
```
18+
19+
## Usage
20+
21+
22+
## API / Props
23+
24+
25+
## License
26+
27+
MIT © [--username--](https://github.com/--username--)

tools/init.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const { mv, rm, which, exec } = require('shelljs');
2323
// Note: These should all be relative to the project root directory
2424
const rmDirs = ['.git', 'tools'];
2525
const rmFiles = ['.all-contributorsrc', '.gitattributes'];
26-
const modifyFiles = ['LICENSE', 'package.json'];
26+
const modifyFiles = ['LICENSE', 'package.json', 'README.md'];
2727
const renameFiles: Array<string> = [];
2828

2929
/**
@@ -163,11 +163,11 @@ function setupLibrary(libraryName: string, generateExample = false) {
163163
exec('npx create-react-app example');
164164
exec('echo "SKIP_PREFLIGHT_CHECK=true" >> example/.env');
165165
}
166+
mv('tools/README.md', 'README.md');
166167
removeItems();
167168

168169
modifyGitignoreFile();
169170
modifyContents(libraryName, username, usermail);
170-
// renameItems(libraryName);
171171

172172
if (generateExample) {
173173
console.log(yellow('Linking packages to the example app...'));
@@ -215,14 +215,12 @@ const _promptSchemaLibrarySuggest = {
215215
properties: {
216216
useSuggestedName: {
217217
description: cyan(
218-
'Would you like it to be called "' +
219-
libraryNameSuggested() +
220-
'"? [Yes/No]'
218+
'Would you like it to be called "' + libraryNameSuggested() + '"? [y/n]'
221219
),
222220
pattern: /^(y(es)?|n(o)?)$/i,
223221
type: 'string',
224222
required: true,
225-
message: 'You need to type "Yes" or "No" to continue...',
223+
message: 'You need to type "[y]es" or "[n]o" to continue...',
226224
},
227225
},
228226
};
@@ -231,12 +229,12 @@ const _promptInstallExampleApp = {
231229
properties: {
232230
installExampleApp: {
233231
description: yellow(
234-
'Would you like to generate an example react app to test your library/component? [Yes/No]'
232+
'Would you like to generate an example react app to test your library/component? [y/n]'
235233
),
236234
pattern: /^(y(es)?|n(o)?)$/i,
237235
type: 'string',
238236
required: true,
239-
message: 'You need to type "Yes" or "No" to continue...',
237+
message: 'You need to type "[y]es" or "[n]o" to continue...',
240238
},
241239
},
242240
};

0 commit comments

Comments
 (0)