From 335d31c875b092464409d994381358e6d7c2f92c Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Thu, 14 Sep 2017 16:05:22 -0700 Subject: [PATCH] Update js-core gulpfile and packaging --- packages/grpc-js-core/gulpfile.js | 10 ++++++---- packages/grpc-js-core/package.json | 10 +++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/grpc-js-core/gulpfile.js b/packages/grpc-js-core/gulpfile.js index cdf046ee..3004c6af 100644 --- a/packages/grpc-js-core/gulpfile.js +++ b/packages/grpc-js-core/gulpfile.js @@ -62,9 +62,9 @@ function makeCompileFn(globs) { .pipe(sourcemaps.init()) .pipe(tsProject) .on('error', onError); - const jsmap = js.pipe(sourcemaps.write(jsCoreDir, { + const jsmap = js.pipe(sourcemaps.write('.', { includeContent: false, - sourceRoot: path.resolve(jsCoreDir, '..') + sourceRoot: '..' })); const copy = gulp.src(copyGlob, { base: jsCoreDir }); return merge2([ @@ -145,9 +145,11 @@ gulp.task('js.core.test.single', 'After dep tasks, runs individual files specifi // util.env contains CLI arguments for the gulp task. // Determine the path to the transpiled version of this TS file. const getTranspiledPath = (file) => { - const dir = path.dirname(path.relative('.', file)); + const dir = path.dirname(path.relative(jsCoreDir, file)); const basename = path.basename(file, '.ts'); - return `${outDir}/${dir}/${basename}.js`; + const result = `${outDir}/${dir}/${basename}.js`; + console.log(result); + return result; }; // Construct an instance of Mocha's runner API and feed it the path to the // transpiled source. diff --git a/packages/grpc-js-core/package.json b/packages/grpc-js-core/package.json index a5d3e044..83fcb0e9 100644 --- a/packages/grpc-js-core/package.json +++ b/packages/grpc-js-core/package.json @@ -15,6 +15,7 @@ "types": "src/index.ts", "license": "Apache-2.0", "devDependencies": { + "@types/lodash": "^4.14.73", "@types/mocha": "^2.2.42", "@types/node": "^8.0.25", "clang-format": "^1.0.53", @@ -29,13 +30,16 @@ "scripts": { "build": "npm run compile", "clean": "gulp clean", - "compile": "gulp compile", + "compile": "gulp js.core.compile", "format": "clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts", "lint": "tslint -c node_modules/google-ts-style/tslint.json -p . -t codeFrame --type-check", + "prepare": "npm run build", "test": "gulp test" }, "dependencies": { - "@types/lodash": "^4.14.73", "lodash": "^4.17.4" - } + }, + "files": [ + "build/src/*.js" + ] }