3.0.4 • Published 1 month ago

@homer0/package-info v3.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

📦 Package info

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

🍿 Usage

⚠️ This package is only for Node.

⚙️ 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, some of the tooling, like lint-staged and husky, are installed on the root's package.json.

Tasks

TaskDescription
lintLints the package.
testRuns the unit tests.
buildTranspiles the project.
types:checkValidates the TypeScript types.
3.0.4

1 month ago

3.0.3

2 months ago

3.0.2

3 months ago

3.0.1

5 months ago

3.0.0

7 months ago

2.0.7

10 months ago

2.0.6

10 months ago

2.0.3

11 months ago

2.0.5

11 months ago

2.0.4

11 months ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago