@anolilab/package-json-utils
Version:
Shared utilities for parsing information from a package.json.
40 lines (37 loc) • 2.64 kB
text/typescript
import { NormalizedPackageJson } from 'read-pkg';
declare const getPackageProperty: <T = unknown>(property: string) => T | undefined;
declare const getPackageSubProperty: <T = unknown>(packageProperty: string) => (property: string) => T | undefined;
declare const hasPackageProperty: (property: string) => boolean;
declare const hasPackageSubProperty: (packageProperty: string) => (property: string) => boolean;
declare const hasPackageProperties: (properties: string[], strict?: boolean) => boolean;
declare const hasPackageSubProperties: (packageProperty: string) => (properties: string[], strict?: boolean) => boolean;
declare const environmentIsSet: (name: string) => boolean;
declare const parseEnvironment: <ReturnValue = any>(name: string, defaultValue: ReturnValue) => ReturnValue;
declare const projectPath: string;
declare const appDirectory: string;
declare const fromRoot: (...p: string[]) => string;
declare const hasFile: (...p: string[]) => boolean;
declare const hasScripts: (properties: string[], strict?: boolean) => boolean;
declare const hasPeerDependency: (property: string) => boolean;
declare const hasPeerDependencies: (properties: string[], strict?: boolean) => boolean;
declare const hasDependency: (property: string) => boolean;
declare const hasDependencies: (properties: string[], strict?: boolean) => boolean;
declare const hasDevDependency: (property: string) => boolean;
declare const hasDevDependencies: (properties: string[], strict?: boolean) => boolean;
declare const hasAnyDep: (arguments_: string[], options?: {
peerDeps?: boolean;
strict?: boolean;
}) => boolean;
declare const hasTypescript: boolean;
declare const packageIsTypeModule: boolean;
declare const resolvePackage: (packageName: string) => string | undefined;
declare const isPackageAvailable: (packageName: string) => boolean;
declare const showMissingPackages: (packageName: string, packages: string[], options?: {
consoleType?: "error" | "info" | "log" | "warn";
exit?: boolean;
postMessage?: string;
preMessage?: string;
}) => void;
declare const unique: (array: unknown[]) => unknown[];
declare const pkg: NormalizedPackageJson | undefined;
export { appDirectory, environmentIsSet, fromRoot, getPackageProperty, getPackageSubProperty, hasAnyDep, hasDependencies, hasDependency, hasDevDependencies, hasDevDependency, hasFile, hasPackageProperties, hasPackageProperty, hasPackageSubProperties, hasPackageSubProperty, hasPeerDependencies, hasPeerDependency, hasScripts, hasTypescript, isPackageAvailable, packageIsTypeModule, parseEnvironment, pkg, projectPath, resolvePackage, showMissingPackages, unique };