Skip to content

Commit

Permalink
build: check broken links in generated docs (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwlui authored and JustinBeckwith committed Jan 15, 2019
1 parent 572482d commit 13e94c7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-securitycenter/.jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
opts: {
readme: './README.md',
package: './package.json',
template: './node_modules/ink-docstrap/template',
template: './node_modules/jsdoc-baseline',
recurse: true,
verbose: true,
destination: './docs/'
Expand Down
6 changes: 3 additions & 3 deletions packages/google-cloud-securitycenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![npm version](https://img.shields.io/npm/v/@google-cloud/security-center.svg)](https://www.npmjs.org/package/@google-cloud/security-center)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-security-center/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-security-center)

[Cloud Security Command Center](https://cloud.google.com/security-center/docs/) helps security teams gather data, identify threats, and act on them before they result in business damage or loss. It offers deep insight into application and data risk so that you can quickly mitigate threats to your cloud resources and evaluate overall health. With Cloud Security Command Center, you can view and monitor an inventory of your cloud assets, scan storage systems for sensitive data, detect common web vulnerabilities, and review access rights to your critical resources, all from a single, centralized dashboard.
[Cloud Security Command Center](https://cloud.google.com/security-command-center/docs/) helps security teams gather data, identify threats, and act on them before they result in business damage or loss. It offers deep insight into application and data risk so that you can quickly mitigate threats to your cloud resources and evaluate overall health. With Cloud Security Command Center, you can view and monitor an inventory of your cloud assets, scan storage systems for sensitive data, detect common web vulnerabilities, and review access rights to your critical resources, all from a single, centralized dashboard.


* [Using the client library](#using-the-client-library)
Expand All @@ -33,7 +33,7 @@

```javascript
async function quickstart(
organization = 'YOUR_ORGANIZATION', // Your GCP organization
organization = 'YOUR_ORGANIZATION' // Your GCP organization
) {
const sc = require('@google-cloud/security-center');

Expand Down Expand Up @@ -93,7 +93,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained

[client-docs]: https://cloud.google.com/nodejs/docs/reference/security-center/latest/
[product-docs]: https://cloud.google.com/security-center/docs/
[product-docs]: https://cloud.google.com/security-command-center/docs/
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-securitycenter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"eslint-config-prettier": "^3.0.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"ink-docstrap": "^1.3.0",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"mocha": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
* "organizations/123/sources/456"
*
* @property {string} displayName
* The source's display name.
* A source's display name must be unique amongst its siblings, for example,
* The sources display name.
* A sources display name must be unique amongst its siblings, for example,
* two sources with the same parent can't share the same display name.
* The display name must start and end with a letter or digit, may contain
* letters, digits, spaces, hyphens, and underscores, and can be no longer
* than 32 characters. This is captured by the regular expression:
* [\p{L}\p{N}](https://cloud.google.com{\p{L}\p{N}_- ]{0,30}[\p{L}\p{N}])?.
* than 30 characters. This is captured by the regular expression:
* `\[\p{L}\p{N}]({\p{L}\p{N}_- ]{0,30}[\p{L}\p{N}])?`.
*
* @property {string} description
* The description of the source (max of 1024 characters).
Expand All @@ -50,4 +50,4 @@
*/
const Source = {
// This is for documentation. Actual contents will be loaded by gRPC.
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
* standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
* with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://cloud.google.com
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
* ) to obtain a formatter capable of generating timestamps in this format.
* 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.
*
* @property {number} seconds
* Represents seconds of UTC time since Unix epoch
Expand Down
14 changes: 14 additions & 0 deletions packages/google-cloud-securitycenter/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@
templates = common_templates.node_library()
s.copy(templates)

s.replace('src/v1beta1/doc/google/cloud/securitycenter/v1beta1/doc_source.js',
r"\[\\p\{L\}\\p\{N\}\]\(https:\/\/cloud\.google\.com\{\\p\{L\}\\p\{N\}_- \]\{0\,30\}\[\\p\{L\}\\p\{N\}\]\)\?",
r"`\[\p{L}\p{N}]({\p{L}\p{N}_- ]{0,30}[\p{L}\p{N}])?`")

# [START fix-dead-link]
s.replace('**/doc/google/protobuf/doc_timestamp.js',
'https:\/\/cloud\.google\.com[\s\*]*http:\/\/(.*)[\s\*]*\)',
r"https://\1)")

s.replace('**/doc/google/protobuf/doc_timestamp.js',
'toISOString\]',
'toISOString)')
# [END fix-dead-link]

# Node.js specific cleanup
subprocess.run(['npm', 'install'])
subprocess.run(['npm', 'run', 'fix'])

0 comments on commit 13e94c7

Please sign in to comment.