Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
chore: Use gts instead of gulp (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicKramer committed Nov 2, 2017
1 parent e108967 commit b95bae2
Show file tree
Hide file tree
Showing 40 changed files with 3,052 additions and 2,836 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ node_js:
- '6'
- '8'
script:
- gulp test.coverage
- npm run coverage
notifications:
email:
- nodejs-build-notifications+travis@googlegroups.com
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
# Post-install test scripts.
test_script:
# run tests
- npm run build
- npm run compile
- SET GCLOUD_USE_INSPECTOR=
- node_modules/.bin/mocha build/test --timeout 4000 --R
- SET GCLOUD_USE_INSPECTOR=1
Expand Down
157 changes: 0 additions & 157 deletions gulpfile.js

This file was deleted.

36 changes: 21 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,29 @@
"@types/estree": "0.0.35",
"@types/extend": "^2.0.30",
"@types/lodash": "^4.14.69",
"@types/mkdirp": "^0.5.1",
"@types/mocha": "^2.2.41",
"@types/ncp": "^2.0.1",
"@types/nock": "^8.2.1",
"@types/node": "^8.0.27",
"@types/pify": "^3.0.0",
"@types/request": "^2.0.0",
"@types/semver": "^5.3.32",
"@types/source-map": "^0.5.0",
"changelog-maker": "^2.2.2",
"clang-format": "^1.0.55",
"closure-npc": "*",
"coveralls": "^2.11.2",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-clang-format": "^1.0.23",
"gulp-sourcemaps": "^2.6.0",
"gulp-tslint": "^8.1.1",
"gulp-typescript": "^3.1.6",
"gts": "latest",
"istanbul": "^0.4.1",
"merge2": "^1.0.3",
"mocha": "^3.5.3",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"nock": "^9.0.0",
"pify": "^3.0.0",
"request": "^2.81.0",
"source-map-support": "^0.4.15",
"tslint": "^5.4.3",
"typescript": "^2.3.2"
"typescript": "2.4.1"
},
"dependencies": {
"@google-cloud/common": "^0.13.3",
Expand All @@ -67,12 +66,19 @@
"util.promisify": "^1.0.0"
},
"scripts": {
"build": "gulp",
"changelog": "npm run build && ./bin/run-changelog.sh",
"coverage": "npm run build && ./bin/run-test.sh -c",
"prepare": "npm run build",
"system-test": "npm run build && ./bin/run-system-test.sh",
"test": "gulp test"
"changelog": "npm run compile && ./bin/run-changelog.sh",
"coverage": "npm run compile && ./bin/run-test.sh -c",
"prepare": "npm run compile",
"system-test": "npm run compile && ./bin/run-system-test.sh",
"test": "./bin/run-test.sh",
"check": "gts check",
"clean": "gts clean",
"precompile": "npm run compile-scripts && node build/scripts/setup-test.js",
"compile": "tsc -p .",
"compile-scripts": "tsc -p scripts-tsconfig.json",
"fix": "gts fix",
"pretest": "npm run compile",
"posttest": "npm run check"
},
"files": [
"CHANGELOG.md",
Expand Down
14 changes: 14 additions & 0 deletions scripts-tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"scripts/*.ts",
"scripts/**/*.ts"
],
"exclude": [
"node_modules"
]
}
67 changes: 67 additions & 0 deletions scripts/setup-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as path from 'path';
import * as pify from 'pify';
import * as rawFs from 'fs';
import * as rawMkdirp from 'mkdirp';
import * as rawNcp from 'ncp';

const fs = pify(rawFs);
const mkdirp = pify(rawMkdirp);
const ncp = pify(rawNcp);

const TEST = 'test';
const SYSTEM_TEST = 'system-test';
const PACKAGE_JSON = 'package.json';

// For the transpiled code:
// __dirname = <project root>/build/scripts/
const PROJECT_ROOT = path.join(__dirname, '..', '..');
const BUILD_DIR = path.join(PROJECT_ROOT, 'build');

const INPUT_TEST_DIR = path.join(PROJECT_ROOT, TEST);
const INPUT_SYSTEM_TEST_DIR = path.join(PROJECT_ROOT, SYSTEM_TEST);
const INPUT_PACKAGE_JSON = path.join(PROJECT_ROOT, PACKAGE_JSON);

const OUTPUT_TEST_DIR = path.join(BUILD_DIR, TEST);
const OUTPUT_SYSTEM_TEST_DIR = path.join(BUILD_DIR, SYSTEM_TEST);
const OUTPUT_PACKAGE_JSON = path.join(BUILD_DIR, PACKAGE_JSON);

async function setupUnitTests(): Promise<void> {
await mkdirp(OUTPUT_TEST_DIR);
await fs.writeFile(OUTPUT_PACKAGE_JSON,
await fs.readFile(INPUT_PACKAGE_JSON));
await ncp(INPUT_TEST_DIR, OUTPUT_TEST_DIR);
}

async function setupSystemTests(): Promise<void> {
await mkdirp(OUTPUT_SYSTEM_TEST_DIR);
await ncp(INPUT_SYSTEM_TEST_DIR, OUTPUT_SYSTEM_TEST_DIR);
}

async function main(): Promise<void> {
try {
await setupUnitTests();
await setupSystemTests();
}
catch (e) {
console.error(e);
process.exit(1);
}
}

main();
10 changes: 5 additions & 5 deletions src/agent/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import * as stackdriver from '../types/stackdriver';
const API = 'https://clouddebugger.googleapis.com/v2/controller';

export class Controller extends common.ServiceObject {
private nextWaitToken_: string|null;
private nextWaitToken: string|null;

/**
* @constructor
Expand All @@ -42,7 +42,7 @@ export class Controller extends common.ServiceObject {
super({parent: debug, baseUrl: '/controller'});

/** @private {string} */
this.nextWaitToken_ = null;
this.nextWaitToken = null;
}

/**
Expand Down Expand Up @@ -91,8 +91,8 @@ export class Controller extends common.ServiceObject {
const that = this;
assert(debuggee.id, 'should have a registered debuggee');
const query: stackdriver.ListBreakpointsQuery = {successOnTimeout: true};
if (that.nextWaitToken_) {
query.waitToken = that.nextWaitToken_;
if (that.nextWaitToken) {
query.waitToken = that.nextWaitToken;
}

const uri = API + '/debuggees/' + encodeURIComponent(debuggee.id) +
Expand All @@ -116,7 +116,7 @@ export class Controller extends common.ServiceObject {
return;
} else {
body = body || {};
that.nextWaitToken_ = body.nextWaitToken;
that.nextWaitToken = body.nextWaitToken;
callback(null, response, body);
}
});
Expand Down

0 comments on commit b95bae2

Please sign in to comment.