Skip to content

Commit

Permalink
feat!: drop node8 support, support for async iterators (#568)
Browse files Browse the repository at this point in the history
* feat!: drop node8 support, support for async iterators

BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM.

New feature: methods with pagination now support async iteration.

* fix tests & linter

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
Co-authored-by: Xiaozhen Liu <xiaozhenliu@google.com>
  • Loading branch information
3 people authored Apr 1, 2020
1 parent 0d33062 commit dc5d119
Show file tree
Hide file tree
Showing 39 changed files with 16,566 additions and 6,728 deletions.
3 changes: 3 additions & 0 deletions packages/google-cloud-vision/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
15 changes: 0 additions & 15 deletions packages/google-cloud-vision/.eslintrc.yml

This file was deleted.

8 changes: 0 additions & 8 deletions packages/google-cloud-vision/.prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions packages/google-cloud-vision/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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.
// 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.

module.exports = {
...require('gts/.prettierrc.json')
}
17 changes: 9 additions & 8 deletions packages/google-cloud-vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"author": "Google Inc",
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},
"repository": "googleapis/nodejs-vision",
"main": "build/src/index.js",
Expand Down Expand Up @@ -44,35 +44,36 @@
},
"dependencies": {
"@google-cloud/promisify": "^1.0.4",
"google-gax": "^1.14.1",
"google-gax": "^2.0.1",
"is": "^3.3.0"
},
"devDependencies": {
"@google-cloud/storage": "^4.3.1",
"@types/is": "0.0.21",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.4",
"@types/is": "0.0.21",
"@types/sinon": "^9.0.0",
"@types/uuid": "^3.4.7",
"c8": "^7.1.0",
"@google-cloud/storage": "^4.3.1",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"gts": "^1.1.2",
"gts": "2.0.0-alpha.9",
"jsdoc": "^3.6.3",
"jsdoc-fresh": "^1.0.2",
"jsdoc-region-tag": "^1.0.4",
"linkinator": "^2.0.3",
"mocha": "^7.0.1",
"prettier": "^1.19.1",
"sinon": "^9.0.0",
"uuid": "^3.4.0",
"null-loader": "^3.0.0",
"pack-n-play": "^1.0.0-2",
"prettier": "^1.19.1",
"sinon": "^9.0.1",
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"typescript": "^3.8.3",
"uuid": "^3.4.0",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const {describe, it} = require('mocha');

describe('ImageAnnotatorSmokeTest', () => {
it('successfully makes a call to the service', done => {
const vision = require('../src');
// eslint-disable-next-line node/no-missing-require
const vision = require('@google-cloud/vision');

const client = new vision.v1p3beta1.ImageAnnotatorClient({
// optional auth parameters.
Expand Down
5 changes: 3 additions & 2 deletions packages/google-cloud-vision/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface FeaturesMethod {
}
interface ImprovedRequest {
image?: {source?: {filename: string}; content?: Uint8Array | string | null};
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
features?: any;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ interface VisionClient {
): void;
}

// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _requestToObject = (request: any) => {
if (is.string(request)) {
// Is this a URL or a local file?
Expand Down Expand Up @@ -353,6 +353,7 @@ export function call(apiVersion: string) {
});

const protoFilesRoot = gax.protobuf.Root.fromJSON(
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('../protos/protos.json')
);
const features = (protoFilesRoot.lookup(
Expand Down
Loading

0 comments on commit dc5d119

Please sign in to comment.