Usage

Installation

npm install --save @thebespokepixel/meta

Setup

Import (or require) the module…

import {dirname} from 'node:path'
import {fileURLToPath} from 'node:url'
import meta from '@thebespokepixel/meta'

const metadata = meta(dirname(fileURLToPath(import.meta.url))) // Start searching from inside this scripts module

API

Look up the file system hierarchy, starting from the current working directory or provided path for a package file and return specific package metadata as a sanitised map.

Creates the metadata collection function, starting at the path provided or the current working directory by default.

meta(cwd: string) → metadata
Parameters
cwd (string) The directory to start searching for a package.json file.
Returns
metadata: The map of reduced package metadata.

Extract metadata for sharing inside a package.

metadata

Type: metadata

Properties
name (string) : The package's name
bin (string) : The CLI binary we provide
description (string) : The description from package.json
copyright (string) : Copyright info from package.json
license (string) : The package license
bugs (string) : Our issues queue
bin (string) : Declared package binaries
Static Members
version(style)