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

Commit b95bae2

Browse files
chore: Use gts instead of gulp (#344)
1 parent e108967 commit b95bae2

40 files changed

+3052
-2836
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ node_js:
55
- '6'
66
- '8'
77
script:
8-
- gulp test.coverage
8+
- npm run coverage
99
notifications:
1010
email:
1111

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ install:
1818
# Post-install test scripts.
1919
test_script:
2020
# run tests
21-
- npm run build
21+
- npm run compile
2222
- SET GCLOUD_USE_INSPECTOR=
2323
- node_modules/.bin/mocha build/test --timeout 4000 --R
2424
- SET GCLOUD_USE_INSPECTOR=1

gulpfile.js

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

package.json

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,29 @@
2727
"@types/estree": "0.0.35",
2828
"@types/extend": "^2.0.30",
2929
"@types/lodash": "^4.14.69",
30+
"@types/mkdirp": "^0.5.1",
3031
"@types/mocha": "^2.2.41",
32+
"@types/ncp": "^2.0.1",
3133
"@types/nock": "^8.2.1",
3234
"@types/node": "^8.0.27",
35+
"@types/pify": "^3.0.0",
3336
"@types/request": "^2.0.0",
3437
"@types/semver": "^5.3.32",
3538
"@types/source-map": "^0.5.0",
3639
"changelog-maker": "^2.2.2",
37-
"clang-format": "^1.0.55",
3840
"closure-npc": "*",
3941
"coveralls": "^2.11.2",
40-
"del": "^2.2.2",
41-
"gulp": "^3.9.1",
42-
"gulp-clang-format": "^1.0.23",
43-
"gulp-sourcemaps": "^2.6.0",
44-
"gulp-tslint": "^8.1.1",
45-
"gulp-typescript": "^3.1.6",
42+
"gts": "latest",
4643
"istanbul": "^0.4.1",
47-
"merge2": "^1.0.3",
4844
"mocha": "^3.5.3",
45+
"mkdirp": "^0.5.1",
46+
"ncp": "^2.0.0",
4947
"nock": "^9.0.0",
48+
"pify": "^3.0.0",
5049
"request": "^2.81.0",
5150
"source-map-support": "^0.4.15",
5251
"tslint": "^5.4.3",
53-
"typescript": "^2.3.2"
52+
"typescript": "2.4.1"
5453
},
5554
"dependencies": {
5655
"@google-cloud/common": "^0.13.3",
@@ -67,12 +66,19 @@
6766
"util.promisify": "^1.0.0"
6867
},
6968
"scripts": {
70-
"build": "gulp",
71-
"changelog": "npm run build && ./bin/run-changelog.sh",
72-
"coverage": "npm run build && ./bin/run-test.sh -c",
73-
"prepare": "npm run build",
74-
"system-test": "npm run build && ./bin/run-system-test.sh",
75-
"test": "gulp test"
69+
"changelog": "npm run compile && ./bin/run-changelog.sh",
70+
"coverage": "npm run compile && ./bin/run-test.sh -c",
71+
"prepare": "npm run compile",
72+
"system-test": "npm run compile && ./bin/run-system-test.sh",
73+
"test": "./bin/run-test.sh",
74+
"check": "gts check",
75+
"clean": "gts clean",
76+
"precompile": "npm run compile-scripts && node build/scripts/setup-test.js",
77+
"compile": "tsc -p .",
78+
"compile-scripts": "tsc -p scripts-tsconfig.json",
79+
"fix": "gts fix",
80+
"pretest": "npm run compile",
81+
"posttest": "npm run check"
7682
},
7783
"files": [
7884
"CHANGELOG.md",

scripts-tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./node_modules/gts/tsconfig-google.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"outDir": "build"
6+
},
7+
"include": [
8+
"scripts/*.ts",
9+
"scripts/**/*.ts"
10+
],
11+
"exclude": [
12+
"node_modules"
13+
]
14+
}

scripts/setup-test.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* Copyright 2017 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import * as path from 'path';
18+
import * as pify from 'pify';
19+
import * as rawFs from 'fs';
20+
import * as rawMkdirp from 'mkdirp';
21+
import * as rawNcp from 'ncp';
22+
23+
const fs = pify(rawFs);
24+
const mkdirp = pify(rawMkdirp);
25+
const ncp = pify(rawNcp);
26+
27+
const TEST = 'test';
28+
const SYSTEM_TEST = 'system-test';
29+
const PACKAGE_JSON = 'package.json';
30+
31+
// For the transpiled code:
32+
// __dirname = <project root>/build/scripts/
33+
const PROJECT_ROOT = path.join(__dirname, '..', '..');
34+
const BUILD_DIR = path.join(PROJECT_ROOT, 'build');
35+
36+
const INPUT_TEST_DIR = path.join(PROJECT_ROOT, TEST);
37+
const INPUT_SYSTEM_TEST_DIR = path.join(PROJECT_ROOT, SYSTEM_TEST);
38+
const INPUT_PACKAGE_JSON = path.join(PROJECT_ROOT, PACKAGE_JSON);
39+
40+
const OUTPUT_TEST_DIR = path.join(BUILD_DIR, TEST);
41+
const OUTPUT_SYSTEM_TEST_DIR = path.join(BUILD_DIR, SYSTEM_TEST);
42+
const OUTPUT_PACKAGE_JSON = path.join(BUILD_DIR, PACKAGE_JSON);
43+
44+
async function setupUnitTests(): Promise<void> {
45+
await mkdirp(OUTPUT_TEST_DIR);
46+
await fs.writeFile(OUTPUT_PACKAGE_JSON,
47+
await fs.readFile(INPUT_PACKAGE_JSON));
48+
await ncp(INPUT_TEST_DIR, OUTPUT_TEST_DIR);
49+
}
50+
51+
async function setupSystemTests(): Promise<void> {
52+
await mkdirp(OUTPUT_SYSTEM_TEST_DIR);
53+
await ncp(INPUT_SYSTEM_TEST_DIR, OUTPUT_SYSTEM_TEST_DIR);
54+
}
55+
56+
async function main(): Promise<void> {
57+
try {
58+
await setupUnitTests();
59+
await setupSystemTests();
60+
}
61+
catch (e) {
62+
console.error(e);
63+
process.exit(1);
64+
}
65+
}
66+
67+
main();

src/agent/controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import * as stackdriver from '../types/stackdriver';
3333
const API = 'https://clouddebugger.googleapis.com/v2/controller';
3434

3535
export class Controller extends common.ServiceObject {
36-
private nextWaitToken_: string|null;
36+
private nextWaitToken: string|null;
3737

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

4444
/** @private {string} */
45-
this.nextWaitToken_ = null;
45+
this.nextWaitToken = null;
4646
}
4747

4848
/**
@@ -91,8 +91,8 @@ export class Controller extends common.ServiceObject {
9191
const that = this;
9292
assert(debuggee.id, 'should have a registered debuggee');
9393
const query: stackdriver.ListBreakpointsQuery = {successOnTimeout: true};
94-
if (that.nextWaitToken_) {
95-
query.waitToken = that.nextWaitToken_;
94+
if (that.nextWaitToken) {
95+
query.waitToken = that.nextWaitToken;
9696
}
9797

9898
const uri = API + '/debuggees/' + encodeURIComponent(debuggee.id) +
@@ -116,7 +116,7 @@ export class Controller extends common.ServiceObject {
116116
return;
117117
} else {
118118
body = body || {};
119-
that.nextWaitToken_ = body.nextWaitToken;
119+
that.nextWaitToken = body.nextWaitToken;
120120
callback(null, response, body);
121121
}
122122
});

0 commit comments

Comments
 (0)