Skip to content

PackageJsonFile

A file containing a package.json that defines a package. When placed inside a PackageDirectory, it will contain dependencies and exports for symbols defined inside the package. Additional dependencies and exports can be provided.

import { PackageJsonFile } from "@alloy-js/typescript";
<PackageJsonFile
author="string"
dependencies={Record<string, string>}
description="string"
devDependencies={Record<string, string>}
exports={PackageExports | ExportPath}
homepage="string"
keywords={string[]}
license="string"
name="string"
peerDependencies={Record<string, string>}
repository={string | {
type: string;
url: string;
}}
scripts={Record<string, string>}
type={"module" | "commonjs"}
version="string"
/>
authoroptional stringThe author of the package
dependenciesoptional Record<string, string>The hard-coded dependencies of the package. References to external packages will add to the dependency list automatically. Only list dependencies here that are not referenced via refkey.
descriptionoptional stringThe description of the package
devDependenciesoptional Record<string, string>The dev dependencies of the package.
exportsoptional PackageExports | ExportPathThe hard-coded exports of the package.
homepageoptional stringThe homepage of the package
keywordsoptional string[]The keywords of the package
licenseoptional stringThe license of the package
namestringThe name of the package
peerDependenciesoptional Record<string, string>The peer dependencies of the package.
repositoryoptional string | { type: string; url: string; }The repository of the package
scriptsoptional Record<string, string>The scripts entries of the package.
typeoptional “module” | “commonjs”Whether this is a commonjs or module. Defaults to module.
versionstringThe version of the package
<PackageJsonFile name="my-package" version="1.0.0" />