Skip to content

Commit 70ea500

Browse files
jkwluiJustinBeckwith
authored andcommitted
build: check broken links in generated docs (#292)
1 parent f839e58 commit 70ea500

File tree

4 files changed

+61
-72
lines changed

4 files changed

+61
-72
lines changed

.jsdoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
opts: {
2121
readme: './README.md',
2222
package: './package.json',
23-
template: './node_modules/ink-docstrap/template',
23+
template: './node_modules/jsdoc-baseline',
2424
recurse: true,
2525
verbose: true,
2626
destination: './docs/'

.kokoro/docs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ cd $(dirname $0)/..
2323
npm install
2424

2525
npm run docs
26+
27+
# Check broken links
28+
BIN=./node_modules/.bin
29+
30+
npm install broken-link-checker
31+
npm install http-server
32+
$BIN/http-server -p 8080 docs/ &
33+
$BIN/blc -r http://localhost:8080

README.md

Lines changed: 51 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,97 +8,65 @@
88
[![npm version](https://img.shields.io/npm/v/@google-cloud/datastore.svg)](https://www.npmjs.org/package/@google-cloud/datastore)
99
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-datastore/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-datastore)
1010

11-
> Node.js idiomatic client for [Cloud Datastore][product-docs].
12-
1311
[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.
1412

1513

16-
* [Cloud Datastore Node.js Client API Reference][client-docs]
17-
* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore)
18-
* [Cloud Datastore Documentation][product-docs]
19-
20-
Read more about the client libraries for Cloud APIs, including the older
21-
Google APIs Client Libraries, in [Client Libraries Explained][explained].
22-
23-
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
24-
25-
**Table of contents:**
26-
27-
* [Quickstart](#quickstart)
28-
* [Before you begin](#before-you-begin)
29-
* [Installing the client library](#installing-the-client-library)
30-
* [Using the client library](#using-the-client-library)
14+
* [Using the client library](#using-the-client-library)
3115
* [Samples](#samples)
3216
* [Versioning](#versioning)
3317
* [Contributing](#contributing)
3418
* [License](#license)
3519

36-
## Quickstart
37-
38-
### Before you begin
39-
40-
1. Select or create a Cloud Platform project.
41-
42-
[Go to the projects page][projects]
43-
44-
1. Enable billing for your project.
20+
## Using the client library
4521

46-
[Enable billing][billing]
22+
1. [Select or create a Cloud Platform project][projects].
4723

48-
1. Enable the Google Cloud Datastore API.
24+
1. [Enable billing for your project][billing].
4925

50-
[Enable the API][enable_api]
26+
1. [Enable the Google Cloud Datastore API][enable_api].
5127

5228
1. [Set up authentication with a service account][auth] so you can access the
5329
API from your local workstation.
5430

55-
[projects]: https://console.cloud.google.com/project
56-
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
57-
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=datastore.googleapis.com
58-
[auth]: https://cloud.google.com/docs/authentication/getting-started
31+
1. Install the client library:
5932

60-
### Installing the client library
33+
npm install --save @google-cloud/datastore
6134

62-
npm install --save @google-cloud/datastore
63-
64-
### Using the client library
35+
1. Try an example:
6536

6637
```javascript
6738
// Imports the Google Cloud client library
6839
const {Datastore} = require('@google-cloud/datastore');
6940

70-
// Your Google Cloud Platform project ID
71-
const projectId = 'YOUR_PROJECT_ID';
72-
73-
// Creates a client
74-
const datastore = new Datastore({
75-
projectId: projectId,
76-
});
77-
78-
// The kind for the new entity
79-
const kind = 'Task';
80-
// The name/ID for the new entity
81-
const name = 'sampletask1';
82-
// The Cloud Datastore key for the new entity
83-
const taskKey = datastore.key([kind, name]);
84-
85-
// Prepares the new entity
86-
const task = {
87-
key: taskKey,
88-
data: {
89-
description: 'Buy milk',
90-
},
91-
};
92-
93-
// Saves the entity
94-
datastore
95-
.save(task)
96-
.then(() => {
97-
console.log(`Saved ${task.key.name}: ${task.data.description}`);
98-
})
99-
.catch(err => {
100-
console.error('ERROR:', err);
41+
async function quickStart() {
42+
// Your Google Cloud Platform project ID
43+
const projectId = 'YOUR_PROJECT_ID';
44+
45+
// Creates a client
46+
const datastore = new Datastore({
47+
projectId: projectId,
10148
});
49+
50+
// The kind for the new entity
51+
const kind = 'Task';
52+
// The name/ID for the new entity
53+
const name = 'sampletask1';
54+
// The Cloud Datastore key for the new entity
55+
const taskKey = datastore.key([kind, name]);
56+
57+
// Prepares the new entity
58+
const task = {
59+
key: taskKey,
60+
data: {
61+
description: 'Buy milk',
62+
},
63+
};
64+
65+
// Saves the entity
66+
await datastore.save(task);
67+
console.log(`Saved ${task.key.name}: ${task.data.description}`);
68+
}
69+
quickStart().catch(console.error);
10270
```
10371

10472
## Samples
@@ -110,7 +78,6 @@ has instructions for running the samples.
11078
| --------------------------- | --------------------------------- | ------ |
11179
| Tasks | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) |
11280
| Concepts | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/concepts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md) |
113-
| Errors and Error Handling | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/error.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/error.js,samples/README.md) |
11481

11582
The [Cloud Datastore Node.js Client API Reference][client-docs] documentation
11683
also contains samples.
@@ -139,7 +106,21 @@ Apache Version 2.0
139106

140107
See [LICENSE](https://github.com/googleapis/nodejs-datastore/blob/master/LICENSE)
141108

109+
## What's Next
110+
111+
* [Cloud Datastore Documentation][product-docs]
112+
* [Cloud Datastore Node.js Client API Reference][client-docs]
113+
* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore)
114+
115+
Read more about the client libraries for Cloud APIs, including the older
116+
Google APIs Client Libraries, in [Client Libraries Explained][explained].
117+
118+
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
119+
142120
[client-docs]: https://cloud.google.com/nodejs/docs/reference/datastore/latest/
143121
[product-docs]: https://cloud.google.com/datastore/docs
144122
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
145-
123+
[projects]: https://console.cloud.google.com/project
124+
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
125+
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=datastore.googleapis.com
126+
[auth]: https://cloud.google.com/docs/authentication/getting-started

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"eslint-plugin-node": "^8.0.0",
7373
"eslint-plugin-prettier": "^3.0.0",
7474
"gts": "^0.9.0",
75-
"ink-docstrap": "^1.3.2",
75+
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
7676
"intelli-espower-loader": "^1.0.1",
7777
"jsdoc": "^3.5.5",
7878
"mocha": "^5.2.0",

0 commit comments

Comments
 (0)