mirror of https://github.com/grpc/grpc-node.git
Remove unused packages
This commit is contained in:
parent
fa32b718e3
commit
a0d3d4a22c
17
gulpfile.ts
17
gulpfile.ts
|
|
@ -49,11 +49,8 @@ function loadGulpTasksWithPrefix(path: string, prefix: string) {
|
|||
|
||||
[
|
||||
['./packages/grpc-health-check/gulpfile', 'health-check'],
|
||||
['./packages/grpc-js/gulpfile', 'js'],
|
||||
['./packages/grpc-js-core/gulpfile', 'js.core'],
|
||||
['./packages/grpc-native/gulpfile', 'native'],
|
||||
['./packages/grpc-native-core/gulpfile', 'native.core'],
|
||||
['./packages/grpc-surface/gulpfile', 'surface'],
|
||||
['./packages/grpc-protobufjs/gulpfile', 'protobuf'],
|
||||
['./test/gulpfile', 'internal.test'],
|
||||
].forEach((args) => loadGulpTasksWithPrefix(args[0], args[1]));
|
||||
|
|
@ -61,18 +58,15 @@ function loadGulpTasksWithPrefix(path: string, prefix: string) {
|
|||
const root = __dirname;
|
||||
|
||||
gulp.task('install.all', 'Install dependencies for all subdirectory packages',
|
||||
['js.install', 'js.core.install', 'native.core.install', 'surface.install', 'health-check.install', 'protobuf.install', 'internal.test.install']);
|
||||
['js.core.install', 'native.core.install', 'health-check.install', 'protobuf.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', 'surface.install', 'health-check.install', 'protobuf.install', 'internal.test.install']);
|
||||
['js.core.install', 'native.core.install.windows', 'health-check.install', 'protobuf.install', 'internal.test.install']);
|
||||
|
||||
gulp.task('lint', 'Emit linting errors in source and test files',
|
||||
['js.core.lint', 'native.core.lint']);
|
||||
|
||||
gulp.task('build', 'Build packages', ['js.compile', 'js.core.compile', 'native.core.build', 'protobuf.compile']);
|
||||
|
||||
gulp.task('link.core', 'Add links to core packages without rebuilding',
|
||||
['js.link.add', 'native.link.add']);
|
||||
gulp.task('build', 'Build packages', ['js.core.compile', 'native.core.build', 'protobuf.compile']);
|
||||
|
||||
gulp.task('link.surface', 'Link to surface packages',
|
||||
['health-check.link.add']);
|
||||
|
|
@ -81,8 +75,7 @@ gulp.task('link', 'Link together packages', (callback) => {
|
|||
/**
|
||||
* We use workarounds for linking in some modules. See npm/npm#18835
|
||||
*/
|
||||
runSequence('link.core', 'link.surface',
|
||||
callback);
|
||||
runSequence('link.surface', callback);
|
||||
});
|
||||
|
||||
gulp.task('setup', 'One-time setup for a clean repository', (callback) => {
|
||||
|
|
@ -96,7 +89,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', 'js.clean.all', 'native.clean.all', 'protobuf.clean.all']);
|
||||
'internal.test.clean.all', 'protobuf.clean.all']);
|
||||
|
||||
gulp.task('native.test.only', 'Run tests of native code without rebuilding anything',
|
||||
['native.core.test', 'health-check.test']);
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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 linkSync = require('../../util').linkSync;
|
||||
|
||||
const jsDir = __dirname;
|
||||
|
||||
const execNpmVerb = (verb: string, ...args: string[]) =>
|
||||
execa('npm', [verb, ...args], {cwd: jsDir, stdio: 'inherit'});
|
||||
const execNpmCommand = execNpmVerb.bind(null, 'run');
|
||||
|
||||
gulp.task('clean.links', 'Delete npm links', () => {
|
||||
return del([path.resolve(jsDir, 'node_modules/@grpc/js-core'),
|
||||
path.resolve(jsDir, 'node_modules/@grpc/surface')]);
|
||||
});
|
||||
|
||||
gulp.task('clean.all', 'Delete all files created by tasks', ['clean.links']);
|
||||
|
||||
/**
|
||||
* Transpiles TypeScript files in src/ to JavaScript according to the settings
|
||||
* found in tsconfig.json.
|
||||
*/
|
||||
gulp.task('compile', 'Transpiles src/.', () => execNpmCommand('compile'));
|
||||
|
||||
gulp.task('install', 'Install dependencies', () => execNpmVerb('install'));
|
||||
|
||||
gulp.task('link.add', 'Link local copies of dependencies', () => {
|
||||
linkSync(jsDir, './node_modules/@grpc/js-core', '../grpc-js-core');
|
||||
linkSync(jsDir, './node_modules/@grpc/surface', '../grpc-surface');
|
||||
});
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "@grpc/js",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "build/src/index.js",
|
||||
"scripts": {
|
||||
"compile": "tsc -p .",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"check": "gts check",
|
||||
"clean": "gts clean",
|
||||
"fix": "gts fix",
|
||||
"prepare": "npm run compile",
|
||||
"pretest": "npm run compile",
|
||||
"posttest": "npm run check"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/grpc/grpc-node.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/grpc/grpc-node/issues"
|
||||
},
|
||||
"homepage": "https://grpc.io",
|
||||
"dependencies": {
|
||||
"@grpc/js-core": "^0.1.0",
|
||||
"@grpc/surface": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gts": "^0.5.1",
|
||||
"typescript": "~2.7.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* @license
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('@grpc/surface')(require('@grpc/js-core'));
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"extends": "./node_modules/gts/tsconfig-google.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "build"
|
||||
},
|
||||
"include": [
|
||||
"src/*.ts",
|
||||
"src/**/*.ts",
|
||||
"test/*.ts",
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* 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 linkSync = require('../../util').linkSync;
|
||||
|
||||
const nativeDir = __dirname;
|
||||
|
||||
gulp.task('clean.links', 'Delete npm links', () => {
|
||||
return del([path.resolve(nativeDir, 'node_modules/grpc'),
|
||||
path.resolve(nativeDir, 'node_modules/@grpc/surface')]);
|
||||
});
|
||||
|
||||
gulp.task('clean.all', 'Delete all files created by tasks',
|
||||
['clean.links']);
|
||||
|
||||
gulp.task('install', 'Install dependencies', () => {
|
||||
return execa('npm', ['install', '--unsafe-perm'], {cwd: nativeDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('link.add', 'Link local copies of dependencies', () => {
|
||||
linkSync(nativeDir, './node_modules/grpc', '../grpc-native-core');
|
||||
linkSync(nativeDir, './node_modules/@grpc/surface', '../grpc-surface');
|
||||
});
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* @license
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// TODO(mlumish): This should eventually be @grpc/native-core instead of grpc
|
||||
module.exports = require('@grpc/surface')(require('grpc'));
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"name": "@grpc/native",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/grpc/grpc-node.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/grpc/grpc-node/issues"
|
||||
},
|
||||
"homepage": "https://grpc.io",
|
||||
"dependencies": {
|
||||
"grpc": "^1.6.0",
|
||||
"@grpc/surface": "^0.1.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* 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('install', 'Install surface dependencies', () => {
|
||||
return execa('npm', ['install', '--unsafe-perm'], {cwd: surfaceDir, stdio: 'inherit'});
|
||||
});
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/**
|
||||
* @license
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
module.exports = function(grpc) {
|
||||
|
||||
let exports = {};
|
||||
|
||||
const Client = grpc.Client;
|
||||
|
||||
function getDefaultValues(metadata, options) {
|
||||
var res = {};
|
||||
res.metadata = metadata || new grpc.Metadata();
|
||||
res.options = options || {};
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map with wrappers for each type of requester function to make it use the old
|
||||
* argument order with optional arguments after the callback.
|
||||
* @access private
|
||||
*/
|
||||
var deprecated_request_wrap = {
|
||||
unary: function(makeUnaryRequest) {
|
||||
return function makeWrappedUnaryRequest(argument, callback,
|
||||
metadata, options) {
|
||||
/* jshint validthis: true */
|
||||
var opt_args = getDefaultValues(metadata, metadata);
|
||||
return makeUnaryRequest.call(this, argument, opt_args.metadata,
|
||||
opt_args.options, callback);
|
||||
};
|
||||
},
|
||||
client_stream: function(makeServerStreamRequest) {
|
||||
return function makeWrappedClientStreamRequest(callback, metadata,
|
||||
options) {
|
||||
/* jshint validthis: true */
|
||||
var opt_args = getDefaultValues(metadata, options);
|
||||
return makeServerStreamRequest.call(this, opt_args.metadata,
|
||||
opt_args.options, callback);
|
||||
};
|
||||
},
|
||||
server_stream: _.identity,
|
||||
bidi: _.identity
|
||||
};
|
||||
|
||||
/**
|
||||
* Map with short names for each of the requester maker functions. Used in
|
||||
* makeClientConstructor
|
||||
* @private
|
||||
*/
|
||||
const requester_funcs = {
|
||||
unary: Client.prototype.makeUnaryRequest,
|
||||
server_stream: Client.prototype.makeServerStreamRequest,
|
||||
client_stream: Client.prototype.makeClientStreamRequest,
|
||||
bidi: Client.prototype.makeBidiStreamRequest
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a constructor for a client with the given methods, as specified in
|
||||
* the methods argument. The resulting class will have an instance method for
|
||||
* each method in the service, which is a partial application of one of the
|
||||
* [Client]{@link grpc.Client} request methods, depending on `requestSerialize`
|
||||
* and `responseSerialize`, with the `method`, `serialize`, and `deserialize`
|
||||
* arguments predefined.
|
||||
* @memberof grpc
|
||||
* @alias grpc~makeGenericClientConstructor
|
||||
* @param {grpc~ServiceDefinition} methods An object mapping method names to
|
||||
* method attributes
|
||||
* @param {string} serviceName The fully qualified name of the service
|
||||
* @param {Object} class_options An options object.
|
||||
* @return {function} New client constructor, which is a subclass of
|
||||
* {@link grpc.Client}, and has the same arguments as that constructor.
|
||||
*/
|
||||
exports.makeClientConstructor = function(methods, serviceName,
|
||||
class_options) {
|
||||
if (!class_options) {
|
||||
class_options = {};
|
||||
}
|
||||
|
||||
function ServiceClient(address, credentials, options) {
|
||||
Client.call(this, address, credentials, options);
|
||||
}
|
||||
|
||||
util.inherits(ServiceClient, Client);
|
||||
|
||||
_.each(methods, function(attrs, name) {
|
||||
var method_type;
|
||||
// TODO(murgatroid99): Verify that we don't need this anymore
|
||||
if (_.startsWith(name, '$')) {
|
||||
throw new Error('Method names cannot start with $');
|
||||
}
|
||||
if (attrs.requestStream) {
|
||||
if (attrs.responseStream) {
|
||||
method_type = 'bidi';
|
||||
} else {
|
||||
method_type = 'client_stream';
|
||||
}
|
||||
} else {
|
||||
if (attrs.responseStream) {
|
||||
method_type = 'server_stream';
|
||||
} else {
|
||||
method_type = 'unary';
|
||||
}
|
||||
}
|
||||
var serialize = attrs.requestSerialize;
|
||||
var deserialize = attrs.responseDeserialize;
|
||||
var method_func = _.partial(requester_funcs[method_type], attrs.path,
|
||||
serialize, deserialize);
|
||||
if (class_options.deprecatedArgumentOrder) {
|
||||
ServiceClient.prototype[name] = deprecated_request_wrap(method_func);
|
||||
} else {
|
||||
ServiceClient.prototype[name] = method_func;
|
||||
}
|
||||
// Associate all provided attributes with the method
|
||||
_.assign(ServiceClient.prototype[name], attrs);
|
||||
if (attrs.originalName) {
|
||||
ServiceClient.prototype[attrs.originalName] = ServiceClient.prototype[name];
|
||||
}
|
||||
});
|
||||
|
||||
ServiceClient.service = methods;
|
||||
|
||||
return ServiceClient;
|
||||
};
|
||||
|
||||
return Object.assign(exports, grpc);
|
||||
};
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "@grpc/surface",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/grpc/grpc-node.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/grpc/grpc-node/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue