Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pkgu

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkgu

Yarn Workspaces package utils.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by12.5%
Maintainers
3
Weekly downloads
 
Created
Source

pkgu npm

Yarn Workspaces package utils.

Install

$ yarn add pkgu

Usage

type TPackageJson = {
  name: string,
  version: string,
  // …
}

type TPackages = Map<string, {
  dir: string,
  json: TPackageJson
}>

const getPackageDirs: () => Promise<Set<string>>

const getPackages: () => Promise<TPackages>

const readPackageJson: (packageDir: string) => Promise<TPackageJson>

const writePackageJson: (packageDir: string, packageJson: TPackageJson) => Promise<void>
import { getPackageDirs, getPackages, readPackageJson, writePackageJson } from 'pkgu'

console.log(
  await getPackageDirs()
)
// Set(2) { '/…/packages/bar', '/…/packages/baz' }

console.log(
  await getPackages()
)
// Map(2) {
//   'bar' => {
//     dir: '/…/packages/bar',
//     json: {
//       name: 'bar',
//       version: '1.0.0'
//     }
//   },
//   'baz' => {
//     dir: '/…/packages/baz',
//     json: {
//       name: 'baz',
//       version: '2.0.0'
//     }
//   },
// }

console.log(
  await readPackageJson('/…/packages/bar') 
)
// {
//   name: 'bar',
//   version: '1.0.0'
// }

await writePackageJson('/…/packages/bar', { name: 'foo' }) 

console.log(
  await readPackageJson('/…/packages/bar') 
)
// { name: 'foo' }

FAQs

Package last updated on 18 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc