Skip to content

Commit

Permalink
build!: convert to typescript (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-ji-eng committed Apr 9, 2020
1 parent 45d9880 commit 2fc68ba
Show file tree
Hide file tree
Showing 63 changed files with 37,311 additions and 49,552 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 12, 13]
node: [10, 12, 13]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
.vscode
**/package-lock.json
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
__pycache__
7 changes: 5 additions & 2 deletions .jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

Expand All @@ -37,7 +40,7 @@ module.exports = {
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2019 Google, LLC.',
copyright: 'Copyright 2020 Google LLC',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/pubsub',
Expand Down
5 changes: 5 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"enable-source-maps": true,
"throw-deprecation": true,
"timeout": 10000
}
7 changes: 4 additions & 3 deletions src/v1/doc/google/iam/v1/doc_iam_policy.js → .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
// https://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.

// Note: this file is purely for documentation. Any contents are not expected
// to be loaded as the JS file.
module.exports = {
...require('gts/.prettierrc.json')
}
33 changes: 33 additions & 0 deletions helperMethods.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* This part will be added into src/v1/key_management_service_client.ts by synth.py.
* KMS service requires IAM client for [setIamPolicy, getIamPolicy, testIamPerssion] methods.
* But we don't support it now in micro-generators for rerouting one service to another and mix them in.
* New feature request link: [https://github.com/googleapis/gapic-generator-typescript/issues/315]
*
* So this is manually written for providing methods to the KMS client.
* IamClient is created for KMS client in the constructor using src/helper.ts.
* [setIamPolicy, getIamPolicy, testIamPerssion] methods are created which is calling the corresponding methods from IamClient in `helper.ts`.
*/

getIamPolicy(
request: protos.google.iam.v1.GetIamPolicyRequest,
options: gax.CallOptions,
callback: protos.google.iam.v1.IAMPolicy.GetIamPolicyCallback
) {
return this._iamClient.getIamPolicy(request, options, callback);
}
setIamPolicy(
request: protos.google.iam.v1.SetIamPolicyRequest,
options: gax.CallOptions,
callback: protos.google.iam.v1.IAMPolicy.SetIamPolicyCallback
) {
return this._iamClient.setIamPolicy(request, options, callback);
}
testIamPermissions(
request: protos.google.iam.v1.TestIamPermissionsRequest,
options: gax.CallOptions,
callback?: protos.google.iam.v1.IAMPolicy.TestIamPermissionsCallback
) {
return this._iamClient.testIamPermissions(request, options, callback);
}
}
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"files": [
"build/proto",
"build/protos",
"build/src"
],
Expand All @@ -30,19 +29,17 @@
"scripts": {
"presystem-test": "npm run compile",
"system-test": "mocha build/system-test --timeout 600000",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"test": "c8 mocha build/test/*{,/*}.js",
"lint": "eslint '**/*.js' && gts check",
"samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../",
"test": "c8 mocha build/test",
"lint": "gts check",
"predocs": "npm run compile",
"docs": "jsdoc -c .jsdoc.js",
"fix": "eslint --fix '**/*.js' && gts fix",
"fix": "gts fix",
"clean": "gts clean",
"compile": "tsc -p . && cp -r src/v1 build/src/ && cp -r protos build/ && cp -r proto build/ && cp smoke-test/*.js build/system-test && cp test/*.js build/test",
"prepare": "npm run compile",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"prepare": "npm run compile-protos && npm run compile",
"pretest": "npm run compile",
"proto": "mkdirp proto && npm run proto:pubsub && npm run proto:iam",
"proto:pubsub": "pbjs -t static-module -w commonjs -p protos google/pubsub/v1/pubsub.proto | pbts -o proto/pubsub.d.ts -",
"proto:iam": "pbjs -t static-module -w commonjs -p protos google/iam/v1/iam_policy.proto | pbts -o proto/iam.d.ts -",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"benchwrapper": "node bin/benchwrapper.js"
Expand All @@ -58,7 +55,7 @@
"async-each": "^1.0.1",
"extend": "^3.0.2",
"google-auth-library": "^6.0.0",
"google-gax": "^1.14.2",
"google-gax": "^2.0.0",
"is-stream-ended": "^0.1.4",
"lodash.snakecase": "^4.1.1",
"p-defer": "^3.0.0",
Expand All @@ -72,6 +69,7 @@
"@types/mocha": "^7.0.0",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/node": "^12.12.30",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^9.0.0",
"@types/tmp": "^0.1.0",
Expand All @@ -92,12 +90,16 @@
"mocha": "^7.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"prettier": "^1.18.2",
"proxyquire": "^2.0.0",
"sinon": "^9.0.0",
"source-map-support": "^0.5.9",
"ts-loader": "^6.2.1",
"typescript": "3.6.4",
"uuid": "^7.0.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"yargs": "^15.0.0"
}
}

0 comments on commit 2fc68ba

Please sign in to comment.