# PackageJsonFile

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

* jsx

  ```tsx
  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"
   />
  ```

* stc

  ```ts
  import { PackageJsonFile } from "@alloy-js/typescript/stc";


  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,
  }).children(children)
  ```

## Props

|                  |                                                                                                |                                                                                                                                                                                            |
| ---------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| author           | optional string                                                                                | The author of the package                                                                                                                                                                  |
| dependencies     | optional 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. |
| description      | optional string                                                                                | The description of the package                                                                                                                                                             |
| devDependencies  | optional Record\<string, string>                                                               | The dev dependencies of the package.                                                                                                                                                       |
| exports          | optional[PackageExports](../../types/packageexports/) \| [ExportPath](../../types/exportpath/) | The hard-coded exports of the package.                                                                                                                                                     |
| homepage         | optional string                                                                                | The homepage of the package                                                                                                                                                                |
| keywords         | optional string\[]                                                                             | The keywords of the package                                                                                                                                                                |
| license          | optional string                                                                                | The license of the package                                                                                                                                                                 |
| name             | string                                                                                         | The name of the package                                                                                                                                                                    |
| peerDependencies | optional Record\<string, string>                                                               | The peer dependencies of the package.                                                                                                                                                      |
| repository       | optional string \| { type: string; url: string; }                                              | The repository of the package                                                                                                                                                              |
| scripts          | optional Record\<string, string>                                                               | The scripts entries of the package.                                                                                                                                                        |
| type             | optional “module” \| “commonjs”                                                                | Whether this is a commonjs or module. Defaults to module.                                                                                                                                  |
| version          | string                                                                                         | The version of the package                                                                                                                                                                 |

## Example

```tsx
<PackageJsonFile name="my-package" version="1.0.0" />
```
