9.9.14 • Published 3 years ago

@zero-version/monorepo.get-monorepo-meta.memoise v9.9.14

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
3 years ago

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!