Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build!: upgrade to gts@2 #2062

Merged
merged 3 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 0 additions & 15 deletions .eslintrc.yml

This file was deleted.

21 changes: 8 additions & 13 deletions .jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,13 @@ module.exports = {
template: './node_modules/jsdoc-fresh',
recurse: true,
verbose: true,
destination: './docs/'
destination: './docs/',
},
plugins: [
'plugins/markdown',
'jsdoc-region-tag'
],
plugins: ['plugins/markdown', 'jsdoc-region-tag'],
source: {
excludePattern: '(^|\\/|\\\\)[._]',
include: [
'src',
],
includePattern: '\\.js$'
include: ['src'],
includePattern: '\\.js$',
},
templates: {
copyright: 'Copyright 2019 Google, LLC.',
Expand All @@ -42,10 +37,10 @@ module.exports = {
systemName: 'googleapis',
theme: 'lumen',
default: {
outputSourceFiles: false
}
outputSourceFiles: false,
},
},
markdown: {
idInHeadings: true
}
idInHeadings: true,
},
};
10 changes: 5 additions & 5 deletions .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
const config = {
"enable-source-maps": true,
"throw-deprecation": true,
"timeout": 10000
}
'enable-source-maps': true,
'throw-deprecation': true,
timeout: 10000,
};
if (process.env.MOCHA_THROW_DEPRECATION === 'false') {
delete config['throw-deprecation'];
}
Expand All @@ -25,4 +25,4 @@ if (process.env.MOCHA_REPORTER) {
if (process.env.MOCHA_REPORTER_OUTPUT) {
config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`;
}
module.exports = config
module.exports = config;
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
// limitations under the License.

module.exports = {
...require('gts/.prettierrc.json')
}
...require('gts/.prettierrc.json'),
};
38 changes: 16 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "googleapis",
"version": "49.0.0",
"repository": "googleapis/google-api-nodejs-client",
"license": "Apache-2.0",
"dependencies": {
"google-auth-library": "^6.0.0",
"googleapis-common": "^4.0.0"
"description": "Google APIs Client Library for Node.js",
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"engines": {
"node": ">=10"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is breaking right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I know, we do majors all the time anyway. But still.

},
"files": [
"build/src",
"!build/src/**/*.map"
],
"repository": "googleapis/google-api-nodejs-client",
"name": "googleapis",
"version": "49.0.0",
"scripts": {
"pretest": "npm run compile",
"prepare": "npm run compile",
Expand All @@ -19,11 +21,11 @@
"docs": "node build/src/generator/docs",
"system-test": "mocha build/system-test",
"samples-test": "cd samples && npm link ../ && pwd && npm test",
"lint": "gts check && eslint 'samples/**/*.js'",
"lint": "gts check",
"compile": "tsc -p .",
"build-tools": "tsc -p tsconfig.tools.json",
"clean": "gts clean",
"fix": "eslint --fix '**/*.js' && gts fix",
"fix": "gts fix",
"pregenerate": "npm run build-tools",
"generate": "node build/src/generator/generate.js",
"postgenerate": "npm run fix",
Expand All @@ -40,15 +42,12 @@
"client",
"client library"
],
"description": "Google APIs Client Library for Node.js",
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"engines": {
"node": ">=10"
"dependencies": {
"google-auth-library": "^6.0.0",
"googleapis-common": "^4.1.0"
},
"devDependencies": {
"@compodoc/compodoc": "^1.1.10",
"@types/chai": "^4.1.7",
"@types/execa": "^0.9.0",
"@types/minimist": "^1.2.0",
"@types/mkdirp": "^1.0.0",
Expand All @@ -61,16 +60,11 @@
"@types/rimraf": "^3.0.0",
"@types/tmp": "^0.1.0",
"@types/url-template": "^2.0.28",
"assert-rejects": "^1.0.0",
"c8": "^7.0.0",
"chai": "^4.2.0",
"codecov": "^3.4.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.0",
"execa": "^4.0.0",
"gts": "^1.1.0",
"gaxios": "^3.0.3",
"gts": "^2.0.0",
"js-green-licenses": "^1.0.0",
"linkinator": "^2.0.0",
"minimist": "^1.2.5",
Expand All @@ -85,6 +79,6 @@
"rimraf": "^3.0.0",
"server-destroy": "^1.0.1",
"tmp": "^0.2.0",
"typescript": "3.6.4"
"typescript": "^3.8.3"
}
}
5 changes: 1 addition & 4 deletions samples/analyticsReporting/batchGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ async function runSample() {
// if invoked directly (not tests), authenticate and run the samples
if (module === require.main) {
const scopes = ['https://www.googleapis.com/auth/analytics'];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

// export functions for testing purposes
Expand Down
5 changes: 1 addition & 4 deletions samples/blogger/blogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ const nconf = require('nconf');
const path = require('path');

// Ex: node blogger.js --api_key "YOUR API KEY"
nconf
.argv()
.env()
.file(path.join(__dirname, 'config.json'));
nconf.argv().env().file(path.join(__dirname, 'config.json'));

blogger.blogs.get(
{
Expand Down
5 changes: 1 addition & 4 deletions samples/blogger/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ async function runSample() {

if (module === require.main) {
const scopes = ['https://www.googleapis.com/auth/blogger'];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions samples/drive/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ async function runSample() {
// if invoked directly (not tests), authenticate and run the samples
if (module === require.main) {
const scopes = ['https://www.googleapis.com/auth/drive.readonly'];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

// export functions for testing purposes
Expand Down
5 changes: 1 addition & 4 deletions samples/drive/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ async function runSample(query) {

if (module === require.main) {
const scopes = ['https://www.googleapis.com/auth/drive.metadata.readonly'];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions samples/gmail/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ async function runSample() {

if (module === require.main) {
const scopes = ['https://www.googleapis.com/auth/gmail.readonly'];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions samples/gmail/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ const scopes = [
];

if (module === require.main) {
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

module.exports = {
Expand Down
7 changes: 2 additions & 5 deletions samples/gmail/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function runSample() {
userId: 'me',
requestBody: {
// Replace with `projects/${PROJECT_ID}/topics/${TOPIC_NAME}`
topicName: `projects/el-gato/topics/gmail`,
topicName: 'projects/el-gato/topics/gmail',
},
});
console.log(res.data);
Expand All @@ -50,10 +50,7 @@ const scopes = [
];

if (module === require.main) {
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the old formatting more :) Maybe async/await here?

}

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions samples/jobs/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ if (module === require.main) {
'https://www.googleapis.com/auth/jobs',
'https://www.googleapis.com/auth/cloud-platform',
];
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions samples/mirror/mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,4 @@ const scopes = [
'https://www.googleapis.com/auth/glass.location',
];

sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
5 changes: 1 addition & 4 deletions samples/multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ const plus = google.plus('v1');
const nconf = require('nconf');
const path = require('path');

nconf
.argv()
.env()
.file(path.join(__dirname, 'config.json'));
nconf.argv().env().file(path.join(__dirname, 'config.json'));

// PUT your API key here or this example will return errors
// To learn more about API keys, please see:
Expand Down
5 changes: 1 addition & 4 deletions samples/people/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,5 @@ async function runSample() {
const scopes = ['https://www.googleapis.com/auth/contacts'];

if (module === require.main) {
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}
5 changes: 1 addition & 4 deletions samples/people/me.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,5 @@ const scopes = [
];

if (module === require.main) {
sampleClient
.authenticate(scopes)
.then(runSample)
.catch(console.error);
sampleClient.authenticate(scopes).then(runSample).catch(console.error);
}
6 changes: 3 additions & 3 deletions samples/test/test.compute.samples.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019, Google, LLC.
// Copyright 2019 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
Expand All @@ -13,13 +13,13 @@

'use strict';

const {assert} = require('chai');
const assert = require('assert');
const execa = require('execa');
const {describe, it} = require('mocha');

describe('Compute samples', () => {
it('should list all the VMs', async () => {
const res = execa.sync('node compute/listVMs.js', {shell: true});
assert.match(res.stdout, /VMs:/);
assert.ok(/VMs:/.test(res.stdout));
});
});
4 changes: 1 addition & 3 deletions samples/test/test.samples.analyticsReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ describe('analyticsReporting samples', () => {
});

it('should batchGet', async () => {
const scope = nock(baseUrl)
.post(`/v4/reports:batchGet`)
.reply(200, {});
const scope = nock(baseUrl).post('/v4/reports:batchGet').reply(200, {});
const data = await samples.batchGet.runSample();
assert(data);
scope.done();
Expand Down
2 changes: 1 addition & 1 deletion samples/test/test.samples.blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('blogger samples', () => {

it('should insert a blog post', async () => {
const scope = nock(baseUrl)
.post(`/v3/blogs/4340475495955554224/posts`)
.post('/v3/blogs/4340475495955554224/posts')
.reply(200, {});
const data = await samples.post.runSample();
assert(data);
Expand Down
2 changes: 1 addition & 1 deletion samples/test/test.samples.customsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('customsearch samples', () => {

it('should search', async () => {
const scope = nock(baseUrl)
.get(`/customsearch/v1?cx=cx&q=q`)
.get('/customsearch/v1?cx=cx&q=q')
.reply(200, {});
const options = {cx: 'cx', q: 'q', auth: 'key'};
const data = await samples.list.runSample(options);
Expand Down