Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@homer0/package-info

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@homer0/package-info

Gets the content of the project's package.json

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-10%
Maintainers
1
Weekly downloads
 
Created
Source

📦 Package info

A tiny service that reads the contents of the project's package.json, sync & async.

🍿 Usage

⚠️ This package is only for Node.

  • ⚙️ Examples
  • 🤘 Development

⚙️ Example

import { packageInfo } from '@homer0/package-info';

const pkg = packageInfo();

// ...

const info = await pkg.get();
// or
const info = pkg.getSync();
Jimple provider

If your app uses a Jimple container, you can register PackageInfo as the packageInfo service by using its provider:

import { packageInfoProvider } from '@homer0/package-info';

// ...

container.register(packageInfoProvider);

// ...

const info = container.get('packageInfo');

And since the provider is a "provider creator" (created with my custom version of Jimple), you can customize its service name:

container.register(
  packageInfoProvider({
    serviceName: 'myPackageInfo',
  }),
);
Dependencies

PackageInfo depends on the following services, and when used with Jimple, it will try to find them in the container, otherwise, it will create new instances:

  • @homer0/path-utils, with the name pathUtils. Used to generate the paths relative to the project root.

If you already implement the dependencies, but with a different name, you can specify them in the provider:

container.register(
  packageInfoProvider({
    services: {
      pathUtils: 'myPathUtils',
    },
  }),
);

🤘 Development

As this project is part of the packages monorepo, it requires Yarn, and some of the tooling, like ESLint and Husky, are installed on the root's package.json.

Yarn tasks
TaskDescription
testRuns the unit tests.
buildBundles the project.

Keywords

FAQs

Package last updated on 12 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc