How to use the @pnpm/modules-yaml.read function in @pnpm/modules-yaml

To help you get started, we’ve selected a few @pnpm/modules-yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pnpm / pnpm / packages / read-importers-context / src / index.ts View on Github external
hoistedAliases: { [depPath: string]: string[] },
  importers: Array<{
    id: string,
    modulesDir: string,
  } & T & Required>,
  include: Record,
  independentLeaves: boolean | undefined,
  modules: Modules | null,
  pendingBuilds: string[],
  registries: Registries | null | undefined,
  rootModulesDir: string,
  shamefullyHoist?: boolean,
  skipped: Set,
}> {
  const rootModulesDir = await realNodeModulesDir(lockfileDir)
  const modules = await readModulesYaml(rootModulesDir)
  return {
    currentHoistPattern: modules?.hoistPattern || undefined,
    hoist: !modules ? undefined : Boolean(modules.hoistPattern),
    hoistedAliases: modules?.hoistedAliases || {},
    importers: await Promise.all(
      importers.map(async (importer) => {
        const modulesDir = await realNodeModulesDir(importer.rootDir)
        const importerId = getLockfileImporterId(lockfileDir, importer.rootDir)

        return {
          ...importer,
          binsDir: importer.binsDir || path.join(importer.rootDir, 'node_modules', '.bin'),
          id: importerId,
          modulesDir,
        }
      })),
github pnpm / pnpm / privatePackages / assert-project / src / index.ts View on Github external
async function getVirtualStoreDir () {
    const modulesYaml = await readModules(modules)
    if (!modulesYaml) {
      return path.join(modules, '.pnpm')
    }
    return modulesYaml.virtualStoreDir
  }
github pnpm / pnpm / packages / plugin-commands-outdated / src / outdated.ts View on Github external
export async function outdatedDependenciesOfWorkspacePackages (
  pkgs: Array<{dir: string, manifest: ImporterManifest}>,
  args: string[],
  opts: OutdatedOptions,
) {
  const lockfileDir = opts.lockfileDir || opts.dir
  const modules = await readModulesManifest(path.join(lockfileDir, 'node_modules'))
  const virtualStoreDir = modules?.virtualStoreDir || path.join(lockfileDir, 'node_modules/.pnpm')
  const currentLockfile = await readCurrentLockfile(virtualStoreDir, { ignoreIncompatible: false })
  const wantedLockfile = await readWantedLockfile(lockfileDir, { ignoreIncompatible: false }) || currentLockfile
  if (!wantedLockfile) {
    throw new PnpmError('OUTDATED_NO_LOCKFILE', 'No lockfile in this directory. Run `pnpm install` to generate one.')
  }
  const storeDir = await storePath(opts.dir, opts.store)
  const getLatestManifest = createLatestManifestGetter({
    ...opts,
    lockfileDir,
    storeDir,
  })
  return Promise.all(pkgs.map(async ({ dir, manifest }) => {
    let match = args.length && matcher(args) || undefined
    return {
      manifest,

@pnpm/modules-yaml

Reads/writes `node_modules/.modules.yaml`

MIT
Latest version published 3 days ago

Package Health Score

66 / 100
Full package analysis

Popular @pnpm/modules-yaml functions