grpc-js: Fix how package.json is loaded

This commit is contained in:
Michael Lumish 2020-04-14 13:58:12 -07:00
parent 227a35e899
commit b489935b7c
3 changed files with 4 additions and 4 deletions

View File

@ -5,6 +5,7 @@
"node/no-unpublished-import": ["error", { "node/no-unpublished-import": ["error", {
"tryExtensions": [".ts", ".js", ".json", ".node"] "tryExtensions": [".ts", ".js", ".json", ".node"]
}], }],
"@typescript-eslint/no-unused-vars": "off" "@typescript-eslint/no-unused-vars": "off",
"node/no-unpublished-require": "off"
} }
} }

View File

@ -62,8 +62,7 @@ import {
ServerDuplexStream, ServerDuplexStream,
} from './server-call'; } from './server-call';
import { engines as supportedEngines } from '../package.json'; const supportedNodeVersions = require('../../package.json').engines.node;
const supportedNodeVersions = supportedEngines.node;
if (!semver.satisfies(process.version, supportedNodeVersions)) { if (!semver.satisfies(process.version, supportedNodeVersions)) {
throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`); throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`);
} }

View File

@ -29,7 +29,7 @@ import { LogVerbosity } from './constants';
import { shouldUseProxy, getProxiedConnection } from './http_proxy'; import { shouldUseProxy, getProxiedConnection } from './http_proxy';
import * as net from 'net'; import * as net from 'net';
import { version as clientVersion } from '../package.json'; const clientVersion = require('../../package.json').version;
const TRACER_NAME = 'subchannel'; const TRACER_NAME = 'subchannel';