Skip to content

Commit cfc83d3

Browse files
committed
chore(docs): Move docs script and use template
1 parent ae1d0a2 commit cfc83d3

File tree

4 files changed

+144
-2
lines changed

4 files changed

+144
-2
lines changed

docs/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
# Pattern Lab Node API
3+
4+
``` javascript
5+
6+
const config = require('./patternlab-config.json');
7+
const patternlab = require('patternlab-node')(config);
8+
9+
```
10+
11+
## `build(options)` ⇒ <code>Promise</code>
12+
13+
build patterns, copy assets, and construct ui
14+
15+
**Returns**: <code>Promise</code> - a promise fulfilled when build is complete
16+
17+
| Param | Type | Description |
18+
| --- | --- | --- |
19+
| options | <code>object</code> | an object used to control build behavior |
20+
21+
## `getDefaultConfig()` ⇒ <code>object</code>
22+
23+
Returns the standardized default config
24+
25+
**Returns**: <code>object</code> - Returns the object representation of the patternlab-config.json
26+
## `getSupportedTemplateExtensions()` ⇒ <code>Array.&lt;string&gt;</code>
27+
28+
returns all file extensions supported by installed PatternEngines
29+
30+
**Returns**: <code>Array.&lt;string&gt;</code> - all supported file extensions
31+
## `help()` ⇒ <code>void</code>
32+
33+
logs usage
34+
35+
**Returns**: <code>void</code> - pattern lab API usage, as console output
36+
## `installplugin(pluginName)` ⇒ <code>void</code>
37+
38+
install plugin already available via `node_modules/`
39+
40+
41+
| Param | Type | Description |
42+
| --- | --- | --- |
43+
| pluginName | <code>string</code> | name of plugin |
44+
45+
## `liststarterkits()` ⇒ <code>Promise</code>
46+
47+
fetches starterkit repos from pattern-lab github org that contain 'starterkit' in their name
48+
49+
**Returns**: <code>Promise</code> - Returns an Array<{name,url}> for the starterkit repos
50+
## `loadstarterkit(starterkitName, clean)` ⇒ <code>void</code>
51+
52+
load starterkit already available via `node_modules/`
53+
54+
55+
| Param | Type | Description |
56+
| --- | --- | --- |
57+
| starterkitName | <code>string</code> | name of starterkit |
58+
| clean | <code>boolean</code> | whether or not to delete contents of source/ before load |
59+
60+
## `v()` ⇒ <code>string</code>
61+
62+
return current version
63+
64+
**Returns**: <code>string</code> - current patternlab-node version as defined in package.json, as string
65+
## `version()` ⇒ <code>void</code>
66+
67+
logs current version
68+
69+
**Returns**: <code>void</code> - current patternlab-node version as defined in package.json, as console output
70+
## `patternsonly(options)` ⇒ <code>Promise</code>
71+
72+
build patterns only, leaving existing public files intact
73+
74+
**Returns**: <code>Promise</code> - a promise fulfilled when build is complete
75+
76+
| Param | Type | Description |
77+
| --- | --- | --- |
78+
| options | <code>object</code> | an object used to control build behavior |
79+
80+
## `serve(options)` ⇒ <code>Promise</code>
81+
82+
build patterns, copy assets, and construct ui, watch source files, and serve locally
83+
84+
**Returns**: <code>Promise</code> - TODO: validate
85+
86+
| Param | Type | Description |
87+
| --- | --- | --- |
88+
| options | <code>object</code> | an object used to control build, copy, and serve behavior |
89+
90+
* * *
91+
92+
[Pattern Lab](http://patternlab.io) Node is [MIT Licensed](https://github.com/pattern-lab/patternlab-node/blob/master/LICENSE)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
],
5959
"license": "MIT",
6060
"scripts": {
61-
"docs": "node ./core/scripts/docs.js",
61+
"docs": "node ./scripts/docs.js",
6262
"lint": "eslint core/**/*.js",
6363
"pretest": "npm run lint",
6464
"test": "tap test/*_tests.js --reporter spec --coverage"

scripts/api.hbs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
# Pattern Lab Node API
3+
4+
``` javascript
5+
6+
const config = require('./patternlab-config.json');
7+
const patternlab = require('patternlab-node')(config);
8+
9+
```
10+
11+
{{#orphans ~}}
12+
{{>heading-indent}}{{>sig-name}}
13+
14+
{{>deprecated~}}
15+
{{>description~}}
16+
{{>summary~}}
17+
{{>augments~}}
18+
{{>implements~}}
19+
{{>mixes~}}
20+
{{>default~}}
21+
{{>chainable~}}
22+
{{>overrides~}}
23+
{{>returns~}}
24+
{{>category~}}
25+
{{>throws~}}
26+
{{>fires~}}
27+
{{>this~}}
28+
{{>access~}}
29+
{{>readOnly~}}
30+
{{>requires~}}
31+
{{>customTags~}}
32+
{{>see~}}
33+
{{>since~}}
34+
{{>version~}}
35+
{{>authors~}}
36+
{{>license~}}
37+
{{>copyright~}}
38+
{{>todo~}}
39+
{{>params~}}
40+
{{>properties~}}
41+
{{>examples~}}
42+
43+
{{/orphans~}}
44+
45+
* * *
46+
47+
[Pattern Lab](http://patternlab.io) Node is [MIT Licensed](https://github.com/pattern-lab/patternlab-node/blob/master/LICENSE)

core/scripts/docs.js renamed to scripts/docs.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const process = require('process');
44
const fs = require('fs-extra');
55

66
doc.render({
7-
files: path.resolve(process.cwd(), './core/lib/patternlab.js')
7+
'example-lang': 'javascript',
8+
files: path.resolve(process.cwd(), './core/index.js'),
9+
'name-format': 'backticks',
10+
template: fs.readFileSync('./scripts/api.hbs', 'utf8')
811
}).then((x) => {
912
fs.outputFile(path.resolve(process.cwd(), './docs/README.md'), x);
1013
});

0 commit comments

Comments
 (0)