{"name":"@yarn-tool/get-paths-by-type","version":"2.0.10","keywords":["yarn","yarn-tool","npm","lerna","workspaces","pkg","dependencies","monorepo","yarnlock","node-modules","packages","package"],"author":{"name":"bluelovers"},"license":"ISC","_id":"@yarn-tool/get-paths-by-type@2.0.10","maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"homepage":"https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/get-paths-by-type#readme","bugs":{"url":"https://github.com/bluelovers/ws-yarn-workspaces/issues"},"dist":{"shasum":"f8c4144e5aa3be16be0c13dd128238012664f226","tarball":"http://registry-npm.ywwl.com/@yarn-tool/get-paths-by-type/download/@yarn-tool/get-paths-by-type-2.0.10.tgz","fileCount":6,"integrity":"sha512-PS5j6YzvJnpsGCOq1pUJEKdkExowNlieNZ449hEQxP2uqaHccgCjqUHBQH3Zmqh/4B4AX06C4ruQq3bEIRTbSA==","signatures":[{"sig":"MEUCIQDstFg6TGRT9xr+4wlI6Ofh/h9nuTsqqjnsGCE8OS7Q+QIgbl/f80ysLV3vQyLJ9mTU8MStmOqmIu3abqLHQmqycNs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11739,"size":3512,"noattachment":false,"key":"/@yarn-tool/get-paths-by-type/-/@yarn-tool/get-paths-by-type-2.0.10.tgz"},"main":"index.js","types":"./index.d.ts","gitHead":"089606f66f3c5501a8f3fdfc42e5a85b57f4d0e9","scripts":{"ncu":"yarn-tool ncu -u","lint":"ynpx --quiet eslint -- **/*.ts","test":"jest --passWithNoTests","coverage":"yarn run test -- --coverage","test:tsd":"ynpx tsd","test:jest":"jest --passWithNoTests","preversion":"echo preversion && yarn run test","test:mocha":"ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"","test:snapshot":"yarn run test -- -u","tsc:showConfig":"ynpx get-current-tsconfig -p","sort-package-json":"yarn-tool sort","test:jest:coverage":"yarn run test:jest -- --coverage","test:jest:snapshot":"yarn run test:jest -- -u","prepublishOnly:update":"yarn run ncu && yarn run sort-package-json"},"_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"repository":{"url":"git+https://github.com/bluelovers/ws-yarn-workspaces.git","type":"git","directory":"packages/@yarn-tool/get-paths-by-type"},"_npmVersion":"lerna/6.6.2/node@v22.1.0+x64 (win32)","description":"","directories":{},"_nodeVersion":"22.1.0","dependencies":{"tslib":">=2","global-dirs":"^3.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","_npmOperationalInternal":{"tmp":"tmp/get-paths-by-type_2.0.10_1714741108978_0.5880810969734285","host":"s3://npm-registry-packages"},"readme":"# @yarn-tool/get-paths-by-type\n\n根據類型 Symbol 取得對應的路徑陣列（支援全域 npm/yarn 路徑、當前目錄、主模組路徑）。\nGet corresponding path array based on type Symbol (supports global npm/yarn paths, current directory, and main module path).\n\n## 安裝 (Installation)\n\n```bash\n# 使用 yarn / Using yarn\nyarn add @yarn-tool/get-paths-by-type\n\n# 使用 yarn-tool / Using yarn-tool\nyarn-tool add @yarn-tool/get-paths-by-type\n# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool\nyt add @yarn-tool/get-paths-by-type\n\n# 使用 pnpm / Using pnpm\npnpm add @yarn-tool/get-paths-by-type\n\n# 使用 npm / Using npm\nnpm install @yarn-tool/get-paths-by-type\n```\n\n## 使用範例 (Usage Example)\n\n```typescript\nimport getPathsByType, {\n  SymbolCurrentDirectory,\n  SymbolGlobal,\n  SymbolGlobalNpm,\n  SymbolGlobalYarn,\n  SymbolModuleMain,\n} from '@yarn-tool/get-paths-by-type';\n\n// 取得全域 Yarn 套件目錄 / Get global Yarn package directory\nconst yarnPaths = getPathsByType(SymbolGlobalYarn);\nconsole.log(yarnPaths); // ['/usr/local/share/.config/yarn/global/node_modules']\n\n// 取得全域 Npm 套件目錄 / Get global Npm package directory\nconst npmPaths = getPathsByType(SymbolGlobalNpm);\nconsole.log(npmPaths); // ['/usr/local/lib/node_modules']\n\n// 取得所有全域路徑（Yarn + Npm）/ Get all global paths (Yarn + Npm)\nconst globalPaths = getPathsByType(SymbolGlobal);\nconsole.log(globalPaths); // [yarn packages path, npm packages path]\n\n// 取得當前工作目錄 / Get current working directory\nconst cwdPaths = getPathsByType(SymbolCurrentDirectory);\nconsole.log(cwdPaths); // [process.cwd()]\n\n// 取得當前目錄（指定路徑）/ Get current directory (specified path)\nconst customCwdPaths = getPathsByType(SymbolCurrentDirectory, '/custom/path');\n\n// 取得主模組路徑 / Get main module path\nconst mainModulePaths = getPathsByType(SymbolModuleMain);\n```\n\n## API\n\n### `getPathsByType(valueType, cwd?)`\n\n根據類型 Symbol 取得對應的路徑陣列。\n\n**參數 (Parameters):**\n- `valueType` - 路徑類型 Symbol / Path type Symbol\n- `cwd` - 工作目錄（選填，用於 SymbolCurrentDirectory）/ Working directory (optional, for SymbolCurrentDirectory)\n\n**返回 (Returns):** `string[]` - 路徑陣列 / Path array\n\n### Symbol 類型 (Symbol Types)\n\n| Symbol | 說明 / Description |\n|--------|-------------------|\n| `SymbolCurrentDirectory` | 當前工作目錄 / Current working directory |\n| `SymbolGlobal` | 全域 Yarn + Npm 套件目錄 / Global Yarn + Npm package directories |\n| `SymbolGlobalNpm` | 全域 Npm 套件目錄 / Global Npm package directory |\n| `SymbolGlobalYarn` | 全域 Yarn 套件目錄 / Global Yarn package directory |\n| `SymbolModuleMain` | 主模組的路徑 / Main module path |\n\n## License\n\nISC","publish_time":1714741109121,"_cnpm_publish_time":1714741109121,"dist-tags":{"latest":"2.0.26"}}