diff --git a/gulpfile.js b/gulpfile.js index 574356d1..f1a333e4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,10 +29,10 @@ require('./test/gulpfile'); const root = __dirname; gulp.task('install.all', 'Install dependencies for all subdirectory packages', - ['js.core.install', 'native.core.install', 'health-check.install']); + ['js.core.install', 'native.core.install', 'health-check.install', 'internal.test.install']); gulp.task('install.all.windows', 'Install dependencies for all subdirectory packages for MS Windows', - ['js.core.install', 'native.core.install.windows', 'health-check.install']); + ['js.core.install', 'native.core.install.windows', 'health-check.install', 'internal.test.install']); gulp.task('lint', 'Emit linting errors in source and test files', ['js.core.lint', 'native.core.lint']); @@ -77,4 +77,6 @@ gulp.task('test', 'Run all tests', ['build'], () => { gulp.start('test.only'); }); +gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']); + gulp.task('default', ['help']); diff --git a/package.json b/package.json index 4caf864b..05647b47 100644 --- a/package.json +++ b/package.json @@ -8,29 +8,23 @@ "name": "Google Inc." }, "license": "Apache-2.0", - "dependencies": { - "async": "^2.5.0", - "body-parser": "^1.18.0", - "execa": "^0.8.0", - "express": "^4.15.4", - "google-auth-library": "^0.11.0", - "lodash": "^4.17.4", - "mocha-jenkins-reporter": "^0.3.9", - "poisson-process": "^0.2.2" - }, "devDependencies": { "del": "^3.0.0", + "execa": "^0.8.0", "gulp": "^3.9.1", "gulp-help": "^1.6.1", + "gulp-jsdoc3": "^1.0.1", "gulp-jshint": "^2.0.4", "gulp-mocha": "^4.3.1", "gulp-sourcemaps": "^2.6.1", "gulp-tslint": "^8.1.1", "gulp-typescript": "^3.2.2", "gulp-util": "^3.0.8", + "jsdoc": "^3.3.2", "jshint": "^2.9.5", "merge2": "^1.1.0", "mocha": "^3.5.3", + "mocha-jenkins-reporter": "^0.3.9", "through2": "^2.0.3", "tslint": "^5.5.0", "typescript": "^2.5.1", diff --git a/packages/grpc-native-core/gulpfile.js b/packages/grpc-native-core/gulpfile.js index 35a265ac..8a714ee6 100644 --- a/packages/grpc-native-core/gulpfile.js +++ b/packages/grpc-native-core/gulpfile.js @@ -21,6 +21,7 @@ const help = require('gulp-help'); // gulp-help monkeypatches tasks to have an additional description parameter const gulp = help(_gulp); +const jsdoc = require('gulp-jsdoc3'); const jshint = require('gulp-jshint'); const mocha = require('gulp-mocha'); const execa = require('execa'); @@ -73,3 +74,9 @@ gulp.task('native.core.build', 'Build native package', () => { gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => { return gulp.src(`${testDir}/*.js`).pipe(mocha({reporter: 'mocha-jenkins-reporter'})); }); + +gulp.task('native.core.doc.gen', 'Generate docs', (cb) => { + var config = require('./jsdoc_conf.json'); + gulp.src([`${nativeCoreDir}/README.md`, `${nativeCoreDir}/index.js`, `${srcDir}/*.js`], {read: false}) + .pipe(jsdoc(config, cb)); +}); diff --git a/packages/grpc-native-core/jsdoc_conf.json b/packages/grpc-native-core/jsdoc_conf.json index 2d967753..92de2990 100644 --- a/packages/grpc-native-core/jsdoc_conf.json +++ b/packages/grpc-native-core/jsdoc_conf.json @@ -2,14 +2,8 @@ "tags": { "allowUnknownTags": true }, - "source": { - "include": [ "src/node/index.js", "src/node/src" ], - "includePattern": "src/node/.+\\.js(doc)?$", - "excludePattern": "(^|\\/|\\\\)_" - }, "opts": { - "package": "package.json", - "readme": "src/node/README.md" + "destination": "docs/gen/native/core" }, "plugins": ["plugins/markdown"], "templates": { diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 6ad9013b..1a6ecde0 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -19,11 +19,8 @@ "lib": "src/node/src" }, "scripts": { - "lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore", - "test": "./node_modules/.bin/mocha test && npm run-script lint", "build": "./node_modules/.bin/node-pre-gyp build", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", - "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" }, @@ -38,16 +35,9 @@ "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^2.0.1", - "body-parser": "^1.15.2", "electron-mocha": "^3.1.1", - "express": "^4.14.0", - "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.4.4", - "jsdoc": "^3.3.2", - "minimist": "^1.1.0", - "poisson-process": "^0.2.1" + "istanbul": "^0.4.4" }, "engines": { "node": ">=4" diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 45f52240..fc188eaa 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -21,10 +21,8 @@ "lib": "src/node/src" }, "scripts": { - "lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore", - "test": "./node_modules/.bin/mocha test && npm run-script lint", + "build": "./node_modules/.bin/node-pre-gyp build", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", - "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" }, @@ -39,19 +37,9 @@ "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^2.0.1", - "body-parser": "^1.15.2", "electron-mocha": "^3.1.1", - "express": "^4.14.0", - "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.4.4", - "jsdoc": "^3.3.2", - "jshint": "^2.5.0", - "minimist": "^1.1.0", - "mocha": "^3.0.2", - "mocha-jenkins-reporter": "^0.2.3", - "poisson-process": "^0.2.1" + "istanbul": "^0.4.4" }, "engines": { "node": ">=4" diff --git a/test/gulpfile.js b/test/gulpfile.js index 8dcab40d..469f8d23 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -32,6 +32,10 @@ gulp.task('internal.test.clean.links', 'Delete npm links', () => { return del(path.resolve(testDir, 'node_modules/grpc')); }); +gulp.task('internal.test.install', 'Install test dependencies', () => { + return execa('npm', ['install'], {cwd: testDir, stdio: 'inherit'}); +}); + gulp.task('internal.test.clean.all', 'Delete all files created by tasks', ['internal.test.clean.links']); diff --git a/test/package.json b/test/package.json new file mode 100644 index 00000000..e987314c --- /dev/null +++ b/test/package.json @@ -0,0 +1,25 @@ +{ + "name": "grpc-node-test", + "version": "0.1.0", + "description": "Dummy package for the grpc-node repository tests", + "private": true, + "keywords": [], + "author": { + "name": "Google Inc." + }, + "license": "Apache-2.0", + "contributors": [ + { + "name": "Google Inc." + } + ], + "dependencies": { + "async": "^2.0.1", + "body-parser": "^1.15.2", + "express": "^4.14.0", + "google-auth-library": "^0.9.2", + "lodash": "^4.17.4", + "minimist": "^1.1.0", + "poisson-process": "^0.2.1" + } +}