Skip to content

Commit

Permalink
feat: generate .jsdoc.js for client library (#128)
Browse files Browse the repository at this point in the history
* generate .jsdoc.js for client

* update baseline

* sort package.json dependency

* add linkinator docs test

* update baseline

* add predocs-test

* add proto types to jsdoc

* add docs-test to circleCU

* add new line

* Update config.yml
  • Loading branch information
xiaozhenliu-gg5 authored and alexander-fenster committed Nov 12, 2019
1 parent 9588ddf commit 6d23093
Show file tree
Hide file tree
Showing 17 changed files with 410 additions and 102 deletions.
16 changes: 12 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ jobs:
npm run browser-test
trap stop_showcase EXIT
- run:
name: Run unit tests, system tests, and gts fix of the generated Showcase library
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Showcase library
command: |
cd .test-out-showcase
npm install
npm test
npm run fix
npm run compile
npm run system-test
npm run docs
npm run docs-test
- run:
name: Run unit tests, system tests, and gts fix of the generated KMS library
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated KMS library
command: |
cp -r typescript/test/protos ./.test-out-keymanager
cd .test-out-keymanager
Expand All @@ -81,8 +83,10 @@ jobs:
npm run fix
npm run compile
npm run system-test
npm run docs
npm run docs-test
- run:
name: Run unit tests, system tests, and gts fix of the generated Translate library
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Translate library
command: |
cp -r typescript/test/protos ./.test-out-translate
cd .test-out-translate
Expand All @@ -91,8 +95,10 @@ jobs:
npm run fix
npm run compile
npm run system-test
npm run docs
npm run docs-test
- run:
name: Run unit tests, system tests, and gts fix of the generated Text-to-Speech library
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Text-to-Speech library
command: |
cp -r typescript/test/protos ./.test-out-texttospeech
cd .test-out-texttospeech
Expand All @@ -101,6 +107,8 @@ jobs:
npm run fix
npm run compile
npm run system-test
npm run docs
npm run docs-test
- run:
name: Run linting
command: |
Expand Down
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,48 @@
"name": "@google-cloud/gapic-generator",
"version": "0.0.1",
"description": "Google API Client Library Generator for TypeScript, written in TypeScript.",
"engines": {
"node": ">=8.13.0"
"homepage": "https://github.com/googleapis/gapic-generator-typescript#readme",
"bugs": {
"url": "https://github.com/googleapis/gapic-generator-typescript/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/gapic-generator-typescript.git"
},
"license": "Apache-2.0",
"author": "Google LLC",
"files": [
"build/src",
"pbjs-genfiles",
"templates"
],
"bin": {
"protoc-gen-typescript_gapic": "build/src/cli.js",
"gapic-generator-typescript": "build/src/start_script.js"
"gapic-generator-typescript": "build/src/start_script.js",
"protoc-gen-typescript_gapic": "build/src/cli.js"
},
"scripts": {
"baseline": "node build/tools/update-baselines.js",
"test": "c8 --reporter=lcov mocha build/test/unit",
"docker-test": "sh docker/test.sh",
"codecov": "c8 --reporter=lcov mocha build/test/unit && c8 report",
"lint": "gts check",
"clean": "gts clean",
"compile-protos": "pbjs -p protos -p node_modules/google-gax/protos -t static-module -o pbjs-genfiles/plugin.js google/protobuf/compiler/plugin.proto google/api/annotations.proto google/api/field_behavior.proto google/api/resource.proto google/api/client.proto google/longrunning/operations.proto service_config.proto && pbts pbjs-genfiles/plugin.js -o pbjs-genfiles/plugin.d.ts",
"codecov": "c8 --reporter=lcov mocha build/test/unit && c8 report",
"compile": "tsc -p . && cp -r typescript/test/protos build/test/",
"compile-protos": "pbjs -p protos -p node_modules/google-gax/protos -t static-module -o pbjs-genfiles/plugin.js google/protobuf/compiler/plugin.proto google/api/annotations.proto google/api/field_behavior.proto google/api/resource.proto google/api/client.proto google/longrunning/operations.proto service_config.proto && pbts pbjs-genfiles/plugin.js -o pbjs-genfiles/plugin.d.ts",
"docker-test": "sh docker/test.sh",
"fix": "gts fix",
"lint": "gts check",
"prepare": "npm run compile-protos && npm run compile",
"pretest": "npm run compile-protos && npm run compile"
},
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/gapic-generator-typescript.git"
"pretest": "npm run compile-protos && npm run compile",
"test": "c8 --reporter=lcov mocha build/test/unit"
},
"author": "Google LLC",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/googleapis/gapic-generator-typescript/issues"
"dependencies": {
"file-system": "^2.2.2",
"fs-extra": "^8.1.0",
"get-stdin": "^7.0.0",
"google-gax": "^1.9.0",
"nunjucks": "^3.1.3",
"object-hash": "^2.0.0",
"protobufjs": "^6.8.8",
"yargs": "^14.2.0"
},
"homepage": "https://github.com/googleapis/gapic-generator-typescript#readme",
"devDependencies": {
"@types/fs-extra": "^8.0.1",
"@types/get-stdin": "^5.0.1",
Expand All @@ -59,14 +66,7 @@
"rimraf": "^3.0.0",
"typescript": "~3.7.0"
},
"dependencies": {
"file-system": "^2.2.2",
"fs-extra": "^8.1.0",
"get-stdin": "^7.0.0",
"google-gax": "^1.9.0",
"nunjucks": "^3.1.3",
"object-hash": "^2.0.0",
"protobufjs": "^6.8.8",
"yargs": "^14.2.0"
"engines": {
"node": ">=8.13.0"
}
}
47 changes: 47 additions & 0 deletions templates/typescript_gapic/.jsdoc.js.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*!
* Copyright 2019 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

module.exports = {
opts: {
package: './package.json',
template: './node_modules/jsdoc-fresh',
recurse: true,
verbose: true,
destination: './docs/'
},
plugins: [
'plugins/markdown'
],
source: {
include: [
'build/src',
'protos'
],
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2019 Google, LLC.',
includeDate: false,
sourceFiles: false,
systemName: '{{ api.naming.name }}',
theme: 'lumen'
},
markdown: {
idInHeadings: true
}
};
7 changes: 7 additions & 0 deletions templates/typescript_gapic/linkinator.config.json.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recurse": true,
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com"
]
}
34 changes: 20 additions & 14 deletions templates/typescript_gapic/package.json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,30 @@ limitations under the License.
-#}
{
"repository": "googleapis/nodejs-{{ api.naming.productName.toKebabCase() }}",
"name": "{{ api.naming.productName.toKebabCase() }}",
"version": "0.1.0",
"author": "Google LLC",
"description": "{{ api.naming.productName }} client for Node.js",
"main": "build/src/index.js",
"repository": "googleapis/nodejs-{{ api.naming.productName.toKebabCase() }}",
"license": "Apache-2.0",
"author": "Google LLC",
"files": [
"build/src",
"build/protos"
],
"main": "build/src/index.js",
"scripts": {
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"docs": "jsdoc -c .jsdoc.js",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"predocs-test": "npm run docs",
"prepare": "npm run compile-protos && npm run compile",
"system-test": "mocha build/system-test",
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
},
Expand All @@ -37,23 +51,15 @@ limitations under the License.
"@types/tmp": "^0.1.0",
"execa": "^3.2.0",
"gts": "^1.0.0",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"linkinator": "^1.5.0",
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
},
"scripts": {
"lint": "gts check",
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"fix": "gts fix",
"prepare": "npm run compile-protos && npm run compile",
"test": "mocha build/test",
"system-test": "mocha build/system-test"
},
"license": "Apache-2.0",
"engines": {
"node": ">=8.13.0"
}
Expand Down
47 changes: 47 additions & 0 deletions typescript/test/testdata/keymanager/.jsdoc.js.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*!
* Copyright 2019 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

