diff --git a/packages/google-cloud-resourcemanager/.eslintignore b/packages/google-cloud-resourcemanager/.eslintignore index f08b0fd1c65..2e7a5c2e7d4 100644 --- a/packages/google-cloud-resourcemanager/.eslintignore +++ b/packages/google-cloud-resourcemanager/.eslintignore @@ -1,4 +1,3 @@ -node_modules/* -samples/node_modules/* -src/**/doc/* +**/node_modules +docs/ build/ diff --git a/packages/google-cloud-resourcemanager/.jsdoc.js b/packages/google-cloud-resourcemanager/.jsdoc.js index e5ee8ae8277..730fe8d120a 100644 --- a/packages/google-cloud-resourcemanager/.jsdoc.js +++ b/packages/google-cloud-resourcemanager/.jsdoc.js @@ -31,7 +31,7 @@ module.exports = { source: { excludePattern: '(^|\\/|\\\\)[._]', include: [ - 'src' + 'build/src' ], includePattern: '\\.js$' }, diff --git a/packages/google-cloud-resourcemanager/package.json b/packages/google-cloud-resourcemanager/package.json index 64033f89f3f..64f45c68f92 100644 --- a/packages/google-cloud-resourcemanager/package.json +++ b/packages/google-cloud-resourcemanager/package.json @@ -32,8 +32,7 @@ "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": "npm run check && eslint samples/", - "prettier": "prettier --write samples/*.js samples/*/*.js", + "lint": "npm run check && eslint '**/*.js'", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "system-test": "mocha build/system-test --timeout 600000", "codecov": "nyc report --reporter=json && codecov -f .coverage/*.json", @@ -41,7 +40,7 @@ "check": "gts check", "clean": "gts clean", "compile": "tsc -p .", - "fix": "eslint 'samples/**/*.js' --fix && npm run prettier && gts fix", + "fix": "eslint '**/*.js' --fix && gts fix", "prepare": "npm run compile", "pretest": "npm run compile", "presystem-test": "npm run compile" @@ -50,13 +49,11 @@ "@google-cloud/common": "^0.26.0", "@google-cloud/paginator": "^0.1.0", "@google-cloud/promisify": "^0.3.0", - "extend": "^3.0.0", "teeny-request": "^3.6.0" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^2.2.4", "@types/arrify": "^1.0.4", - "@types/extend": "^3.0.0", "@types/mocha": "^5.2.5", "@types/proxyquire": "^1.3.28", "@types/request": "^2.47.1", @@ -79,5 +76,10 @@ "source-map-support": "^0.5.6", "typescript": "~3.1.0", "uuid": "^3.0.1" + }, + "nyc": { + "exclude": [ + "build/test" + ] } } diff --git a/packages/google-cloud-resourcemanager/samples/package.json b/packages/google-cloud-resourcemanager/samples/package.json index b673fadeb60..23cbff41afd 100644 --- a/packages/google-cloud-resourcemanager/samples/package.json +++ b/packages/google-cloud-resourcemanager/samples/package.json @@ -5,6 +5,7 @@ "license": "Apache-2.0", "author": "Google LLC", "repository": "googleapis/nodejs-resource", + "files": ["*.js"], "engines": { "node": ">=8" }, diff --git a/packages/google-cloud-resourcemanager/src/index.ts b/packages/google-cloud-resourcemanager/src/index.ts index 3cddef31f25..d6d89881750 100644 --- a/packages/google-cloud-resourcemanager/src/index.ts +++ b/packages/google-cloud-resourcemanager/src/index.ts @@ -14,16 +14,14 @@ * limitations under the License. */ -'use strict'; - -import {Service, Operation, GoogleAuthOptions} from '@google-cloud/common'; +import {GoogleAuthOptions, Operation, Service} from '@google-cloud/common'; import {paginator} from '@google-cloud/paginator'; import {promisifyAll} from '@google-cloud/promisify'; -import * as extend from 'extend'; -import {Project} from './project'; import * as r from 'request'; // Only for type declarations. import {teenyRequest} from 'teeny-request'; +import {Project} from './project'; + export type CreateProjectCallback = (err: Error|null, project?: Project|null, operation?: Operation, apiResponse?: r.Response) => void; @@ -259,7 +257,7 @@ class Resource extends Service { { method: 'POST', uri: '/projects', - json: extend({}, options, { + json: Object.assign({}, options, { projectId: id, }), }, @@ -350,7 +348,7 @@ class Resource extends Service { let nextQuery: GetProjectOptions; if (resp.nextPageToken) { - nextQuery = extend({}, options, { + nextQuery = Object.assign({}, options, { pageToken: resp.nextPageToken, }); } diff --git a/packages/google-cloud-resourcemanager/synth.py b/packages/google-cloud-resourcemanager/synth.py index 630eb4ad2cc..674ef1185d8 100644 --- a/packages/google-cloud-resourcemanager/synth.py +++ b/packages/google-cloud-resourcemanager/synth.py @@ -5,8 +5,5 @@ logging.basicConfig(level=logging.DEBUG) common_templates = gcp.CommonTemplates() -templates = common_templates.node_library( - package_name="@google-cloud/resource", - repo_name="googleapis/nodejs-resource" -) +templates = common_templates.node_library(source_location="build/src") s.copy(templates) diff --git a/packages/google-cloud-resourcemanager/system-test/.eslintrc.yml b/packages/google-cloud-resourcemanager/system-test/.eslintrc.yml index 2e6882e46d2..f9605165c0f 100644 --- a/packages/google-cloud-resourcemanager/system-test/.eslintrc.yml +++ b/packages/google-cloud-resourcemanager/system-test/.eslintrc.yml @@ -2,5 +2,4 @@ env: mocha: true rules: - node/no-unpublished-require: off no-console: off diff --git a/packages/google-cloud-resourcemanager/test/.eslintrc.yml b/packages/google-cloud-resourcemanager/test/.eslintrc.yml index 73f7bbc946f..6db2a46c535 100644 --- a/packages/google-cloud-resourcemanager/test/.eslintrc.yml +++ b/packages/google-cloud-resourcemanager/test/.eslintrc.yml @@ -1,5 +1,3 @@ --- env: mocha: true -rules: - node/no-unpublished-require: off diff --git a/packages/google-cloud-resourcemanager/test/index.ts b/packages/google-cloud-resourcemanager/test/index.ts index 9ba076e175c..063c2f22cf1 100644 --- a/packages/google-cloud-resourcemanager/test/index.ts +++ b/packages/google-cloud-resourcemanager/test/index.ts @@ -14,16 +14,14 @@ * limitations under the License. */ -'use strict'; - +import {DecorateRequestOptions, Operation, util} from '@google-cloud/common'; import * as arrify from 'arrify'; import * as assert from 'assert'; -import * as extend from 'extend'; import * as proxyquire from 'proxyquire'; -import {util, DecorateRequestOptions, Operation} from '@google-cloud/common'; +import {Response} from 'request'; import {teenyRequest} from 'teeny-request'; + import {Project} from '../src'; -import {Response} from 'request'; class FakeOperation { calledWith_: IArguments; @@ -78,7 +76,7 @@ const fakePromisify = { }; let makeAuthenticatedRequestFactoryOverride: Function|null; -const fakeUtil = extend({}, util, { +const fakeUtil = Object.assign({}, util, { makeAuthenticatedRequestFactory() { if (makeAuthenticatedRequestFactoryOverride) { return makeAuthenticatedRequestFactoryOverride.apply(null, arguments); @@ -86,7 +84,7 @@ const fakeUtil = extend({}, util, { return util.makeAuthenticatedRequestFactory.apply(null, arguments); }, }); -const originalFakeUtil = extend(true, {}, fakeUtil); +const originalFakeUtil = Object.assign({}, fakeUtil); describe('Resource', () => { const PROJECT_ID = 'test-project-id'; @@ -111,7 +109,7 @@ describe('Resource', () => { }); beforeEach(() => { - extend(fakeUtil, originalFakeUtil); + Object.assign(fakeUtil, originalFakeUtil); makeAuthenticatedRequestFactoryOverride = null; resource = new Resource({ @@ -151,7 +149,8 @@ describe('Resource', () => { describe('createProject', () => { const NEW_PROJECT_ID = 'new-project-id'; const OPTIONS = {a: 'b', c: 'd'}; - const EXPECTED_BODY = extend({}, OPTIONS, {projectId: NEW_PROJECT_ID}); + const EXPECTED_BODY = + Object.assign({}, OPTIONS, {projectId: NEW_PROJECT_ID}); it('should not require any options', done => { const expectedBody = {projectId: NEW_PROJECT_ID}; @@ -295,7 +294,7 @@ describe('Resource', () => { it('should build a nextQuery if necessary', done => { const nextPageToken = 'next-page-token'; - const apiResponseWithNextPageToken = extend({}, apiResponse, { + const apiResponseWithNextPageToken = Object.assign({}, apiResponse, { nextPageToken, }); const expectedNextQuery = { diff --git a/packages/google-cloud-resourcemanager/test/project.ts b/packages/google-cloud-resourcemanager/test/project.ts index acd6cf329df..69e5208b7a1 100644 --- a/packages/google-cloud-resourcemanager/test/project.ts +++ b/packages/google-cloud-resourcemanager/test/project.ts @@ -14,17 +14,14 @@ * limitations under the License. */ -'use strict'; - +import {DecorateRequestOptions, ServiceObject, ServiceObjectConfig, util} from '@google-cloud/common'; +import * as promisify from '@google-cloud/promisify'; import * as assert from 'assert'; -import * as extend from 'extend'; import * as proxyquire from 'proxyquire'; -import {ServiceObject, util, ServiceObjectConfig, DecorateRequestOptions} from '@google-cloud/common'; -import * as promisify from '@google-cloud/promisify'; -import {RequestCallback, Response} from 'request'; +import {Response} from 'request'; let promisified = false; -const fakePromisify = extend({}, promisify, { +const fakePromisify = Object.assign({}, promisify, { // tslint:disable-next-line variable-name promisifyAll(Class: Function) { if (Class.name === 'Project') { @@ -67,7 +64,7 @@ describe('Project', () => { describe('instantiation', () => { it('should inherit from ServiceObject', done => { - const resourceInstance = extend({}, RESOURCE, { + const resourceInstance = Object.assign({}, RESOURCE, { createProject: { bind(context: {}) { assert.strictEqual(context, resourceInstance);