{"name":"@npmcli/map-workspaces","version":"4.0.1","main":"lib/index.js","engines":{"node":"^18.17.0 || >=20.5.0"},"description":"Retrieves a name:pathname Map for a given workspaces config","repository":{"type":"git","url":"git+https://github.com/npm/map-workspaces.git"},"keywords":["npm","npmcli","libnpm","cli","workspaces","map-workspaces"],"author":{"name":"GitHub Inc."},"license":"ISC","scripts":{"lint":"npm run eslint","pretest":"npm run lint","test":"tap","snap":"tap","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"tap":{"check-coverage":true,"nyc-arg":["--exclude","tap-snapshots/**"]},"devDependencies":{"@npmcli/eslint-config":"^5.0.0","@npmcli/template-oss":"4.23.3","tap":"^16.0.1"},"dependencies":{"@npmcli/name-from-folder":"^3.0.0","@npmcli/package-json":"^6.0.0","glob":"^10.2.2","minimatch":"^9.0.0"},"templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.23.3","publish":"true"},"_id":"@npmcli/map-workspaces@4.0.1","gitHead":"44c069114b3825cf189d634743129eb2b7bcee60","bugs":{"url":"https://github.com/npm/map-workspaces/issues"},"homepage":"https://github.com/npm/map-workspaces#readme","_nodeVersion":"22.9.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-g5H8ljH7Z+4T1ASsfcL09gZl4YGw6M4GbjzPt6HgE+pCRSKC4nlNc4nY75zshi88eEHcdoh3Q8XgWFkGKoVOPw==","shasum":"ff1a7d6f643264617c0769ac0f36e507743d5a81","tarball":"http://registry-npm.ywwl.com/@npmcli/map-workspaces/download/@npmcli/map-workspaces-4.0.1.tgz","fileCount":4,"unpackedSize":10940,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@npmcli%2fmap-workspaces@4.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBI1ERN9VE+/z86CCFYQG0slnm5Iv8Vx4DX8Fz9aAhUbAiABNdKaDyLuBJrQ9w2AhZ0wSDdaRQj1hzvocBR6zUU3OQ=="}],"size":4187,"noattachment":false,"key":"/@npmcli/map-workspaces/-/@npmcli/map-workspaces-4.0.1.tgz"},"_npmUser":{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-workspaces_4.0.1_1727887336888_0.8443196602521417"},"_hasShrinkwrap":false,"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":1727887337069,"maintainers":[{"name":"hashtagchris","email":"hashtagchris@github.com"},{"name":"reggi","email":"reggi@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"fritzy","email":"fritzy@github.com"},{"name":"gar","email":"gar+npm@danger.computer"}],"_cnpm_publish_time":1727887337069,"dist-tags":{"latest":"6.0.0"}}