Put packages in @grpc scope, add linking scripts

This commit is contained in:
murgatroid99 2017-10-12 13:40:18 -07:00
parent 81acd929b7
commit 7ae3d85f5b
16 changed files with 167 additions and 40 deletions

View File

@ -22,33 +22,38 @@ const help = require('gulp-help');
const gulp = help(_gulp);
require('./packages/grpc-health-check/gulpfile');
require('./packages/grpc-js/gulpfile');
require('./packages/grpc-js-core/gulpfile');
require('./packages/grpc-native/gulpfile');
require('./packages/grpc-native-core/gulpfile');
require('./packages/grpc-surface/gulpfile');
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',
'js.install', 'native.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',
'js.install', 'native.install']);
gulp.task('lint', 'Emit linting errors in source and test files',
['js.core.lint', 'native.core.lint']);
gulp.task('build', 'Build packages', ['js.core.compile', 'native.core.build']);
gulp.task('link.create', 'Initialize npm links to packages',
['native.core.link.create']);
gulp.task('link.create', 'Initialize npm links',
['native.core.link.create', 'js.core.link.create', 'surface.link.create',
'js.link.create', 'native.link.create']);
gulp.task('link.only', 'Link packages together without rebuilding anything',
['health-check.link.add', 'internal.test.link.add']);
gulp.task('link.only', 'Link packages without rebuilding',
['js.link.add', 'native.link.add', 'health-check.link.add', 'internal.test.link.add']);
gulp.task('link', 'Link local packages together after building',
['link.create'], () => {
gulp.start('link.only');
});
gulp.task('link', 'Link together packages', ['link.create'], () => {
gulp.start('link.only');
});
gulp.task('setup', 'One-time setup for a clean repository', ['install.all'], () => {
gulp.start('link');
@ -61,7 +66,7 @@ gulp.task('clean', 'Delete generated files', ['js.core.clean', 'native.core.clea
gulp.task('clean.all', 'Delete all files created by tasks',
['js.core.clean.all', 'native.core.clean.all', 'health-check.clean.all',
'internal.test.clean.all']);
'internal.test.clean.all', 'js.clean.all', 'native.clean.all']);
gulp.task('native.test.only', 'Run tests of native code without rebuilding anything',
['native.core.test', 'internal.test.test', 'health-check.test']);

View File

@ -1,5 +1,5 @@
{
"name": "grpc-health-check",
"name": "@grpc/health-check",
"version": "1.7.0-dev",
"author": "Google Inc.",
"description": "Health check service for use with gRPC",

View File

@ -101,6 +101,10 @@ gulp.task('js.core.install', 'Install native core dependencies', () => {
return execa('npm', ['install', '--unsafe-perm'], {cwd: jsCoreDir, stdio: 'inherit'});
});
gulp.task('js.core.link.create', 'Create npm link', () => {
return execa('npm', ['link'], {cwd: jsCoreDir, stdio: 'inherit'});
});
/**
* Runs tslint on files in src/, with linting rules defined in tslint.json.
*/

View File

@ -1,10 +1,9 @@
{
"name": "grpc-js-core",
"name": "@grpc/js-core",
"version": "0.1.0",
"description": "gRPC Library for Node - pure JS core",
"homepage": "https://grpc.io/",
"main": "build/src/index.js",
"private": true,
"engines": {
"node": ">=8.4"
},
@ -26,7 +25,7 @@
"name": "Google Inc."
}
],
"_id": "grpc-js-core@0.1.0",
"_id": "@grpc/js-core@0.1.0",
"scripts": {
"build": "npm run compile",
"clean": "gulp clean",

View File

@ -0,0 +1,49 @@
/*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const _gulp = require('gulp');
const help = require('gulp-help');
// gulp-help monkeypatches tasks to have an additional description parameter
const gulp = help(_gulp);
const execa = require('execa');
const path = require('path');
const del = require('del');
const jsDir = __dirname;
gulp.task('js.clean.links', 'Delete npm links', () => {
del(path.resolve(jsDir, 'node_modules/@grpc/js-core'));
del(path.resolve(jsDir, 'node_modules/@grpc/surface'));
});
gulp.task('js.clean.all', 'Delete all files created by tasks',
['js.clean.links']);
gulp.task('js.install', 'Install dependencies', () => {
return execa('npm', ['install', '--unsafe-perm'], {cwd: jsDir, stdio: 'inherit'});
});
gulp.task('js.link.create', 'Create npm link', () => {
return execa('npm', ['link'], {cwd: jsDir, stdio: 'inherit'});
});
gulp.task('js.link.add', 'Link local copies of dependencies', () => {
return execa('npm', ['link', '@grpc/js-core'], {cwd: jsDir, stdio: 'inherit'}).then(
execa('npm', ['link', '@grpc/surface'], {cwd: jsDir, stdio: 'inherit'}));
});

View File

@ -18,4 +18,4 @@
'use strict';
module.exports = require('grpc-surface')(require('grpc-js-core'));
module.exports = require('@grpc/surface')(require('@grpc/js-core'));

View File

@ -1,5 +1,5 @@
{
"name": "grpc-js",
"name": "@grpc/js",
"version": "1.0.0",
"description": "",
"main": "index.js",
@ -17,7 +17,7 @@
},
"homepage": "https://grpc.io",
"dependencies": {
"grpc-js-core": "^0.1.0",
"grpc-surface": "^1.0.0"
"@grpc/js-core": "^0.1.0",
"@grpc/surface": "^0.1.0"
}
}

View File

@ -39,15 +39,11 @@
},
"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"
"jsdoc": "^3.3.2"
},
"engines": {
"node": ">=4"

View File

@ -23,6 +23,7 @@
"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",
@ -40,18 +41,11 @@
},
"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"
"jsdoc": "^3.3.2"
},
"engines": {
"node": ">=4"

View File

@ -0,0 +1,50 @@
/*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const _gulp = require('gulp');
const help = require('gulp-help');
// gulp-help monkeypatches tasks to have an additional description parameter
const gulp = help(_gulp);
const execa = require('execa');
const path = require('path');
const del = require('del');
const nativeDir = __dirname;
gulp.task('native.clean.links', 'Delete npm links', () => {
del(path.resolve(nativeDir, 'node_modules/@grpc/native-core'));
del(path.resolve(nativeDir, 'node_modules/@grpc/surface'));
});
gulp.task('native.clean.all', 'Delete all files created by tasks',
['native.clean.links']);
gulp.task('native.link.create', 'Create npm link', () => {
return execa('npm', ['link'], {cwd: nativeDir, stdio: 'inherit'});
});
gulp.task('native.install', 'Install dependencies', () => {
return execa('npm', ['install', '--unsafe-perm'], {cwd: nativeDir, stdio: 'inherit'});
});
gulp.task('native.link.add', 'Link local copies of dependencies', () => {
// Note: this should be 'grpc-native-core', when we change that package name
return execa('npm', ['link', 'grpc'], {cwd: nativeDir, stdio: 'inherit'}).then(
execa('npm', ['link', '@grpc/surface'], {cwd: nativeDir, stdio: 'inherit'}));
});

View File

@ -18,5 +18,5 @@
'use strict';
// TODO(mlumish): This should eventually be grpc-native-core instead of grpc
module.exports = require('grpc-surface')(require('grpc'));
// TODO(mlumish): This should eventually be @grpc/native-core instead of grpc
module.exports = require('@grpc/surface')(require('grpc'));

View File

@ -1,5 +1,5 @@
{
"name": "grpc-native",
"name": "@grpc/native",
"version": "1.0.0",
"description": "",
"main": "index.js",
@ -18,6 +18,6 @@
"homepage": "https://grpc.io",
"dependencies": {
"grpc": "^1.6.0",
"grpc-surface": "^1.0.0"
"@grpc/surface": "^0.1.0"
}
}

View File

@ -1,5 +1,5 @@
{
"name": "grpc-protobufjs",
"name": "@grpc/protobufjs",
"version": "1.0.0",
"description": "",
"main": "index.js",

View File

@ -0,0 +1,30 @@
/*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const _gulp = require('gulp');
const help = require('gulp-help');
// gulp-help monkeypatches tasks to have an additional description parameter
const gulp = help(_gulp);
const execa = require('execa');
const surfaceDir = __dirname;
gulp.task('surface.link.create', 'Create npm link', () => {
return execa('npm', ['link'], {cwd: surfaceDir, stdio: 'inherit'});
});

View File

@ -18,7 +18,7 @@
'use strict';
const util = require(util);
const util = require('util');
const _ = require('lodash');

View File

@ -1,6 +1,6 @@
{
"name": "grpc-surface",
"version": "1.0.0",
"name": "@grpc/surface",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {