From 5f1940355f2c38eaa76d8bcc5b97400c8102b09c Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 14 May 2019 22:53:26 -0700 Subject: [PATCH] refactor: use repo-metadata to generate readme --- .clang-format | 3 -- .cloud-repo-tools.json | 22 ------------- .gitignore | 3 +- .repo-metadata.json | 12 +++++++ README.md | 73 ++++++++++++++++++++++++++---------------- package.json | 44 ++++++++++++------------- samples/README.md | 69 ++++++++++++++++++++++++++------------- samples/package.json | 1 - synth.metadata | 6 ++-- 9 files changed, 130 insertions(+), 103 deletions(-) delete mode 100644 .clang-format delete mode 100644 .cloud-repo-tools.json create mode 100644 .repo-metadata.json diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 7d6cf97e1..000000000 --- a/.clang-format +++ /dev/null @@ -1,3 +0,0 @@ -Language: JavaScript -BasedOnStyle: Google -ColumnLimit: 80 \ No newline at end of file diff --git a/.cloud-repo-tools.json b/.cloud-repo-tools.json deleted file mode 100644 index a16d6ff55..000000000 --- a/.cloud-repo-tools.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "requiresKeyFile": true, - "requiresProjectId": true, - "product": "datastore", - "client_reference_url": "https://cloud.google.com/nodejs/docs/reference/datastore/latest/", - "release_quality": "ga", - "samples": [ - { - "id": "tasks", - "name": "Tasks", - "file": "tasks.js", - "docs_link": "https://cloud.google.com/datastore/docs/datastore-api-tutorial", - "usage": "node tasks.js --help" - }, - { - "id": "concepts", - "name": "Concepts", - "file": "concepts.js", - "docs_link": "https://cloud.google.com/datastore/docs/concepts/entities" - } - ] -} diff --git a/.gitignore b/.gitignore index 5ee54dbfb..e869cd90b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ system-test/secrets.js system-test/*key.json *.lock .DS_Store -google-cloud-logging-winston-*.tgz -google-cloud-logging-bunyan-*.tgz +__pycache__ .vscode package-lock.json diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 000000000..dd40ada73 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,12 @@ +{ + "name": "datastore", + "name_pretty": "Google Cloud Datastore", + "product_documentation": "https://cloud.google.com/datastore", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/datastore/latest/", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559768", + "release_level": "ga", + "language": "nodejs", + "repo": "googleapis/nodejs-datastore", + "distribution_name": "@google-cloud/datastore", + "api_id": "datastore.googleapis.com" +} diff --git a/README.md b/README.md index 15032ab23..54be5fc59 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,57 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `npm run generate-scaffolding`." +[//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo # [Google Cloud Datastore: Node.js Client](https://github.com/googleapis/nodejs-datastore) -[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/datastore.svg)](https://www.npmjs.org/package/@google-cloud/datastore) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-datastore/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-datastore) -[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects. -* [Using the client library](#using-the-client-library) + +Cloud Datastore Client Library for Node.js + + +* [Google Cloud Datastore Node.js Client API Reference][client-docs] +* [Google Cloud Datastore Documentation][product-docs] +* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + * [Using the client library](#using-the-client-library) * [Samples](#samples) * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) -## Using the client library +## Quickstart -1. [Select or create a Cloud Platform project][projects]. - -1. [Enable billing for your project][billing]. +### Before you begin +1. [Select or create a Cloud Platform project][projects]. 1. [Enable the Google Cloud Datastore API][enable_api]. - 1. [Set up authentication with a service account][auth] so you can access the API from your local workstation. -1. Install the client library: +### Installing the client library + +```bash +npm install @google-cloud/datastore +``` - npm install --save @google-cloud/datastore -1. Try an example: +### Using the client library ```javascript // Imports the Google Cloud client library @@ -67,8 +86,11 @@ async function quickStart() { console.log(`Saved ${task.key.name}: ${task.data.description}`); } quickStart().catch(console.error); + ``` + + ## Samples Samples are in the [`samples/`](https://github.com/googleapis/nodejs-datastore/tree/master/samples) directory. The samples' `README.md` @@ -76,22 +98,30 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Tasks | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) | | Concepts | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/concepts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Tasks | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) | + -The [Cloud Datastore Node.js Client API Reference][client-docs] documentation + +The [Google Cloud Datastore Node.js Client API Reference][client-docs] documentation also contains samples. ## Versioning This library follows [Semantic Versioning](http://semver.org/). + This library is considered to be **General Availability (GA)**. This means it is stable; the code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against **GA** libraries are addressed with the highest priority. + + + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages @@ -106,21 +136,10 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-datastore/blob/master/LICENSE) -## What's Next - -* [Cloud Datastore Documentation][product-docs] -* [Cloud Datastore Node.js Client API Reference][client-docs] -* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore) - -Read more about the client libraries for Cloud APIs, including the older -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/datastore/latest/ -[product-docs]: https://cloud.google.com/datastore/docs +[product-docs]: https://cloud.google.com/datastore [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 [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=datastore.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/package.json b/package.json index 713258217..5e4c33e0a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ ], "scripts": { "docs": "jsdoc -c .jsdoc.js", - "generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json", "lint": "gts check && eslint '**/*.js'", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "test": "nyc mocha build/test", @@ -51,49 +50,48 @@ "@grpc/grpc-js": "^0.4.0", "@types/duplexify": "^3.6.0", "@types/long": "^4.0.0", - "arrify": "^2.0.0", + "arrify": "^2.0.1", "concat-stream": "^2.0.0", - "extend": "^3.0.1", + "extend": "^3.0.2", "google-auth-library": "^4.0.0", "google-gax": "^1.0.0", - "is": "^3.2.1", + "is": "^3.3.0", "lodash.merge": "^4.6.1", "split-array-stream": "^2.0.0", - "stream-events": "^1.0.4", - "through2": "^3.0.0" + "stream-events": "^1.0.5", + "through2": "^3.0.1" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0", - "@types/extend": "^3.0.0", + "@types/extend": "^3.0.1", "@types/is": "0.0.21", - "@types/mocha": "^5.2.5", + "@types/mocha": "^5.2.6", "@types/mv": "^2.1.0", "@types/ncp": "^2.0.1", "@types/proxyquire": "^1.3.28", - "@types/sinon": "^7.0.2", + "@types/sinon": "^7.0.11", "@types/through2": "^2.0.34", "@types/tmp": "0.1.0", "assert-rejects": "^1.0.0", - "codecov": "^3.0.2", - "eslint": "^5.0.0", - "eslint-config-prettier": "^4.0.0", - "eslint-plugin-node": "^9.0.0", - "eslint-plugin-prettier": "^3.0.0", + "codecov": "^3.5.0", + "eslint": "^5.16.0", + "eslint-config-prettier": "^4.2.0", + "eslint-plugin-node": "^9.0.1", + "eslint-plugin-prettier": "^3.1.0", "google-proto-files": "^1.0.0", "gts": "^1.0.0", "intelli-espower-loader": "^1.0.1", "jsdoc": "^3.6.2", "jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git", - "linkinator": "^1.1.2", - "mocha": "^6.0.0", + "linkinator": "^1.4.2", + "mocha": "^6.1.4", "mv": "^2.1.1", "ncp": "^2.0.0", - "nyc": "^14.0.0", - "power-assert": "^1.5.0", - "prettier": "^1.13.5", - "proxyquire": "^2.0.1", - "sinon": "^7.0.0", + "nyc": "^14.1.1", + "power-assert": "^1.6.1", + "prettier": "^1.17.1", + "proxyquire": "^2.1.0", + "sinon": "^7.3.2", "tmp": "0.1.0", - "typescript": "~3.4.0" + "typescript": "~3.4.5" } } diff --git a/samples/README.md b/samples/README.md index 75f28de94..25d73ab13 100644 --- a/samples/README.md +++ b/samples/README.md @@ -1,55 +1,80 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `npm run generate-scaffolding`." +[//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# Google Cloud Datastore: Node.js Samples +# [Google Cloud Datastore: Node.js Samples](https://github.com/googleapis/nodejs-datastore) [![Open in Cloud Shell][shell_img]][shell_link] -[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects. + ## Table of Contents * [Before you begin](#before-you-begin) * [Samples](#samples) - * [Tasks](#tasks) * [Concepts](#concepts) - * [Errors and Error Handling](#errors-and-error-handling) + * [Quickstart](#quickstart) + * [Tasks](#tasks) ## Before you begin -Before running the samples, make sure you've followed the steps in the -[Before you begin section](../README.md#before-you-begin) of the client -library's README. +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-datastore#using-the-client-library). ## Samples + + +### Concepts + +View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/concepts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md) + +__Usage:__ + + +`node concepts.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node quickstart.js` + + +----- + + + + ### Tasks -View the [source code][tasks_0_code]. +View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) -__Usage:__ `node tasks.js --help` -[tasks_0_docs]: https://cloud.google.com/datastore/docs/datastore-api-tutorial -[tasks_0_code]: tasks.js +__Usage:__ -### Concepts -View the [source code][concepts_1_code]. +`node tasks.js` -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md)[concepts_1_docs]: https://cloud.google.com/datastore/docs/concepts/entities -[concepts_1_code]: concepts.js -### Errors and Error Handling -View the [source code][error_2_code]. -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/error.js,samples/README.md) -__Usage:__ `node error.js` -[error_2_docs]: https://cloud.google.com/datastore/docs/concepts/errors -[error_2_code]: error.js [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/datastore \ No newline at end of file diff --git a/samples/package.json b/samples/package.json index 8b43fd1f1..8ddb94516 100644 --- a/samples/package.json +++ b/samples/package.json @@ -1,6 +1,5 @@ { "name": "nodejs-docs-samples-datastore", - "version": "0.0.1", "private": true, "license": "Apache-2.0", "author": "Google Inc.", diff --git a/synth.metadata b/synth.metadata index 1a538b3ff..451bcfa10 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-05-10T12:01:53.705538Z", + "updateTime": "2019-05-15T05:46:46.853335Z", "sources": [ { "generator": { @@ -12,8 +12,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "07883be5bf3c3233095e99d8e92b8094f5d7084a", - "internalRef": "247530843" + "sha": "275cdfcdc3188a60456f43acd139b8cc037379f4", + "internalRef": "248217300" } }, {