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

Commit

Permalink
Build and packaging cleanups (#296)
Browse files Browse the repository at this point in the history
* build and packaging cleanups
* run mocha with source map support
* fix require paths
* fix correct sourceRoot for sourcemaps
  • Loading branch information
ofrobots committed Jun 30, 2017
1 parent 334fba2 commit 31b6e9f
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 94 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
src
node_modules
build
coverage
node_modules
npm-debug.log
.DS_Store
.vscode
src
definitions
2 changes: 1 addition & 1 deletion bin/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function run {
C="$(npm bin)/istanbul cover --dir ./coverage/${counter}"
((counter++))
fi
($C "$(npm bin)/_mocha" -- $* --timeout 4000 --R spec) || exit 1
($C "$(npm bin)/_mocha" -- $* --require source-map-support/register --timeout 4000 --R spec) || exit 1
}

# Run test/coverage
Expand Down
Binary file added google-cloud-debug-agent-2.1.1.tgz
Binary file not shown.
10 changes: 5 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const format = require('gulp-clang-format');

const tsconfigPath = path.join(__dirname, 'tsconfig.json');
const tslintPath = path.join(__dirname, 'tslint.json');
const outDir = '.';
const sources = ['src.ts/**/*.ts', 'src.ts/**/*.js'];
const outDir = 'build';
const sources = ['src.ts/**/*.ts'];

let exitOnError = true;
function onError() {
Expand Down Expand Up @@ -62,7 +62,7 @@ gulp.task('test.check-lint', () => {
});

gulp.task('clean', () => {
return del(['src']);
return del(['build']);
});

gulp.task('compile', () => {
Expand All @@ -71,10 +71,10 @@ gulp.task('compile', () => {
.pipe(ts.createProject(tsconfigPath)())
.on('error', onError);
return merge([
tsResult.dts.pipe(gulp.dest(`${outDir}/definitions`)),
tsResult.dts.pipe(gulp.dest(`${outDir}/types`)),
tsResult.js
.pipe(sourcemaps.write(
'.', {includeContent: false, sourceRoot: '../../src'}))
'.', {includeContent: false, sourceRoot: '../../src.ts'}))
.pipe(gulp.dest(`${outDir}/src`)),
tsResult.js.pipe(gulp.dest(`${outDir}/src`))
]);
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.1",
"author": "Google Inc.",
"description": "Stackdriver Debug Agent for Node.js",
"main": "./src/index.js",
"main": "./build/src/index.js",
"repository": "googlecloudplatform/cloud-debug-nodejs",
"keywords": [
"google",
Expand Down Expand Up @@ -71,5 +71,11 @@
"coverage": "gulp && ./bin/run-test.sh -c",
"bump": "gulp && ./bin/run-bump.sh",
"closure": "gulp && ./node_modules/.bin/closure-npc"
}
},
"files":[
"CHANGELOG.md",
"LICENSE",
"README.md",
"build/src"
]
}
2 changes: 1 addition & 1 deletion src.ts/agent/debuglet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import * as scanner from './scanner';
import * as SourceMapper from './sourcemapper';
import * as v8debugapi from './v8debugapi';

const pjson = require('../../package.json');
const pjson = require('../../../package.json');

import * as assert from 'assert';

Expand Down
2 changes: 1 addition & 1 deletion src.ts/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Debug extends common.Service {
projectIdRequired: false,
baseUrl: 'https://clouddebugger.googleapis.com/v2',
scopes: ['https://www.googleapis.com/auth/cloud_debugger'],
packageJson: require('../package.json')
packageJson: require('../../package.json')
};

// TODO: Update Service to provide types
Expand Down
2 changes: 1 addition & 1 deletion src.ts/debuggee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

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

Expand Down
6 changes: 3 additions & 3 deletions system-test/test-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ assert.ok(
'Need to have GOOGLE_APPLICATION_CREDENTIALS defined to be able to run ' +
'this test');

var Controller = require('../src/controller.js').Controller;
var Debuggee = require('../src/debuggee.js').Debuggee;
var debug = require('../src/debug.js').Debug();
var Controller = require('../build/src/controller.js').Controller;
var Debuggee = require('../build/src/debuggee.js').Debuggee;
var debug = require('../build/src/debug.js').Debug();


describe('Controller', function() {
Expand Down
2 changes: 1 addition & 1 deletion system-test/test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var _ = require('lodash'); // for _.find. Can't use ES6 yet.
var cp = require('child_process');
var semver = require('semver');
var promisifyAll = require('@google-cloud/common').util.promisifyAll;
var Debug = require('../src/debug.js').Debug;
var Debug = require('../build/src/debug.js').Debug;
var Debugger = require('../test/debugger.js');

var CLUSTER_WORKERS = 3;
Expand Down
4 changes: 2 additions & 2 deletions test/misc/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/


var v8debugapi = require('../src/v8debugapi.js');
var Logger = require('../src/logger.js');
var v8debugapi = require('../build/src/v8debugapi.js');
var Logger = require('../build/src/logger.js');
var config = require('../config.js').default;
var assert = require('assert');
var pretty = require('pretty-hrtime');
Expand Down
4 changes: 2 additions & 2 deletions test/misc/test-leak.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var v8debugapi = require('../src/v8debugapi.js');
var Logger = require('../src/logger.js');
var v8debugapi = require('../build/src/v8debugapi.js');
var Logger = require('../build/src/logger.js');
var config = require('../config.js').default;
var assert = require('assert');
var util = require('util');
Expand Down
4 changes: 2 additions & 2 deletions test/test-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
var assert = require('assert');
var nock = require('nock');
var request = require('./auth-request.js');
var Debuggee = require('../src/debuggee.js').Debuggee;
var Debuggee = require('../build/src/debuggee.js').Debuggee;

// the tests in this file rely on the GCLOUD_PROJECT environment variable
// not being set
delete process.env.GCLOUD_PROJECT;

var Controller = require('../src/controller.js').Controller;
var Controller = require('../build/src/controller.js').Controller;
var fakeDebug = {
request: request
};
Expand Down
2 changes: 1 addition & 1 deletion test/test-debug-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const realAssert = require('assert');

describe('debug-assert', () => {
const debugAssert = require('../src/agent/debug-assert.js').debugAssert;
const debugAssert = require('../build/src/agent/debug-assert.js').debugAssert;

it('should fire assertions when enabled', () => {
realAssert.throws(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/test-debuggee.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

var assert = require('assert');
var Debuggee = require('../src/debuggee.js').Debuggee;
var Debuggee = require('../build/src/debuggee.js').Debuggee;

describe('Debuggee', function() {

Expand Down
Loading

0 comments on commit 31b6e9f

Please sign in to comment.