How to use the pkg-dir function in pkg-dir

To help you get started, we’ve selected a few pkg-dir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RadarTech / lnrpc / src / rpc / ln-rpc.ts View on Github external
export async function createLnRpc(userConfig: LnRpcClientConfig): Promise {
  const rootPath = await pkgDir(__dirname);
  const protoFilePath = join(
    rootPath,
    `lnd/${packageJson.config['lnd-release-tag']}/rpc.proto`,
  );

  // Configuration options
  const config = {
    ...defaults,
    ...userConfig,
  };
  const { lightning, walletUnlocker, server, grpcLoader, grpc, includeDefaults } = config;

  // Generate grpc SSL credentials
  const credentials = await createCredentials(config);

  // Create RPC from proto and return GRPC
github RadarTech / lnrpc / src / rpc / chain-rpc.ts View on Github external
export async function createChainRpc(userConfig: ChainRpcClientConfig): Promise {
  const rootPath = await pkgDir(__dirname);
  const protoFilePath = join(
    rootPath,
    `lnd/${packageJson.config['lnd-release-tag']}/chainrpc/chainnotifier.proto`,
  );

  // Configuration options
  const config = {
    ...defaults,
    ...userConfig,
  };
  const { chainNotifier, server, grpcLoader, grpc, includeDefaults } = config;

  // Generate grpc SSL credentials
  const credentials = await createCredentials(config);

  // Create RPC from proto and return GRPC
github tommy351 / kosko / integration / run.ts View on Github external
export async function runCLI(
  args: string[],
  options: execa.Options = {}
): Promise {
  const root = await pkgDir();

  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  return execa(join(root!, "packages", "cli", "bin", "kosko.js"), args, {
    ...options,
    env: {
      LC_ALL: "en_US",
      ...options.env
    }
  });
}
github RadarTech / lnrpc / src / rpc / wallet-rpc.ts View on Github external
export async function createWalletRpc(userConfig: WalletRpcClientConfig): Promise {
  const rootPath = await pkgDir(__dirname);
  const lndProtosRootPath = join(
    rootPath,
    `lnd/${packageJson.config['lnd-release-tag']}`,
  );
  const protoFilePath = join(
    lndProtosRootPath,
    '/walletrpc/walletkit.proto',
  );

  // Configuration options
  const config = {
    ...defaults,
    ...userConfig,
  };
  const { walletKit, server, grpcLoader, grpc, includeDefaults } = config;
github josa42 / coc-sh / src / extension.ts View on Github external
commands.registerCommand("sh.version", async () => {
      const rootDir = await pkgDir(__dirname)
      const v = require(path.resolve(rootDir, 'package.json')).version
      workspace.showMessage(`Version: ${v} [node: ${process.versions.node}]`, 'more')
    })
  )
github wechaty / wechaty / src / puppet-manager.ts View on Github external
public static async installAll (): Promise {
    log.info('PuppetManager', 'installAll() please wait ...')

    const moduleList: string[] = []

    for (const puppetModuleName of Object.keys(PUPPET_DEPENDENCIES)) {
      const version = PUPPET_DEPENDENCIES[puppetModuleName as PuppetModuleName]
      if (version !== '0.0.0') {
        moduleList.push(`${puppetModuleName}@${version}`)
      }
    }

    await npm.install(
      moduleList,
      {
        cwd    : await pkgDir(__dirname),
        output : true,
        save   : false,
      },
    )

  }
github wechaty / wechaty / src / puppet-manager.ts View on Github external
public static async install (
    puppetModule: string,
    puppetVersion = 'latest',
  ): Promise {
    log.info('PuppetManager', 'install(%s@%s) please wait ...', puppetModule, puppetVersion)

    if (puppetModule === 'wechaty-puppet-puppeteer') {
      await this.preInstallPuppeteer()
    }

    await npm.install(
      `${puppetModule}@${puppetVersion}`,
      {
        cwd    : await pkgDir(__dirname),
        output : true,
        save   : false,
      },
    )
    log.info('PuppetManager', 'install(%s@%s) done', puppetModule, puppetVersion)
  }
github neoclide / coc-tslint / src / index.ts View on Github external
async function projectRoot(): Promise {
  let dir = await baseDir()
  let root = await pkgDir(dir)
  if (!root) {
    workspace.showMessage('Project root not found, package.json not exists.', 'error')
    return null
  }
  return root
}

pkg-dir

Find the root directory of a Node.js project or npm package

MIT
Latest version published 7 months ago

Package Health Score

76 / 100
Full package analysis