Skip to content

Commit d381556

Browse files
Repo migration (#4)
* Add repo tools config. * Add cloud repo tools dev dep. * Add config to cloud repo tools. * npm run generate-scaffolding * Generate a samples readme. * Add .mailmap and regenerate scaffolding. * New auto-gen layer behind datastore. * Add JSDoc. * Add docs command. * Add lint and prettier commands. * Add ESLint and prettier * npm run prettier * Use GAPIC. (#1) * Make the linter happy. * Fix jsdocs and regenerate scaffolding. (#2) * Support TransactionOptions. (#3) * setting up CI * dummy change to trigger circleci build * prettier, lint * more coverage for unit tests * prettier and lint * sorted new tests in alphabetical order * test changes * add GCLOUD_PROJECT to circleci conf
1 parent 6cb2e0c commit d381556

File tree

110 files changed

+5742
-10120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+5742
-10120
lines changed

.appveyor.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
environment:
2+
matrix:
3+
- nodejs_version: 8
4+
5+
install:
6+
- ps: Install-Product node $env:nodejs_version
7+
- npm install -g npm # Force using the latest npm to get dedupe during install
8+
- set PATH=%APPDATA%\npm;%PATH%
9+
- npm install --force --ignore-scripts
10+
11+
test_script:
12+
- node --version
13+
- npm --version
14+
- npm rebuild
15+
- npm test
16+
17+
build: off
18+
19+
matrix:
20+
fast_finish: true

.circleci/config.yml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
---
2+
# "Include" for unit tests definition.
3+
unit_tests: &unit_tests
4+
steps:
5+
- checkout
6+
- run:
7+
name: Install modules and dependencies.
8+
command: npm install
9+
- run:
10+
name: Run unit tests.
11+
command: npm test
12+
- run:
13+
name: Submit coverage data to codecov.
14+
command: node_modules/.bin/codecov
15+
when: always
16+
17+
version: 2.0
18+
workflows:
19+
version: 2
20+
tests:
21+
jobs:
22+
- node4:
23+
filters:
24+
tags:
25+
only: /.*/
26+
- node6:
27+
filters:
28+
tags:
29+
only: /.*/
30+
- node7:
31+
filters:
32+
tags:
33+
only: /.*/
34+
- node8:
35+
filters:
36+
tags:
37+
only: /.*/
38+
- node9:
39+
filters:
40+
tags:
41+
only: /.*/
42+
- lint:
43+
requires:
44+
- node4
45+
- node6
46+
- node7
47+
- node8
48+
- node9
49+
filters:
50+
tags:
51+
only: /.*/
52+
- docs:
53+
requires:
54+
- node4
55+
- node6
56+
- node7
57+
- node8
58+
- node9
59+
filters:
60+
tags:
61+
only: /.*/
62+
- system_tests:
63+
requires:
64+
- lint
65+
- docs
66+
filters:
67+
branches:
68+
only: master
69+
tags:
70+
only: /^v[\d.]+$/
71+
- sample_tests:
72+
requires:
73+
- lint
74+
- docs
75+
filters:
76+
branches:
77+
only: master
78+
tags:
79+
only: /^v[\d.]+$/
80+
- publish_npm:
81+
requires:
82+
- system_tests
83+
- sample_tests
84+
filters:
85+
branches:
86+
ignore: /.*/
87+
tags:
88+
only: /^v[\d.]+$/
89+
90+
jobs:
91+
node4:
92+
docker:
93+
- image: node:4
94+
steps:
95+
- checkout
96+
- run:
97+
name: Install modules and dependencies.
98+
command: npm install --unsafe-perm
99+
- run:
100+
name: Run unit tests.
101+
command: npm test
102+
- run:
103+
name: Submit coverage data to codecov.
104+
command: node_modules/.bin/codecov
105+
when: always
106+
node6:
107+
docker:
108+
- image: node:6
109+
<<: *unit_tests
110+
node7:
111+
docker:
112+
- image: node:7
113+
<<: *unit_tests
114+
node8:
115+
docker:
116+
- image: node:8
117+
<<: *unit_tests
118+
node9:
119+
docker:
120+
- image: node:9
121+
<<: *unit_tests
122+
123+
lint:
124+
docker:
125+
- image: node:8
126+
steps:
127+
- checkout
128+
- run:
129+
name: Install modules and dependencies.
130+
command: |
131+
npm install
132+
npm link
133+
- run:
134+
name: Link the module being tested to the samples.
135+
command: |
136+
cd samples/
137+
npm link @google-cloud/datastore
138+
npm install
139+
cd ..
140+
- run:
141+
name: Run linting.
142+
command: npm run lint
143+
144+
docs:
145+
docker:
146+
- image: node:8
147+
steps:
148+
- checkout
149+
- run:
150+
name: Install modules and dependencies.
151+
command: npm install
152+
- run:
153+
name: Build documentation.
154+
command: npm run docs
155+
156+
sample_tests:
157+
docker:
158+
- image: node:8
159+
steps:
160+
- checkout
161+
- run:
162+
name: Decrypt credentials.
163+
command: |
164+
openssl aes-256-cbc -d -in .circleci/key.json.enc \
165+
-out .circleci/key.json \
166+
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
167+
- run:
168+
name: Install and link the module.
169+
command: |
170+
npm install
171+
npm link
172+
- run:
173+
name: Link the module being tested to the samples.
174+
command: |
175+
cd samples/
176+
npm link @google-cloud/datastore
177+
npm install
178+
cd ..
179+
- run:
180+
name: Run sample tests.
181+
command: npm run samples-test
182+
environment:
183+
GCLOUD_PROJECT: long-door-651
184+
GOOGLE_APPLICATION_CREDENTIALS: /var/datastore/.circleci/key.json
185+
- run:
186+
name: Remove unencrypted key.
187+
command: rm .circleci/key.json
188+
when: always
189+
working_directory: /var/datastore/
190+
191+
system_tests:
192+
docker:
193+
- image: node:8
194+
steps:
195+
- checkout
196+
- run:
197+
name: Decrypt credentials.
198+
command: |
199+
openssl aes-256-cbc -d -in .circleci/key.json.enc \
200+
-out .circleci/key.json \
201+
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
202+
- run:
203+
name: Install modules and dependencies.
204+
command: npm install
205+
- run:
206+
name: Run system tests.
207+
command: npm run system-test
208+
environment:
209+
GCLOUD_PROJECT: long-door-651
210+
GOOGLE_APPLICATION_CREDENTIALS: .circleci/key.json
211+
- run:
212+
name: Remove unencrypted key.
213+
command: rm .circleci/key.json
214+
when: always
215+
216+
publish_npm:
217+
docker:
218+
- image: node:8
219+
steps:
220+
- checkout
221+
- run:
222+
name: Set NPM authentication.
223+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
224+
- run:
225+
name: Publish the module to npm.
226+
command: npm publish
227+

.circleci/key.json.enc

2.31 KB
Binary file not shown.

.cloud-repo-tools.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"requiresKeyFile": true,
3+
"requiresProjectId": true,
4+
"product": "datastore",
5+
"client_reference_url": "https://cloud.google.com/nodejs/docs/reference/datastore/latest/",
6+
"release_quality": "ga",
7+
"samples": [
8+
{
9+
"id": "tasks",
10+
"name": "Tasks",
11+
"file": "tasks.js",
12+
"docs_link": "https://cloud.google.com/datastore/docs/datastore-api-tutorial",
13+
"usage": "node tasks.js --help"
14+
},
15+
{
16+
"id": "concepts",
17+
"name": "Concepts",
18+
"file": "concepts.js",
19+
"docs_link": "https://cloud.google.com/datastore/docs/concepts/entities"
20+
},
21+
{
22+
"id": "error",
23+
"name": "Errors and Error Handling",
24+
"file": "error.js",
25+
"docs_link": "https://cloud.google.com/datastore/docs/concepts/errors",
26+
"usage": {
27+
"text": "node error.js"
28+
}
29+
}
30+
]
31+
}

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/*
2+
samples/node_modules/*
3+
src/**/doc/*

.eslintrc.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
extends:
3+
- 'eslint:recommended'
4+
- 'plugin:node/recommended'
5+
- prettier
6+
plugins:
7+
- node
8+
- prettier
9+
rules:
10+
prettier/prettier: error
11+
block-scoped-var: error
12+
eqeqeq: error
13+
no-warning-comments: warn

.github/CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# How to become a contributor and submit your own code
2+
3+
**Table of contents**
4+
5+
* [Contributor License Agreements](#contributor-license-agreements)
6+
* [Contributing a patch](#contributing-a-patch)
7+
* [Running the tests](#running-the-tests)
8+
* [Releasing the library](#releasing-the-library)
9+
10+
## Contributor License Agreements
11+
12+
We'd love to accept your sample apps and patches! Before we can take them, we
13+
have to jump a couple of legal hurdles.
14+
15+
Please fill out either the individual or corporate Contributor License Agreement
16+
(CLA).
17+
18+
* If you are an individual writing original source code and you're sure you
19+
own the intellectual property, then you'll need to sign an [individual CLA]
20+
(https://developers.google.com/open-source/cla/individual).
21+
* If you work for a company that wants to allow you to contribute your work,
22+
then you'll need to sign a [corporate CLA]
23+
(https://developers.google.com/open-source/cla/corporate).
24+
25+
Follow either of the two links above to access the appropriate CLA and
26+
instructions for how to sign and return it. Once we receive it, we'll be able to
27+
accept your pull requests.
28+
29+
## Contributing A Patch
30+
31+
1. Submit an issue describing your proposed change to the repo in question.
32+
1. The repo owner will respond to your issue promptly.
33+
1. If your proposed change is accepted, and you haven't already done so, sign a
34+
Contributor License Agreement (see details above).
35+
1. Fork the desired repo, develop and test your code changes.
36+
1. Ensure that your code adheres to the existing style in the code to which
37+
you are contributing.
38+
1. Ensure that your code has an appropriate set of tests which all pass.
39+
1. Submit a pull request.
40+
41+
## Running the tests
42+
43+
1. [Prepare your environment for Node.js setup][setup].
44+
45+
1. Install dependencies:
46+
47+
npm install
48+
49+
1. Run the tests:
50+
51+
npm test
52+
53+
[setup]: https://cloud.google.com/nodejs/docs/setup

.github/ISSUE_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Thanks for stopping by to let us know something could be better!
2+
3+
Please run down the following list and make sure you've tried the usual "quick
4+
fixes":
5+
6+
- Search the issues already opened: https://github.com/googleapis/nodejs-datastore/issues
7+
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
8+
- Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
9+
- Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
10+
11+
If you are still having issues, please be sure to include as much information as
12+
possible:
13+
14+
#### Environment details
15+
16+
- OS:
17+
- Node.js version:
18+
- npm version:
19+
- @google-cloud/datastore version:
20+
21+
#### Steps to reproduce
22+
23+
1. ???
24+
2. ???
25+
26+
Following these steps will guarantee the quickest resolution possible.
27+
28+
Thanks!

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for discussion)
2+
3+
- [ ] Tests and linter pass
4+
- [ ] Code coverage does not decrease (if any source code was changed)
5+
- [ ] Appropriate docs were updated (if necessary)

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/*.log
2+
**/node_modules
3+
.coverage
4+
.nyc_output
5+
docs/
6+
out/
7+
system-test/secrets.js
8+
system-test/*key.json
9+
*.lock
10+
*-lock.js*

0 commit comments

Comments
 (0)