UNPKG

@whisklabs/grpc

Version:

gRPC generator and http library for typescript

43 lines 2.14 kB
#!/usr/bin/env node /* eslint-disable camelcase */ var _a, _b; import { isPresent, isText } from '@whisklabs/typeguards'; import { existsSync } from 'fs'; import { join } from 'path'; import { generator } from './main'; var _c = process.env, PROTO_DIR = _c.PROTO_DIR, PROTO_OUT = _c.PROTO_OUT, PROTO_EXCLUDE = _c.PROTO_EXCLUDE, PROTO_VERSION = _c.PROTO_VERSION, PROTO_DEBUG = _c.PROTO_DEBUG, PROTO_PACKAGE_NAME = _c.PROTO_PACKAGE_NAME, PROTO_PACKAGE_VERSION = _c.PROTO_PACKAGE_VERSION, PROTO_PACKAGE_URL = _c.PROTO_PACKAGE_URL, PROTO_PACKAGE_REGISTRY = _c.PROTO_PACKAGE_REGISTRY, PROTO_MESSAGE_REQUIRED = _c.PROTO_MESSAGE_REQUIRED, npm_package_devDependencies__whisklabs_grpc = _c.npm_package_devDependencies__whisklabs_grpc, npm_package_dependencies__whisklabs_grpc = _c.npm_package_dependencies__whisklabs_grpc; if (!isText(PROTO_DIR)) { throw new Error('No PROTO_DIR input folder'); } if (!isText(PROTO_OUT)) { throw new Error('No PROTO_OUT out folder'); } // eslint-disable-next-line @typescript-eslint/no-floating-promises generator({ dir: PROTO_DIR, out: PROTO_OUT, version: isText(PROTO_VERSION) ? PROTO_VERSION : (_b = (_a = findRoot()) !== null && _a !== void 0 ? _a : npm_package_devDependencies__whisklabs_grpc) !== null && _b !== void 0 ? _b : npm_package_dependencies__whisklabs_grpc, exclude: isText(PROTO_EXCLUDE) ? new RegExp(PROTO_EXCLUDE) : undefined, messageRequired: isPresent(PROTO_MESSAGE_REQUIRED), debug: PROTO_DEBUG === 'true', packageName: PROTO_PACKAGE_NAME, packageVersion: PROTO_PACKAGE_VERSION, packageUrl: PROTO_PACKAGE_URL, packageRegistry: PROTO_PACKAGE_REGISTRY, }).then(function (error) { return process.exit(error ? 1 : 0); }); function findRoot() { var _a; var path = __dirname; var file = 'package.json'; while (!existsSync(join(path, file))) { if (path === process.cwd()) { return undefined; } path = join(path, '..'); } // eslint-disable-next-line return (_a = require(join(path, file))) === null || _a === void 0 ? void 0 : _a.version; } //# sourceMappingURL=cli.js.map