Skip to content

Commit f3da9ac

Browse files
authored
Use JSDoc (#317)
Clean up doc tags and move towards JSDoc - name modules consistently following commonjs pathing - fix missing types for some functions - add missing blocks for some functions - begin thinking about how to structure doc blocks to generate comprehensive overview of code surface * Add a @SInCE 1.1.0 tag to setHeaders methods * Wrap @example descriptions in <caption> tags * Standardize on @returns in JSDoc blocks * Remove YUIDoc and its references * Switch inline documentation to JSDoc Fixes #316
1 parent 745c6d9 commit f3da9ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+397
-3476
lines changed

.jsdoc.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"source": {
3+
"include": [
4+
"lib",
5+
"wpapi.js",
6+
"wpapi-computed-methods.jsdoc",
7+
"package.json",
8+
"build/api-reference-readme.md"
9+
],
10+
"includePattern": ".+\\.js(doc)?$",
11+
"excludePattern": "(browser/|bin/|build/|data/|tests/|node_modules)"
12+
},
13+
"plugins": [
14+
"plugins/markdown"
15+
],
16+
"tags": {
17+
"dictionaries": ["jsdoc"]
18+
},
19+
"templates": {
20+
"useLongnameInNav": false,
21+
"showInheritedInNav": true
22+
},
23+
"opts": {
24+
"destination": "./documentation/api-reference/",
25+
"template": "node_modules/minami",
26+
"encoding": "utf8",
27+
"recurse": true
28+
}
29+
}

.npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pids
88
*.sublime-*
99
_gh_issues/
1010
coverage
11-
docs-theme/
1211
docs-tmp/
1312
docs/
1413
index.html

CONTRIBUTING.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ We prefer `camelCase` variable and function names, and `UpperCamelCase` construc
111111

112112
## Documentation
113113

114-
The README getting started guide & YUIDoc block comment should be kept up-to-date with feature development: If you aren't familiar with adding doc blocks, we'll help you work through it in the comments of your PR.
114+
The README getting started guide & [JSDoc](http://usejsdoc.org/) block comment should be kept up-to-date with featrbenvure development: If you aren't familiar with adding JSDoc comments, we'll help you work through it in the comments of your PR.
115115

116-
The API docs will be updated whenever a new NPM module version is published. No files within `docs/` should be committed in any branch other than gh-pages.
116+
The API docs will be updated whenever a new NPM module version is published. No generated files within `documentation/` should be committed in any branch other than gh-pages.
117117

118-
To generate the docs yourself, run `npm run docs` (aliased to `grunt yuidoc`).
118+
To generate the docs yourself, run `npm run docs`. This task will parse the README into a series of individual markdown files, then run JSDoc to generate the API reference. These files will be consumed by GitHub Pages to render the final public [wp-api.org/node-wpapi](http://wp-api.org/node-wpapi) website.
119+
120+
Preview the generated documentation site locally with `npm run jekyll`. To install Jekyll you will need Ruby (v2.3.x is required due to a dependency issue in 2.4), then run `gem install bundler` and `bundle install` from the `documentation/` directory.
119121

120122
## Branch Naming & Pull Requests
121123

@@ -127,7 +129,11 @@ Internally, we try to use the following branch naming scheme to keep things orga
127129
* **build/feature-name**: Features relating to the build process, Gruntfile, linting or testing process, NPM package, *etcetera*
128130
* **docs/feature-name**: Documentation, README, contributing guide, fleshing out inline doc blocks; anything in the repository that's authored to be human-readable
129131

130-
It is not essential to maintain this naming structure in your own branches, though it is preferred; the important thing is that pull requests *not* be submitted from your master branch.
132+
It is not essential to maintain this naming structure in your own branches; the important thing is that pull requests *not* be submitted from your master branch.
133+
134+
## Release "Props"
135+
136+
Code is only a small part of the effort that goes into maintaining an open source project. We recognize both code _and_ non-code contributions with release "props," celebrating those who devote time and energy to the `wpapi` package. If you open an issue that highlights a bug, or contribute documentation and user guides, you will receive recognition for your support in the release notes where the associated code or documentation changes appear. Please participate constructively in [issue](https://github.com/wp-api/node-wpapi/issues) discussions, and thank you for your support!
131137

132138
## License
133139

Gruntfile.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports = function( grunt ) {
1616
grunt.registerTask( 'docs', [
1717
'clean',
1818
'generate_readme_docs',
19-
'zip',
20-
'yuidoc'
19+
'zip'
2120
]);
2221
};

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ var wp = new WPAPI({
928928
929929
## API Documentation
930930
931-
In addition to the above getting-started guide, we have automatically-generated [API documentation](http://wp-api.github.io/node-wpapi).
931+
In addition to the above getting-started guide, we have automatically-generated [API documentation](http://wp-api.github.io/node-wpapi/api-reference/).
932932
933933
934934
## Issues

build/api-reference-readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## WPAPI Code Reference
2+
3+
Welcome to the API Reference for the `wpapi` NPM package.
4+
5+
Running `require( 'wpapi' )` returns the `WPAPI` constructor, which you can read about by clicking its name in the class list in the menu. Each request handler factory on `WPAPI` (such as `.posts()`, `.pages()`, _etc._) returns a `WPRequest` object, conditionally augmented with one or more mixins depending on the capabilities of the associated endpoints.
6+
7+
For user guides & tutorials, visit [wp-api.org/node-wpapi/](http://wp-api.org/node-wpapi).

build/grunt/yuidoc.js

-23
This file was deleted.

build/scripts/generate-docs-markdown.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ combyne.settings.delimiters = {
1414
END_EXPR: '%}]'
1515
};
1616

17+
// Application Version
18+
const version = require( '../../package.json' ).version;
19+
1720
// Paths
1821
const projectRoot = path.join( __dirname, '../..' );
1922
const docsDir = path.join( projectRoot, 'documentation' );
@@ -170,7 +173,7 @@ const readmeOutput = readFile( readmePath ).then( contents => {
170173
}, Promise.resolve() ).then( () => {
171174
entries.push({
172175
title: 'API Documentation',
173-
slug: 'api-reference/modules/WPAPI.html'
176+
slug: `api-reference/wpapi/${version}/`
174177
});
175178
return entries;
176179
});

docs-theme/README.md

-7
This file was deleted.
-491 Bytes
Binary file not shown.

docs-theme/assets/css/logo.png

-6.16 KB
Binary file not shown.

0 commit comments

Comments
 (0)