module.exports = {
opts: {
package: './package.json',
template: './node_modules/jsdoc-fresh',
recurse: true,
verbose: true,
destination: './docs/'
},
plugins: [
'plugins/markdown'
],
source: {
include: [
'build/src',
'protos'
],
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2019 Google, LLC.',
includeDate: false,
sourceFiles: false,
systemName: 'Kms',
theme: 'lumen'
},
markdown: {
idInHeadings: true
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recurse": true,
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com"
]
}
34 changes: 20 additions & 14 deletions typescript/test/testdata/keymanager/package.json.baseline
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
{
"repository": "googleapis/nodejs-kms",
"name": "kms",
"version": "0.1.0",
"author": "Google LLC",
"description": "Kms client for Node.js",
"main": "build/src/index.js",
"repository": "googleapis/nodejs-kms",
"license": "Apache-2.0",
"author": "Google LLC",
"files": [
"build/src",
"build/protos"
],
"main": "build/src/index.js",
"scripts": {
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"docs": "jsdoc -c .jsdoc.js",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"predocs-test": "npm run docs",
"prepare": "npm run compile-protos && npm run compile",
"system-test": "mocha build/system-test",
"test": "mocha build/test"
},
"dependencies": {
"google-gax": "^1.10.0"
},
Expand All @@ -20,23 +34,15 @@
"@types/tmp": "^0.1.0",
"execa": "^3.2.0",
"gts": "^1.0.0",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"linkinator": "^1.5.0",
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
},
"scripts": {
"lint": "gts check",
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"fix": "gts fix",
"prepare": "npm run compile-protos && npm run compile",
"test": "mocha build/test",
"system-test": "mocha build/system-test"
},
"license": "Apache-2.0",
"engines": {
"node": ">=8.13.0"
}
Expand Down

0 comments on commit 6d23093

Please sign in to comment.