mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-11 09:28:24 -04:00
46 lines
852 B
Markdown
46 lines
852 B
Markdown
# @pnpm/modules-yaml
|
|
|
|
> Reads/writes \`node_modules/.modules.yaml\`
|
|
|
|
<!--@shields('npm')-->
|
|
[](https://www.npmjs.com/package/@pnpm/modules-yaml)
|
|
<!--/@-->
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
<pnpm|npm|yarn> add @pnpm/modules-yaml
|
|
```
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import {write, read} from '@pnpm/modules-yaml'
|
|
|
|
await write('node_modules', {
|
|
hoistedAliases: {}
|
|
layoutVersion: 1,
|
|
packageManager: 'pnpm@1.0.0',
|
|
pendingBuilds: [],
|
|
shamefullyFlatten: false,
|
|
skipped: [],
|
|
storeDir: '/home/user/.pnpm-store',
|
|
})
|
|
|
|
const modulesYaml = await read(`node_modules`)
|
|
```
|
|
|
|
## API
|
|
|
|
### `read(pathToDir): Promise<ModulesObject>`
|
|
|
|
Reads `.modules.yaml` from the specified directory.
|
|
|
|
### `write(pathToDir, ModulesObject): Promise<void>`
|
|
|
|
Writes a `.modules.yaml` file to the specified directory.
|
|
|
|
## License
|
|
|
|
MIT
|