/
readme.js
92 lines (69 loc) · 3.06 KB
/
readme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
const { lstatSync, readdirSync, writeFileSync } = require('fs');
const { join, resolve } = require('path');
const buildReadMe = (name) => `# @quillio/${name}
<div class="social-buttons">
<a href="https://github.com/walkerrandolphsmith/laces" class="btn gh-follow-btn">
<i></i>
<span class="label">Follow @laces</span>
</a>
<a href="https://github.com/walkerrandolphsmith/laces" class="btn gh-follow-btn">
<i></i>
<span class="label">Star</span>
</a>
</div>
<br>
[![License: MIT][license-badge]][license]
[![npm][npm-badge]][npm]
[![dependencies Status][npm-deps-badge]][npm-deps]
[![devDependencies Status][npm-dev-deps-badge]][npm-dev-deps]
[![Build Status][ci-badge]][ci]
[![Code Coverage][code-cov-badge]][code-cov]
[![Code Style][code-style-badge]][code-style]
[![Stories in Ready][waffle-badge]][waffle]
Using npm:
\`\`\`sh
// Install full build
$ npm install --save @laces/laces
// Cherry-pick only what you need
$ npm install --save @laces/laces-${name}
\`\`\`
Use in Node.js:
\`\`\`js
// Load the full build
const laces = require('@laces/laces')
// Cherry-pick methods for smaller bundles
const ${name} = require('@laces/laces-${name}')
\`\`\`
For additional documentation please use the
[documentation site](https://quillio.io/stringy)
To contribute please read the
[contributing guide](https://github.com/walkerrandolphsmith/laces/blob/master/CONTRIBUTING.md) and
[code of conduct](https://github.com/walkerrandolphsmith/laces/blob/master/CODE_OF_CONDUCT.md).
[ci]: https://travis-ci.org/walkerrandolphsmith/laces
[ci-badge]: https://travis-ci.org/walkerrandolphsmith/laces.svg?branch=master
[waffle]: http://waffle.io/walkerrandolphsmith/laces
[waffle-badge]: https://img.shields.io/waffle/label/walkerrandolphsmith/laces.svg
[npm]: https://www.npmjs.org/package/@laces/laces-${name}
[npm-badge]: https://img.shields.io/npm/v/@laces/laces-${name}.svg
[npm-deps]: https://david-dm.org/walkerrandolphsmith/laces
[npm-deps-badge]: https://david-dm.org/walkerrandolphsmith/laces/status.svg
[npm-dev-deps]: https://david-dm.org/walkerrandolphsmith/laces?type=dev
[npm-dev-deps-badge]: https://david-dm.org/walkerrandolphsmith/laces/dev-status.svg
[code-cov]: https://coveralls.io/github/walkerrandolphsmith/laces
[code-cov-badge]: https://coveralls.io/repos/github/walkerrandolphsmith/laces/badge.svg
[code-style]: https://github.com/airbnb/javascript
[code-style-badge]: https://img.shields.io/badge/code%20style-airbnb-brightgreen.svg
[license]: https://opensource.org/licenses/MIT
[license-badge]: https://img.shields.io/badge/License-MIT-brightgreen.svg
`;
const packagesPath = resolve(__dirname, 'packages');
const isDirectory = source => lstatSync(source).isDirectory();
const getDirectories = source => readdirSync(source)
.map(name => join(source, name))
.filter(isDirectory)
.map(path => path.split('/').pop());
const packageNames = getDirectories(packagesPath);
packageNames.forEach(packageName => {
const readMeContents = buildReadMe(packageName);
writeFileSync(`${packagesPath}/${packageName}/README.md`, readMeContents)
});