Skip to content

Commit 2d6dfa7

Browse files
authored
build: check broken links in generated docs (#102)
* build: check dead links on Kokoro * recursive crawl local links * add missing namespace * fix link in README.md * fix timestamp docs links
1 parent e0e74a9 commit 2d6dfa7

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

packages/google-cloud-kms/.jsdoc.js

+1-1
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/'

packages/google-cloud-kms/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ has instructions for running the samples.
6868

6969
| Sample | Source Code | Try it |
7070
| --------------------------- | --------------------------------- | ------ |
71-
| KMS | [source code](https://github.com/googleapis/nodejs-kms/blob/master/samples/kms.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-kms&page=editor&open_in_editor=samples/kms.js,samples/README.md) |
71+
| KMS | [source code](https://github.com/googleapis/nodejs-kms/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-kms&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
7272

7373
The [Cloud KMS Node.js Client API Reference][client-docs] documentation
7474
also contains samples.

packages/google-cloud-kms/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"eslint-config-prettier": "^3.0.0",
5252
"eslint-plugin-node": "^8.0.0",
5353
"eslint-plugin-prettier": "^3.0.0",
54-
"ink-docstrap": "^1.3.2",
54+
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
5555
"intelli-espower-loader": "^1.0.1",
5656
"jsdoc": "^3.5.5",
5757
"mocha": "^5.2.0",

packages/google-cloud-kms/src/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
/**
2525
* @namespace google.cloud.kms.v1
2626
*/
27+
/**
28+
* @namespace google.protobuf
29+
*/
2730

2831
'use strict';
2932

packages/google-cloud-kms/src/v1/doc/google/protobuf/doc_timestamp.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@
8787
* 01:30 UTC on January 15, 2017.
8888
*
8989
* In JavaScript, one can convert a Date object to this format using the
90-
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
90+
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
9191
* method. In Python, a standard `datetime.datetime` object can be converted
9292
* to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
9393
* with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
94-
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://cloud.google.com
95-
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
96-
* ) to obtain a formatter capable of generating timestamps in this format.
94+
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) to obtain a formatter capable of generating timestamps in this format.
9795
*
9896
* @property {number} seconds
9997
* Represents seconds of UTC time since Unix epoch

packages/google-cloud-kms/synth.py

+11
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
templates = common_templates.node_library()
3838
s.copy(templates)
3939

40+
# [START fix-dead-link]
41+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
42+
'https:\/\/cloud\.google\.com[\s\*]*http:\/\/(.*)[\s\*]*\)',
43+
r"https://\1)")
44+
45+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
46+
'toISOString\]',
47+
'toISOString)')
48+
# [END fix-dead-link]
49+
50+
4051
# Node.js specific cleanup
4152
subprocess.run(['npm', 'install'])
4253
subprocess.run(['npm', 'run', 'fix'])

0 commit comments

Comments
 (0)