{"name":"@npmcli/map-workspaces","version":"2.0.0","keywords":["npm","npmcli","libnpm","cli","workspaces","map-workspaces"],"author":{"name":"GitHub Inc."},"license":"ISC","_id":"@npmcli/map-workspaces@2.0.0","maintainers":[{"name":"fritzy","email":"fritzy@github.com"},{"name":"isaacs","email":"i@izs.me"},{"name":"darcyclarke","email":"darcy@darcyclarke.me"},{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},{"name":"nlf","email":"quitlahok@gmail.com"},{"name":"gar","email":"gar+npm@danger.computer"},{"name":"lukekarrys","email":"luke@lukekarrys.com"}],"homepage":"https://github.com/npm/map-workspaces#readme","bugs":{"url":"https://github.com/npm/map-workspaces/issues"},"tap":{"check-coverage":true},"dist":{"shasum":"e342efbbdd0dad1bba5d7723b674ca668bf8ac5a","tarball":"http://registry-npm.ywwl.com/@npmcli/map-workspaces/download/@npmcli/map-workspaces-2.0.0.tgz","fileCount":4,"integrity":"sha512-QBJfpCY1NOAkkW3lFfru9VTdqvMB2TN0/vrevl5xBCv5Fi0XDVcA6rqqSau4Ysi4Iw3fBzyXV7hzyTBDfadf7g==","signatures":[{"sig":"MEYCIQDlrNo5cmJf/nCQD3p/xYOfwFxnLjFwxaE3+1vcGSJo2AIhAPgicEaJt8kwenoZXAWjVijE2eULQNoUzQ1ErN/eTgE6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8969,"size":3519,"noattachment":false,"key":"/@npmcli/map-workspaces/-/@npmcli/map-workspaces-2.0.0.tgz"},"main":"lib/index.js","engines":{"node":"^12.13.0 || ^14.15.0 || >=16"},"gitHead":"626f59b597b001aa8e6649a8047897052172c408","scripts":{"lint":"eslint '**/*.js'","snap":"tap","test":"tap","lintfix":"npm run lint -- --fix","pretest":"npm run lint","postlint":"npm-template-check","posttest":"npm run lint","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"gar","email":"gar+npm@danger.computer"},"standard":{"ignore":["/tap-snapshots/"]},"repository":{"url":"git+https://github.com/npm/map-workspaces.git","type":"git"},"_npmVersion":"8.0.0","description":"Retrieves a name:pathname Map for a given workspaces config","directories":{},"_nodeVersion":"14.18.0","dependencies":{"glob":"^7.1.6","minimatch":"^3.0.4","read-package-json-fast":"^2.0.1","@npmcli/name-from-folder":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.10","eslint":"^8.0.0","require-inject":"^1.4.4","@npmcli/template-oss":"^2.0.0"},"templateVersion":"2.0.0","_npmOperationalInternal":{"tmp":"tmp/map-workspaces_2.0.0_1634144914757_0.5306730397975801","host":"s3://npm-registry-packages"},"readme":"# @npmcli/map-workspaces\n\n[![NPM version](https://img.shields.io/npm/v/@npmcli/map-workspaces)](https://www.npmjs.com/package/@npmcli/map-workspaces)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/npm/map-workspaces/ci.yml?branch=main)](https://github.com/npm/map-workspaces)\n[![License](https://img.shields.io/npm/l/@npmcli/map-workspaces)](https://github.com/npm/map-workspaces/blob/main/LICENSE.md)\n\nRetrieves a name:pathname Map for a given workspaces config.\n\nLong version: Reads the `workspaces` property from a valid **workspaces configuration** object and traverses the paths and globs defined there in order to find valid nested packages and return a **Map** of all found packages where keys are package names and values are folder locations.\n\n## Install\n\n`npm install @npmcli/map-workspaces`\n\n## Usage:\n\n```js\nconst mapWorkspaces = require('@npmcli/map-workspaces')\nawait mapWorkspaces({\n  cwd,\n  pkg: {\n    workspaces: {\n      packages: [\n        \"a\",\n        \"b\"\n      ]\n    }\n  }\n})\n// ->\n// Map {\n//   'a': '<cwd>/a'\n//   'b': '<cwd>/b'\n// }\n```\n\n## Examples:\n\n### Glob usage:\n\nGiven a folder structure such as:\n\n```\n├── package.json\n└── apps\n   ├── a\n   │   └── package.json\n   ├── b\n   │   └── package.json\n   └── c\n       └── package.json\n```\n\n```js\nconst mapWorkspaces = require('@npmcli/map-workspaces')\nawait mapWorkspaces({\n  cwd,\n  pkg: {\n    workspaces: [\n      \"apps/*\"\n    ]\n  }\n})\n// ->\n// Map {\n//   'a': '<cwd>/apps/a'\n//   'b': '<cwd>/apps/b'\n//   'c': '<cwd>/apps/c'\n// }\n```\n\n## API:\n\n### `mapWorkspaces(opts) -> Promise<Map>`\n\n- `opts`:\n  - `pkg`: A valid `package.json` **Object**\n  - `cwd`: A **String** defining the base directory to use when reading globs and paths.\n  - `ignore`: An **Array** of paths to be ignored when using [globs](https://www.npmjs.com/package/glob) to look for nested package.\n  - ...[Also support all other glob options](https://www.npmjs.com/package/glob#options)\n\n#### Returns\n\nA **Map** in which keys are **package names** and values are the **pathnames** for each found **workspace**.\n\n## LICENSE\n\n[ISC](./LICENSE)\n\n","publish_time":1634144914932,"_cnpm_publish_time":1634144914932,"dist-tags":{"latest":"6.0.0"}}