@bconnorwhite/module
Read your module's package.json without importing it
Last updated 4 years ago by bconnorwhite .
MIT · Repository · Original npm · Tarball · package.json
$ gnpm install @bconnorwhite/module 
SYNC missed versions from official npm registry.

@bconnorwhite/module

npm typescript GitHub stars Twitter Follow

Read your module's package.json without importing it.

Why not just import your package.json? Importing your package.json can break your project's structure when using TypeScript if package.json is outside of your source folder.

Installation

yarn add @bconnorwhite/module
npm install @bconnorwhite/module

API

import {
  PackageJSON,
  getPackageJSON,
  getPackageJSONSync,
  getVersion,
  getVersionSync
} from "@bconnorwhite/module";

function getPackageJSON(dirname: string): Promise<PackageJSON | undefined>;

function getPackageJSONSync(dirname: string): PackageJSON | undefined;

function getVersion(dirname: string): Promise<string | undefined>;

function getVersionSync(dirname: string): string | undefined;

Dependenciesdependencies

  • find-up: Find a file or directory by walking up parent directories
  • read-json-safe: Read objects from JSON files without try catch.
  • types-pkg-json: Type checking for package.json

Dev DependenciesDavid


License license

MIT


Related Packages

  • @bconnorwhite/package: A utility for reading package.json of a project, and forming paths relative to it.

Current Tags

  • 2.0.2                                ...           latest (4 years ago)

10 Versions

  • 1.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.6                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)

Copyright 2013 - present © cnpmjs.org | Home |