@vyriy/package
v0.8.9
Published
Shared package.json helpers for Vyriy projects
Readme
@vyriy/package
Part of Vyriy - a calm architecture toolkit for TypeScript, React, SSR, SSG, APIs, and cloud-ready apps.
Full documentation: https://vyriy.dev/docs/package/
Helpers for reading and caching package.json in Vyriy projects.
Purpose
This package provides a small helper for reading the project package.json.
The file is read lazily:
- the first call reads and parses
package.json - the parsed result is cached
- all next calls return the cached object
Install
With npm:
npm install @vyriy/packageWith Yarn:
yarn add @vyriy/packageUsage
import { getPackage } from '@vyriy/package';
const package = getPackage();
console.log(package.name);
console.log(package.version);You can also narrow the fields you need:
import { getPackage } from '@vyriy/package';
const { name, scripts } = getPackage();
console.log(name);
console.log(scripts?.build);API
getPackage()
- reads the root
package.jsonfile on first access - caches the parsed object
- returns the cached
Packageobject on later calls
Exported Types
Package
