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

Commit 31b6e9f

Browse files
authored
Build and packaging cleanups (#296)
* build and packaging cleanups * run mocha with source map support * fix require paths * fix correct sourceRoot for sourcemaps
1 parent 334fba2 commit 31b6e9f

27 files changed

+98
-94
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
src
2-
node_modules
1+
build
32
coverage
3+
node_modules
44
npm-debug.log
55
.DS_Store
66
.vscode
7-
src
8-
definitions

bin/run-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function run {
3030
C="$(npm bin)/istanbul cover --dir ./coverage/${counter}"
3131
((counter++))
3232
fi
33-
($C "$(npm bin)/_mocha" -- $* --timeout 4000 --R spec) || exit 1
33+
($C "$(npm bin)/_mocha" -- $* --require source-map-support/register --timeout 4000 --R spec) || exit 1
3434
}
3535

3636
# Run test/coverage

google-cloud-debug-agent-2.1.1.tgz

60.6 KB
Binary file not shown.

gulpfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const format = require('gulp-clang-format');
3131

3232
const tsconfigPath = path.join(__dirname, 'tsconfig.json');
3333
const tslintPath = path.join(__dirname, 'tslint.json');
34-
const outDir = '.';
35-
const sources = ['src.ts/**/*.ts', 'src.ts/**/*.js'];
34+
const outDir = 'build';
35+
const sources = ['src.ts/**/*.ts'];
3636

3737
let exitOnError = true;
3838
function onError() {
@@ -62,7 +62,7 @@ gulp.task('test.check-lint', () => {
6262
});
6363

6464
gulp.task('clean', () => {
65-
return del(['src']);
65+
return del(['build']);
6666
});
6767

6868
gulp.task('compile', () => {
@@ -71,10 +71,10 @@ gulp.task('compile', () => {
7171
.pipe(ts.createProject(tsconfigPath)())
7272
.on('error', onError);
7373
return merge([
74-
tsResult.dts.pipe(gulp.dest(`${outDir}/definitions`)),
74+
tsResult.dts.pipe(gulp.dest(`${outDir}/types`)),
7575
tsResult.js
7676
.pipe(sourcemaps.write(
77-
'.', {includeContent: false, sourceRoot: '../../src'}))
77+
'.', {includeContent: false, sourceRoot: '../../src.ts'}))
7878
.pipe(gulp.dest(`${outDir}/src`)),
7979
tsResult.js.pipe(gulp.dest(`${outDir}/src`))
8080
]);

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "2.1.1",
44
"author": "Google Inc.",
55
"description": "Stackdriver Debug Agent for Node.js",
6-
"main": "./src/index.js",
6+
"main": "./build/src/index.js",
77
"repository": "googlecloudplatform/cloud-debug-nodejs",
88
"keywords": [
99
"google",
@@ -71,5 +71,11 @@
7171
"coverage": "gulp && ./bin/run-test.sh -c",
7272
"bump": "gulp && ./bin/run-bump.sh",
7373
"closure": "gulp && ./node_modules/.bin/closure-npc"
74-
}
74+
},
75+
"files":[
76+
"CHANGELOG.md",
77+
"LICENSE",
78+
"README.md",
79+
"build/src"
80+
]
7581
}

src.ts/agent/debuglet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import * as scanner from './scanner';
4141
import * as SourceMapper from './sourcemapper';
4242
import * as v8debugapi from './v8debugapi';
4343

44-
const pjson = require('../../package.json');
44+
const pjson = require('../../../package.json');
4545

4646
import * as assert from 'assert';
4747

src.ts/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class Debug extends common.Service {
5353
projectIdRequired: false,
5454
baseUrl: 'https://clouddebugger.googleapis.com/v2',
5555
scopes: ['https://www.googleapis.com/auth/cloud_debugger'],
56-
packageJson: require('../package.json')
56+
packageJson: require('../../package.json')
5757
};
5858

5959
// TODO: Update Service to provide types

src.ts/debuggee.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
const pjson = require('../package.json');
17+
const pjson = require('../../package.json');
1818
import * as _ from 'lodash';
1919
import {StatusMessage} from './status-message';
2020

system-test/test-controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ assert.ok(
2626
'Need to have GOOGLE_APPLICATION_CREDENTIALS defined to be able to run ' +
2727
'this test');
2828

29-
var Controller = require('../src/controller.js').Controller;
30-
var Debuggee = require('../src/debuggee.js').Debuggee;
31-
var debug = require('../src/debug.js').Debug();
29+
var Controller = require('../build/src/controller.js').Controller;
30+
var Debuggee = require('../build/src/debuggee.js').Debuggee;
31+
var debug = require('../build/src/debug.js').Debug();
3232

3333

3434
describe('Controller', function() {

system-test/test-e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var _ = require('lodash'); // for _.find. Can't use ES6 yet.
2121
var cp = require('child_process');
2222
var semver = require('semver');
2323
var promisifyAll = require('@google-cloud/common').util.promisifyAll;
24-
var Debug = require('../src/debug.js').Debug;
24+
var Debug = require('../build/src/debug.js').Debug;
2525
var Debugger = require('../test/debugger.js');
2626

2727
var CLUSTER_WORKERS = 3;

0 commit comments

Comments
 (0)