@zero-version/monorepo.get-monorepo-meta.memoise
TypeScript icon, indicating that this package has built-in type declarations

9.9.14 • Public • Published

Memoised Monorepo utility.

Usage

This memoised getMonorepoMeta function is specifically for CLI tools which are used in multiple packages in a monorepo. When the CLI tool invokes getMonorepoMeta for the first package, it will cache the results of the in a monorepo.json file in the solution's directory. Subsequent calls by other packages will use the cached data, until the cache expires after 1 minute.

import { getMonorepoMeta } from '@zero-version/monorepo.get-monorepo-meta.memoise';

const getMonorepoMeta = makeGetMonorepoMeta();
console.log(getMonorepoMeta(process.cwd()));
// -> eg.
// {
//   "solution": {
//     "dir": "/dir/to/solution",
//     "name": "<solution-name>",
//     "description": "<solution-description>",
//     "dependencies": {
//       <solution-dependencies>
//     },
//     "devDependencies": {
//       <solution-devDependencies>
//     }
//   },
//   "projects": [
//     {
//       "dir": "/dir/to/solution/packages/project-1",
//       "private": false,
//       "name": "<project-1-name>",
//       "description": "<project-1-description>",
//       "dependencies": {
//         <project-1-dependencies>
//       },
//       "devDependencies": {
//         <project-1-devDependencies>
//       }
//     },
//     {
//       "dir": "/dir/to/solution/packages/project-2",
//       "private": false,
//       "name": "<project-2-name>",
//       "description": "<project-2-description>",
//       "dependencies": {
//         <project-2-dependencies>
//       },
//       "devDependencies": {
//         <project-2-devDependencies>
//       }
//     },
//   ]
// }

Support

Are you using a package I've developed and finding it useful? Or have you looked at one of my repositories and learnt something new? If so, please consider buying me a coffee. Thanks!

Package Sidebar

Install

npm i @zero-version/monorepo.get-monorepo-meta.memoise

Weekly Downloads

1

Version

9.9.14

License

UNLICENSED

Unpacked Size

4.07 kB

Total Files

5

Last publish

Collaborators

  • andrewcrobertson