diff --git a/README.md b/README.md index fef104c..543c737 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,27 @@ -# list-config-plugins [![npm][npm-image]][npm-url] +# list-config-plugins [![npm][npm-image]][npm-url] ![npm][npm-dl-stats] -A CLI tool to find Expo config plugins available in your project dependencies. +A CLI tool to discover and manage Expo config plugins in your project dependencies. -## Overview +## πŸš€ Overview -This package helps you manage your Expo config plugins by showing which dependencies have available plugins and whether they're currently being used in your project.\ -Works on Expo & bare React-Native Apps (without Expo) +`list-config-plugins` helps you efficiently manage your Expo config plugins by identifying which dependencies have available expo config plugins and whether they are currently utilized in your project. It supports: -## Usage +- βœ… Expo Apps +- βœ… Bare React-Native Apps (without Expo) +- βœ… Monorepos -Simply run the package using npx in your App directory: +## 🎯 Usage +To get started, simply run the package in your app directory: ```bash -npx list-config-plugins +npx list-config-plugins@latest ``` ### Example Output ```bash - > npx list-config-plugins +> npx list-config-plugins Config Plugin Overview: Used Plugins: @@ -37,25 +39,20 @@ Unused Plugins: πŸŸ₯ @sentry/react-native ``` -## Features +## ✨ Features - πŸ” Scans your project for available Expo config plugins -- 🟩 Shows which plugins are currently in use -- πŸ“¦ Shows which plugins are automatically added by expo +- 🟩 Displays currently used plugins +- πŸ“¦ Lists plugins automatically added by Expo - πŸŸ₯ Identifies unused available plugins -- 🌐 Finds config plugins provided by [expo @config-plugins/](https://github.com/expo/config-plugins) -- βš™οΈ Supports all types of React-Native & Expo configurations & Monorepos +- 🌐 Finds config plugins provided by [expo @config-plugins](https://github.com/expo/config-plugins) +- βš™οΈ Supports all types of React-Native & Expo configurations, including Monorepos -## How It Works +## πŸ› οΈ How It Works 1. Analyzes your project dependencies to identify packages with Expo config plugins. -2. Checks which config plugins are being used in your Expo configuration. - -## Monorepo Support - -Monorepos should work, this depends on where your config plugins are placed. -This package will search for config plugins in `./node_modules` and walk up the folder structure (`../node_modules`, `../../node_modules`, ...). -If your config plugins are there, it should work. (run with --debug to see where it is searching) +2. Checks which config plugins are actively used in your Expo configuration. [npm-image]: https://img.shields.io/npm/v/list-config-plugins [npm-url]: https://www.npmjs.com/package/list-config-plugins +[npm-dl-stats]: https://img.shields.io/npm/dm/list-config-plugins diff --git a/bun.lock b/bun.lock index 6428f6c..494f58e 100644 --- a/bun.lock +++ b/bun.lock @@ -6,13 +6,16 @@ "dependencies": { "@expo/config": "*", "@expo/prebuild-config": "*", - "commander": "^13.1.0", + "@rnx-kit/tools-workspaces": "0.2.0", + "@stricli/auto-complete": "1.1.1", + "@stricli/core": "1.1.1", }, "devDependencies": { "@biomejs/biome": "1.9.4", "@changesets/cli": "2.27.12", + "@total-typescript/ts-reset": "0.6.1", "@types/bun": "latest", - "tsup": "8.3.5", + "tsup": "8.3.6", "typescript": "5.7.3", }, }, @@ -172,6 +175,8 @@ "@react-native/normalize-colors": ["@react-native/normalize-colors@0.76.6", "", {}, "sha512-1n4udXH2Cla31iA/8eLRdhFHpYUYK1NKWCn4m1Sr9L4SarWKAYuRFliK1fcLvPPALCFoFlWvn8I0ekdUOHMzDQ=="], + "@rnx-kit/tools-workspaces": ["@rnx-kit/tools-workspaces@0.2.0", "", { "dependencies": { "fast-glob": "^3.2.7", "find-up": "^5.0.0", "read-yaml-file": "^2.1.0", "strip-json-comments": "^3.1.1" } }, "sha512-EjyFBASHOgXGATBjv0IHdqkiGf23s31dr/TjqUagmMHT4fGxxTUgI6rkC11cGYaL0u6QczsbhSi390B4k6cByg=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.31.0", "", { "os": "android", "cpu": "arm" }, "sha512-9NrR4033uCbUBRgvLcBrJofa2KY9DzxL2UKZ1/4xA/mnTNyhZCWBuD8X3tPm1n4KxcgaraOYgrFKSgwjASfmlA=="], "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.31.0", "", { "os": "android", "cpu": "arm64" }, "sha512-iBbODqT86YBFHajxxF8ebj2hwKm1k8PTBQSojSt3d1FFt1gN+xf4CowE47iN0vOSdnd+5ierMHBbu/rHc7nq5g=="], @@ -210,6 +215,12 @@ "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.31.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ul8rnCsUumNln5YWwz0ted2ZHFhzhRRnkpBZ+YRuHoRAlUji9KChpOUOndY7uykrPEPXVbHLlsdo6v5yXo/TXw=="], + "@stricli/auto-complete": ["@stricli/auto-complete@1.1.1", "", { "dependencies": { "@stricli/core": "^1.1.1" }, "bin": { "auto-complete": "dist/bin/cli.js" } }, "sha512-UGXVgdfaanfJIw5Wtv3fvZjfLTDBNcYuy3VSSSMt8RznJ9YOgK0uFZyQig4tCr2DENb1dVIGMdDAAi3f9oTLcg=="], + + "@stricli/core": ["@stricli/core@1.1.1", "", {}, "sha512-pobySbkEtm1x/Kx42EqS9pDi/7ewSfIV3l6P7pPLp1b2ehWyIqfNoLKdWb9nrwnhwrfYwYaCGQMWZgWcgj4UFg=="], + + "@total-typescript/ts-reset": ["@total-typescript/ts-reset@0.6.1", "", {}, "sha512-cka47fVSo6lfQDIATYqb/vO1nvFfbPw7uWLayIXIhGETj0wcOOlrlkobOMDNQOFr9QOafegUPq13V2+6vtD7yg=="], + "@types/bun": ["@types/bun@1.1.17", "", { "dependencies": { "bun-types": "1.1.44" } }, "sha512-zZt0Kao/8hAwNOXh4bmt8nKbMEd4QD8n7PeTGF+NZTVY5ouXhU/TX7jUj4He1p7mgY+WdplnU1B6MB1j17vdzg=="], "@types/estree": ["@types/estree@1.0.6", "", {}, "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="], @@ -228,7 +239,7 @@ "any-promise": ["any-promise@1.3.0", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="], - "argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "array-union": ["array-union@2.1.0", "", {}, "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="], @@ -268,7 +279,7 @@ "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "commander": ["commander@13.1.0", "", {}, "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw=="], + "commander": ["commander@4.1.1", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="], "consola": ["consola@3.4.0", "", {}, "sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA=="], @@ -308,7 +319,7 @@ "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], - "find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], + "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], "foreground-child": ["foreground-child@3.3.0", "", { "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" } }, "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg=="], @@ -358,7 +369,7 @@ "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "js-yaml": ["js-yaml@3.14.1", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g=="], + "js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], @@ -370,7 +381,7 @@ "load-tsconfig": ["load-tsconfig@0.2.5", "", {}, "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg=="], - "locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], "lodash.sortby": ["lodash.sortby@4.7.0", "", {}, "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA=="], @@ -402,7 +413,7 @@ "p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], - "p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], + "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], "p-map": ["p-map@2.1.0", "", {}, "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw=="], @@ -442,7 +453,7 @@ "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], - "read-yaml-file": ["read-yaml-file@1.1.0", "", { "dependencies": { "graceful-fs": "^4.1.5", "js-yaml": "^3.6.1", "pify": "^4.0.1", "strip-bom": "^3.0.0" } }, "sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA=="], + "read-yaml-file": ["read-yaml-file@2.1.0", "", { "dependencies": { "js-yaml": "^4.0.0", "strip-bom": "^4.0.0" } }, "sha512-UkRNRIwnhG+y7hpqnycCL/xbTk7+ia9VuVTC0S+zVbwd65DI9eUpRMfsWIGrCWxTU/mi+JW8cHQCrv+zfCbEPQ=="], "readdirp": ["readdirp@4.1.1", "", {}, "sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw=="], @@ -494,7 +505,9 @@ "strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - "strip-bom": ["strip-bom@3.0.0", "", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="], + "strip-bom": ["strip-bom@4.0.0", "", {}, "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="], + + "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], "sucrase": ["sucrase@3.35.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "glob": "^10.3.10", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA=="], @@ -522,7 +535,7 @@ "ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="], - "tsup": ["tsup@8.3.5", "", { "dependencies": { "bundle-require": "^5.0.0", "cac": "^6.7.14", "chokidar": "^4.0.1", "consola": "^3.2.3", "debug": "^4.3.7", "esbuild": "^0.24.0", "joycon": "^3.1.1", "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", "rollup": "^4.24.0", "source-map": "0.8.0-beta.0", "sucrase": "^3.35.0", "tinyexec": "^0.3.1", "tinyglobby": "^0.2.9", "tree-kill": "^1.2.2" }, "peerDependencies": { "@microsoft/api-extractor": "^7.36.0", "@swc/core": "^1", "postcss": "^8.4.12", "typescript": ">=4.5.0" }, "optionalPeers": ["@microsoft/api-extractor", "@swc/core", "postcss", "typescript"], "bin": { "tsup": "dist/cli-default.js", "tsup-node": "dist/cli-node.js" } }, "sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA=="], + "tsup": ["tsup@8.3.6", "", { "dependencies": { "bundle-require": "^5.0.0", "cac": "^6.7.14", "chokidar": "^4.0.1", "consola": "^3.2.3", "debug": "^4.3.7", "esbuild": "^0.24.0", "joycon": "^3.1.1", "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", "rollup": "^4.24.0", "source-map": "0.8.0-beta.0", "sucrase": "^3.35.0", "tinyexec": "^0.3.1", "tinyglobby": "^0.2.9", "tree-kill": "^1.2.2" }, "peerDependencies": { "@microsoft/api-extractor": "^7.36.0", "@swc/core": "^1", "postcss": "^8.4.12", "typescript": ">=4.5.0" }, "optionalPeers": ["@microsoft/api-extractor", "@swc/core", "postcss", "typescript"], "bin": { "tsup": "dist/cli-default.js", "tsup-node": "dist/cli-node.js" } }, "sha512-XkVtlDV/58S9Ye0JxUUTcrQk4S+EqlOHKzg6Roa62rdjL1nGWNUstG0xgI4vanHdfIpjP448J8vlN0oK6XOJ5g=="], "typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="], @@ -552,8 +565,12 @@ "xmlbuilder": ["xmlbuilder@11.0.1", "", {}, "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="], + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], + "@babel/highlight/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], + "@changesets/parse/js-yaml": ["js-yaml@3.14.1", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g=="], + "@expo/image-utils/fs-extra": ["fs-extra@9.0.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^1.0.0" } }, "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g=="], "@expo/plist/xmlbuilder": ["xmlbuilder@14.0.0", "", {}, "sha512-ts+B2rSe4fIckR6iquDjsKbQFK2NlUk6iG5nf14mDEyldgoc2nEKZ3jZWMPTxGQwVgToSjt6VGIho1H8/fNFTg=="], @@ -564,14 +581,20 @@ "@manypkg/find-root/@types/node": ["@types/node@12.20.55", "", {}, "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="], + "@manypkg/find-root/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], + "@manypkg/find-root/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], "@manypkg/get-packages/@changesets/types": ["@changesets/types@4.1.0", "", {}, "sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw=="], "@manypkg/get-packages/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], + "@manypkg/get-packages/read-yaml-file": ["read-yaml-file@1.1.0", "", { "dependencies": { "graceful-fs": "^4.1.5", "js-yaml": "^3.6.1", "pify": "^4.0.1", "strip-bom": "^3.0.0" } }, "sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA=="], + "micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "p-locate/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], + "plist/@xmldom/xmldom": ["@xmldom/xmldom@0.8.10", "", {}, "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw=="], "plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], @@ -580,8 +603,6 @@ "string-width-cjs/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "sucrase/commander": ["commander@4.1.1", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="], - "wrap-ansi/ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="], "wrap-ansi/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="], @@ -594,6 +615,8 @@ "@babel/highlight/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], + "@changesets/parse/js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + "@expo/image-utils/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], "@expo/image-utils/fs-extra/universalify": ["universalify@1.0.0", "", {}, "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug=="], @@ -604,6 +627,12 @@ "@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], + "@manypkg/find-root/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], + + "@manypkg/get-packages/read-yaml-file/js-yaml": ["js-yaml@3.14.1", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g=="], + + "@manypkg/get-packages/read-yaml-file/strip-bom": ["strip-bom@3.0.0", "", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="], + "string-width/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], "wrap-ansi-cjs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], @@ -616,6 +645,10 @@ "@expo/image-utils/fs-extra/jsonfile/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], + "@manypkg/find-root/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], + + "@manypkg/get-packages/read-yaml-file/js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + "@babel/highlight/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], } } diff --git a/package.json b/package.json index 746fd21..5876d9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "list-config-plugins", - "version": "1.1.1", + "version": "1.1.3", "description": "find available expo config plugins and see if they are used", "author": { "name": "WookieFPV (Lukas MΓΌller)", @@ -15,9 +15,10 @@ "module": "index", "type": "module", "bin": { - "list-config-plugins": "./dist/bin.js" + "list-config-plugins": "dist/cli.js", + "__list-config-plugins_bash_complete": "dist/bash-complete.js" }, - "main": "dist/bin.js", + "main": "dist/cli.js", "files": ["dist"], "scripts": { "build": "tsup", @@ -31,13 +32,16 @@ "dependencies": { "@expo/config": "*", "@expo/prebuild-config": "*", - "commander": "^13.1.0" + "@rnx-kit/tools-workspaces": "0.2.0", + "@stricli/auto-complete": "1.1.1", + "@stricli/core": "1.1.1" }, "devDependencies": { "@biomejs/biome": "1.9.4", "@changesets/cli": "2.27.12", + "@total-typescript/ts-reset": "0.6.1", "@types/bun": "latest", - "tsup": "8.3.5", + "tsup": "8.3.6", "typescript": "5.7.3" } } diff --git a/src/bin.ts b/src/bin.ts deleted file mode 100755 index f554ecb..0000000 --- a/src/bin.ts +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -import { Command } from "commander"; -import { listConfigPlugins } from "./listConfigPlugins"; - -const program = new Command(); - -program.name("list-config-plugins"); - -program.version(__VERSION__); - -program - .action((options) => listConfigPlugins(options)) - .option("-d, --debug", "output extra debugging", false) - .description("List all Expo Config Plugins. Supports Expo & non expo (bare) React-Native Apps"); - -program.parse(process.argv); diff --git a/src/cli/app.ts b/src/cli/app.ts new file mode 100644 index 0000000..8bd9cfc --- /dev/null +++ b/src/cli/app.ts @@ -0,0 +1,25 @@ +import { buildApplication, buildCommand } from "@stricli/core"; +import { description, name, version } from "../../package.json"; + +const command = buildCommand({ + loader: async () => import("./impl"), + parameters: { + flags: { + debug: { + kind: "boolean", + brief: "output debugging info", + default: false, + }, + }, + }, + docs: { + brief: description, + }, +}); + +export const app = buildApplication(command, { + name, + versionInfo: { + currentVersion: version, + }, +}); diff --git a/src/cli/bin/bash-complete.ts b/src/cli/bin/bash-complete.ts new file mode 100644 index 0000000..fe2e5b3 --- /dev/null +++ b/src/cli/bin/bash-complete.ts @@ -0,0 +1,18 @@ +#!/usr/bin/env node +import { proposeCompletions } from "@stricli/core"; +import { app } from "../app"; +import { buildContext } from "../context"; + +const inputs = process.argv.slice(3); +// biome-ignore lint/complexity/useLiteralKeys: +if (process.env["COMP_LINE"]?.endsWith(" ")) { + inputs.push(""); +} +await proposeCompletions(app, inputs, buildContext(process)); +try { + for (const { completion } of await proposeCompletions(app, inputs, buildContext(process))) { + process.stdout.write(`${completion}\n`); + } +} catch { + // ignore +} diff --git a/src/cli/bin/cli.ts b/src/cli/bin/cli.ts new file mode 100644 index 0000000..bb742e7 --- /dev/null +++ b/src/cli/bin/cli.ts @@ -0,0 +1,6 @@ +#!/usr/bin/env node +import { run } from "@stricli/core"; +import { app } from "../app"; +import { buildContext } from "../context"; + +await run(app, process.argv.slice(2), buildContext(process)); diff --git a/src/cli/context.ts b/src/cli/context.ts new file mode 100644 index 0000000..2f633c9 --- /dev/null +++ b/src/cli/context.ts @@ -0,0 +1,18 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import type { StricliAutoCompleteContext } from "@stricli/auto-complete"; +import type { CommandContext } from "@stricli/core"; + +export interface LocalContext extends CommandContext, StricliAutoCompleteContext { + readonly process: NodeJS.Process; +} + +export function buildContext(process: NodeJS.Process): LocalContext { + return { + process, + os, + fs, + path, + }; +} diff --git a/src/cli/impl.ts b/src/cli/impl.ts new file mode 100644 index 0000000..0978ec9 --- /dev/null +++ b/src/cli/impl.ts @@ -0,0 +1,10 @@ +import { listConfigPlugins } from "../listConfigPlugins"; +import type { LocalContext } from "./context"; + +export interface CommandFlags { + readonly debug: boolean; +} + +export default async function (this: LocalContext, flags: CommandFlags): Promise { + listConfigPlugins(flags); +} diff --git a/src/communityConfigPlugins.ts b/src/configPlugin/communityConfigPlugins.ts similarity index 100% rename from src/communityConfigPlugins.ts rename to src/configPlugin/communityConfigPlugins.ts diff --git a/src/detectionHelpers.ts b/src/configPlugin/detectionHelpers.ts similarity index 92% rename from src/detectionHelpers.ts rename to src/configPlugin/detectionHelpers.ts index f4c4544..9503a08 100644 --- a/src/detectionHelpers.ts +++ b/src/configPlugin/detectionHelpers.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import { getLegacyExpoPlugins } from "@expo/prebuild-config"; +import type { ExpoCfg, ExpoPlugin, UsageType } from "../types/types"; import { thirdPartyPluginPrefix, thirdPartyPlugins } from "./communityConfigPlugins"; -import { nodeModulesFolders } from "./findNodeModules.js"; -import type { ExpoCfg, ExpoPlugin, UsageType } from "./types"; +import { nodeModulesFolders } from "./nodeModulesFolders"; const isPluginUsedStr = (pluginStr: string, pkg: string) => { if (pluginStr.startsWith(pkg)) return true; diff --git a/src/configPlugin/nodeModulesFolders.ts b/src/configPlugin/nodeModulesFolders.ts new file mode 100644 index 0000000..4fc1d57 --- /dev/null +++ b/src/configPlugin/nodeModulesFolders.ts @@ -0,0 +1,5 @@ +import { findWorkspacePackagesSync, findWorkspaceRootSync } from "@rnx-kit/tools-workspaces"; + +export const nodeModulesFolders = [findWorkspaceRootSync(), ...findWorkspacePackagesSync()] + .filter(Boolean) + .map((path) => `${path}/node_modules`); diff --git a/src/readPackages.ts b/src/configPlugin/readPackages.ts similarity index 75% rename from src/readPackages.ts rename to src/configPlugin/readPackages.ts index 58bdf36..97ed9b7 100644 --- a/src/readPackages.ts +++ b/src/configPlugin/readPackages.ts @@ -1,9 +1,10 @@ -import { getConfigPluginInfoText, thirdPartyPluginPrefix } from "./communityConfigPlugins"; +import type { CommandFlags } from "../cli/impl"; +import type { ExpoCfg, PackageInfo } from "../types/types.js"; +import { getConfigPluginInfoText } from "./communityConfigPlugins"; import { getPluginImportType, hasConfigPlugin } from "./detectionHelpers.js"; -import { nodeModulesFolders } from "./findNodeModules"; -import type { CliOptions, ExpoCfg, PackageInfo } from "./types.js"; +import { nodeModulesFolders } from "./nodeModulesFolders"; -export const getPackagePluginList = (config: ExpoCfg, options: CliOptions): Array => { +export const getPackagePluginList = (config: ExpoCfg, options: CommandFlags): Array => { if (!config.pkg.dependencies) throw Error("No dependencies could be found by expo"); const deps = Object.keys(config.pkg.dependencies); if (options.debug) console.debug("List of dependencies:", JSON.stringify(deps, null, 2)); diff --git a/src/findNodeModules.ts b/src/findNodeModules.ts deleted file mode 100644 index 04c1d09..0000000 --- a/src/findNodeModules.ts +++ /dev/null @@ -1,17 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; - -export const findNodeModuleFolders = () => { - let currentPath = process.cwd(); - const nodeModulesPaths: string[] = []; - - while (currentPath !== path.parse(currentPath).root) { - const nodeModulesPath = path.join(currentPath, "node_modules"); - if (fs.existsSync(nodeModulesPath)) nodeModulesPaths.push(nodeModulesPath); - - currentPath = path.dirname(currentPath); - } - return nodeModulesPaths; -}; - -export const nodeModulesFolders = findNodeModuleFolders(); diff --git a/src/globals.d.ts b/src/globals.d.ts deleted file mode 100644 index 8415458..0000000 --- a/src/globals.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -//version is injected by tsup when bundling -declare const __VERSION__: string; diff --git a/src/listConfigPlugins.ts b/src/listConfigPlugins.ts index 90d741c..9dc17a1 100644 --- a/src/listConfigPlugins.ts +++ b/src/listConfigPlugins.ts @@ -1,9 +1,9 @@ +import type { CommandFlags } from "./cli/impl"; +import { getPackagePluginList } from "./configPlugin/readPackages.js"; import { printPackages } from "./printData.js"; import { readExpoConfig } from "./readExpoConfig.js"; -import { getPackagePluginList } from "./readPackages.js"; -import type { CliOptions } from "./types"; -export const listConfigPlugins = (options: CliOptions) => { +export const listConfigPlugins = (options: CommandFlags) => { const config = readExpoConfig(options); if (!config) { console.log( @@ -13,7 +13,6 @@ export const listConfigPlugins = (options: CliOptions) => { ); return; } - const packages = getPackagePluginList(config, options); printPackages(packages); }; diff --git a/src/printData.ts b/src/printData.ts index 219fcff..a8900a4 100644 --- a/src/printData.ts +++ b/src/printData.ts @@ -1,4 +1,4 @@ -import type { PackageInfo, UsageType } from "./types"; +import type { PackageInfo, UsageType } from "./types/types"; const emojiMapping: Record = { yes: "🟩", diff --git a/src/readExpoConfig.ts b/src/readExpoConfig.ts index 9c71e12..1c2823b 100644 --- a/src/readExpoConfig.ts +++ b/src/readExpoConfig.ts @@ -1,7 +1,7 @@ import { getConfig } from "@expo/config"; -import type { CliOptions } from "./types"; +import type { CommandFlags } from "./cli/impl"; -export const readExpoConfig = (options: CliOptions) => { +export const readExpoConfig = (options: CommandFlags) => { try { return getConfig(process.cwd(), { skipSDKVersionRequirement: true }); } catch (e) { diff --git a/src/types/globals.d.ts b/src/types/globals.d.ts new file mode 100644 index 0000000..d66bda0 --- /dev/null +++ b/src/types/globals.d.ts @@ -0,0 +1,7 @@ +import "@total-typescript/ts-reset"; + +declare namespace NodeJS { + interface ProcessEnv { + COMP_LINE: string | undefined; + } +} diff --git a/src/types.ts b/src/types/types.ts similarity index 85% rename from src/types.ts rename to src/types/types.ts index 0e42b58..ee761d7 100644 --- a/src/types.ts +++ b/src/types/types.ts @@ -7,7 +7,3 @@ export type PackageInfo = { name: string; usage: UsageType; info?: string }; export type ExpoCfg = ReturnType; export type ExpoPlugin = ExpoCfg["exp"]["plugins"]; - -export type CliOptions = { - debug: boolean; -}; diff --git a/tsup.config.ts b/tsup.config.ts index acd468d..b25919f 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,12 +1,7 @@ import { defineConfig } from "tsup"; export default defineConfig({ - entry: ["src/bin.ts"], + entry: ["src/cli/bin/cli.ts", "src/cli/bin/bash-complete.ts"], format: ["esm"], - dts: false, - define: { - __VERSION__: JSON.stringify(process.env.npm_package_version), - }, - outDir: "dist", clean: true, });