Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 4116f81

Browse files
build!: drop node8 and convert to TypeScript (#888)
BREAKING CHANGE: drop Node.js 8 support. * initial commit * after synthtool * fixed imports * compile works * feat!: updated generator * tests pass * make it work after merge * fix .jsdoc.js * review feedback * review feedback
1 parent e6b4af6 commit 4116f81

108 files changed

Lines changed: 39503 additions & 62562 deletions

File tree

Some content is hidden

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

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/gts"
3+
}

.eslintrc.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [8, 10, 12, 13]
12+
node: [10, 12, 13]
1313
steps:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-node@v1

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
**/*.log
22
**/node_modules
33
.coverage
4+
coverage
45
.nyc_output
56
docs/
67
out/
@@ -10,7 +11,4 @@ system-test/*key.json
1011
*.lock
1112
.DS_Store
1213
package-lock.json
13-
.vscode
14-
yarn.lock
1514
__pycache__
16-
.idea

.jsdoc.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
//
15+
// ** This file is automatically generated by gapic-generator-typescript. **
16+
// ** https://github.com/googleapis/gapic-generator-typescript **
17+
// ** All changes to this file may be overwritten. **
1518

1619
'use strict';
1720

@@ -31,18 +34,19 @@ module.exports = {
3134
source: {
3235
excludePattern: '(^|\\/|\\\\)[._]',
3336
include: [
34-
'build/src'
37+
'build/src',
38+
'protos'
3539
],
3640
includePattern: '\\.js$'
3741
},
3842
templates: {
39-
copyright: 'Copyright 2019 Google, LLC.',
43+
copyright: 'Copyright 2020 Google LLC',
4044
includeDate: false,
4145
sourceFiles: false,
4246
systemName: '@google-cloud/spanner',
4347
theme: 'lumen',
4448
default: {
45-
"outputSourceFiles": false
49+
outputSourceFiles: false
4650
}
4751
},
4852
markdown: {

.prettierrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/browser.js renamed to .prettierrc.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// https://www.apache.org/licenses/LICENSE-2.0
7+
// https://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
'use strict';
16-
17-
// Set a flag that we are running in a browser bundle.
18-
global.isBrowser = true;
19-
20-
// Re-export all exports from ./index.js.
21-
module.exports = require('./index');
15+
module.exports = {
16+
...require('gts/.prettierrc.json')
17+
}

bin/benchwrapper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function Read(call, callback) {
7272
function Insert(call, callback) {
7373
const instance = spannerClient.instance('someinstance');
7474
const database = instance.database('somedatabase');
75-
database.runTransaction(function(err, transaction) {
75+
database.runTransaction((err, transaction) => {
7676
if (err) {
7777
callback(err);
7878
return;
@@ -83,7 +83,7 @@ function Insert(call, callback) {
8383
age: user.age,
8484
});
8585
});
86-
transaction.commit(function(err) {
86+
transaction.commit(err => {
8787
if (err) {
8888
callback(err);
8989
} else {
@@ -116,7 +116,7 @@ function Update(call, callback) {
116116
}
117117
// Iterate over all rowCounts.
118118
rowCounts.forEach(() => {});
119-
transaction.commit(function(err) {
119+
transaction.commit(err => {
120120
if (err) {
121121
callback(err);
122122
} else {

package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
"license": "Apache-2.0",
66
"author": "Google Inc.",
77
"engines": {
8-
"node": ">=8.10.0"
8+
"node": ">=10"
99
},
1010
"repository": "googleapis/nodejs-spanner",
1111
"main": "./build/src/index.js",
1212
"types": "./build/src/index.d.ts",
1313
"files": [
14-
"build/proto",
1514
"build/protos",
1615
"build/src",
1716
"!build/src/**/*.map"
@@ -30,22 +29,19 @@
3029
"scripts": {
3130
"docs": "jsdoc -c .jsdoc.js",
3231
"predocs": "npm run compile",
33-
"lint": "eslint samples/ && gts check",
32+
"lint": "gts check",
3433
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
3534
"system-test": "mocha build/system-test --timeout 600000",
3635
"cleanup": "mocha scripts/cleanup.js --timeout 30000",
3736
"test": "c8 mocha build/test build/test/common",
3837
"ycsb": "node ./benchmark/ycsb.js run -P ./benchmark/workloada -p table=usertable -p cloudspanner.instance=ycsb-instance -p operationcount=100 -p cloudspanner.database=ycsb",
39-
"fix": "gts fix && eslint --fix '**/*.js'",
38+
"fix": "gts fix",
4039
"clean": "gts clean",
41-
"compile": "tsc -p . && cp -r src/v1 build/src && cp -r protos build && cp -r proto build && cp test/*.js build/test",
40+
"compile": "tsc -p . && cp -r protos build",
4241
"prepare": "npm run compile",
4342
"pretest": "npm run compile",
4443
"presystem-test": "npm run compile",
45-
"proto": "npm run proto:spanner && npm run proto:spanner_instance_admin && npm run proto:spanner_database_admin",
46-
"proto:spanner": "mkdir -p proto && pbjs -t static-module -w commonjs -p node_modules/google-proto-files google/spanner/v1/spanner.proto | pbts -o proto/spanner.d.ts -",
47-
"proto:spanner_instance_admin": "pbjs -t static-module -w commonjs -p node_modules/google-proto-files google/spanner/admin/instance/v1/spanner_instance_admin.proto | pbts -o proto/spanner_instance_admin.d.ts -",
48-
"proto:spanner_database_admin": "pbjs -t static-module -w commonjs -p node_modules/google-proto-files google/spanner/admin/database/v1/spanner_database_admin.proto | pbts -o proto/spanner_database_admin.d.ts -",
44+
"proto": "compileProtos src",
4945
"docs-test": "linkinator docs",
5046
"predocs-test": "npm run docs",
5147
"benchwrapper": "node bin/benchwrapper.js",
@@ -62,7 +58,8 @@
6258
"checkpoint-stream": "^0.1.1",
6359
"events-intercept": "^2.0.0",
6460
"extend": "^3.0.2",
65-
"google-gax": "^1.7.5",
61+
"google-auth-library": "^6.0.0",
62+
"google-gax": "^2.0.2",
6663
"grpc": "^1.21.1",
6764
"grpc-gcp": "^0.1.1",
6865
"is": "^3.2.1",
@@ -95,25 +92,27 @@
9592
"codecov": "^3.0.2",
9693
"concat-stream": "^2.0.0",
9794
"dedent": "^0.7.0",
98-
"eslint": "^6.0.0",
99-
"eslint-config-prettier": "^6.0.0",
100-
"eslint-plugin-node": "^11.0.0",
101-
"eslint-plugin-prettier": "^3.0.0",
102-
"gts": "^1.0.0",
95+
"duplexify": "^4.1.1",
96+
"execa": "^4.0.0",
97+
"gts": "2.0.0-alpha.9",
10398
"jsdoc": "^3.6.2",
10499
"jsdoc-fresh": "^1.0.1",
105100
"jsdoc-region-tag": "^1.0.2",
106101
"linkinator": "^2.0.0",
107102
"lodash.random": "^3.2.0",
108103
"mocha": "^7.0.0",
109104
"mv": "^2.1.1",
105+
"ncp": "^2.0.0",
110106
"p-limit": "^2.2.0",
111107
"prettier": "^1.13.7",
112108
"proxyquire": "^2.0.1",
109+
"retry-request": "^4.1.1",
113110
"sinon": "^9.0.0",
114111
"stats-lite": "^2.1.1",
112+
"teeny-request": "^6.0.3",
115113
"time-span": "^3.0.0",
116-
"typescript": "3.6.4",
114+
"tmp": "^0.1.0",
115+
"typescript": "^3.8.3",
117116
"uuid": "^7.0.0",
118117
"yargs": "^15.0.0"
119118
}

0 commit comments

Comments
 (0)