Skip to content

Commit

Permalink
chore: modernize the samples and sample tests (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and jkwlui committed Dec 18, 2018
1 parent 83fa11c commit 0ddf1d8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
10 changes: 0 additions & 10 deletions packages/google-cloud-vision/greenkeeper.json

This file was deleted.

15 changes: 8 additions & 7 deletions packages/google-cloud-vision/samples/package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{
"name": "nodejs-docs-samples-vision",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=8"
},
"files": [
"*.js"
],
"scripts": {
"test": "mocha system-test/*.test.js --timeout 600000"
"test": "mocha system-test --timeout 600000"
},
"dependencies": {
"@google-cloud/automl": "^0.1.1",
"@google-cloud/automl": "^0.1.3",
"@google-cloud/vision": "^0.23.0",
"async": "^2.6.1",
"mathjs": "^5.0.4",
"natural": "^0.6.1",
"redis": "^2.8.0",
"yargs": "^12.0.0",
"canvas": "^2.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"@google-cloud/storage": "^2.0.0",
"chai": "^4.2.0",
"execa": "^1.0.0",
"mocha": "^5.0.0",
"uuid": "^3.2.1"
},
"optionalDependencies": {}
}
}
17 changes: 8 additions & 9 deletions packages/google-cloud-vision/samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@
'use strict';

// [START vision_quickstart]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
async function quickstart() {
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ImageAnnotatorClient();
// Creates a client
const client = new vision.ImageAnnotatorClient();

// Performs label detection on the image file
async function main() {
// Performs label detection on the image file
const [result] = await client.labelDetection('./resources/wakeupcat.jpg');
const labels = result.labelAnnotations;
console.log('Labels:');
labels.forEach(label => console.log(label.description));
}
main().catch(err => {
console.error('ERROR:', err);
});
// [END vision_quickstart]

quickstart().catch(console.error);

0 comments on commit 0ddf1d8

Please sign in to comment.