UNPKG

workspace-tools

Version:

A collection of tools that are useful in a git-controlled monorepo that is managed by one of these software:

24 lines (23 loc) 891 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const nameAtVersion_1 = require("./nameAtVersion"); function parsePnpmLock(yaml) { const object = {}; if (yaml && yaml.packages) { for (const [pkgSpec, snapshot] of Object.entries(yaml.packages)) { // TODO: handle file:foo.tgz syntax (rush uses this for internal package links) const specParts = pkgSpec.split(/\//); const name = specParts.length > 3 ? `${specParts[1]}/${specParts[2]}` : specParts[1]; const version = specParts.length > 3 ? specParts[3] : specParts[2]; object[nameAtVersion_1.nameAtVersion(name, version)] = { version, dependencies: snapshot.dependencies, }; } } return { object, type: "success" }; } exports.parsePnpmLock = parsePnpmLock;