Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed733ae

Browse files
authored
build: check broken links in generated docs (googleapis#301)
* build: check dead links on Kokoro * recursive crawl local links * fix missing namespace * fix doc_timestamp.js dead links
1 parent 10baa5b commit ed733ae

7 files changed

Lines changed: 29 additions & 15 deletions

File tree

.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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"eslint-config-prettier": "^3.0.0",
5555
"eslint-plugin-node": "^8.0.0",
5656
"eslint-plugin-prettier": "^3.0.0",
57-
"ink-docstrap": "^1.3.2",
57+
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
5858
"intelli-espower-loader": "^1.0.1",
5959
"jsdoc": "^3.5.5",
6060
"mocha": "^5.2.0",

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
// limitations under the License.
1414

1515
/**
16-
* @namespace google
16+
* @namespace google.cloud.vision.v1
1717
*/
1818
/**
19-
* @namespace google.cloud
19+
* @namespace google.cloud.vision.v1p1beta1
2020
*/
2121
/**
22-
* @namespace google.cloud.vision
22+
* @namespace google.cloud.vision.v1p2beta1
2323
*/
2424
/**
25-
* @namespace google.cloud.vision.v1
25+
* @namespace google.cloud.vision.v1p3beta1
2626
*/
2727
/**
28-
* @namespace google.cloud.vision.v1p1beta1
28+
* @namespace google.longrunning
2929
*/
3030
/**
3131
* @namespace google.protobuf

src/v1/doc/google/protobuf/doc_timestamp.js

Lines changed: 2 additions & 4 deletions
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

src/v1p3beta1/doc/google/protobuf/doc_timestamp.js

Lines changed: 2 additions & 4 deletions
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

synth.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
templates = common_templates.node_library()
3434
s.copy(templates)
3535

36+
# [START fix-dead-link]
37+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
38+
'https:\/\/cloud\.google\.com[\s\*]*http:\/\/(.*)[\s\*]*\)',
39+
r"https://\1)")
40+
41+
s.replace('**/doc/google/protobuf/doc_timestamp.js',
42+
'toISOString\]',
43+
'toISOString)')
44+
# [END fix-dead-link]
45+
3646
# Node.js specific cleanup
3747
subprocess.run(['npm', 'install'])
3848
subprocess.run(['npm', 'run', 'fix'])

0 commit comments

Comments
 (0)