Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

691 B
Raw Blame
import { parseAllDocuments } from 'yaml'

/** Strips pnpm's peer suffix: `43.7.5([email protected])` -> `43.7.5`. */
export function lockedVersion(entry) {
  const version = typeof entry === 'string' ? entry : entry?.version
  return typeof version === 'string' ? version.replace(/\(.*$/, '') : null
}

/** pnpm 12 splits the lockfile into a package-manager document and the project one; merge both. */
export function lockfileRootImporter(contents) {
  const importer = {}
  for (const document of parseAllDocuments(contents)) {
    if (document.errors.length) {
      throw document.errors[0]
    }
    Object.assign(importer, document.toJS()?.importers?.['.'])
  }
  return importer
}