squash! grpc-js: rename grpc-js-core to match npm

This commit is contained in:
cjihrig 2018-11-04 11:20:08 -05:00
parent 489305db79
commit c8266e56d0
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
1 changed files with 11 additions and 7 deletions

View File

@ -5,15 +5,19 @@
const _ = require('lodash'); const _ = require('lodash');
function getImplementation(globalField) { function getImplementation(globalField) {
if (global[globalField] !== 'js' && global[globalField] !== 'native') { const impl = global[globalField];
if (impl === 'js') {
return require(`../packages/grpc-${impl}`);
} else if (impl === 'native') {
return require(`../packages/grpc-${impl}-core`);
}
throw new Error([ throw new Error([
`Invalid value for global.${globalField}: ${global.globalField}.`, `Invalid value for global.${globalField}: ${global.globalField}.`,
'If running from the command line, please --require a fixture first.' 'If running from the command line, please --require a fixture first.'
].join(' ')); ].join(' '));
} }
const impl = global[globalField];
return require(`../packages/grpc-${impl}-core`);
}
const clientImpl = getImplementation('_client_implementation'); const clientImpl = getImplementation('_client_implementation');
const serverImpl = getImplementation('_server_implementation'); const serverImpl = getImplementation('_server_implementation');