Files
Rob Hogan 038409e649 community-cli-plugin: resolve cli-server-api via peer dependency on cli
Summary:
`react-native/community-cli-plugin` depends on `createDevServerMiddleware` from `react-native-community/cli-server-api`. 

`react-native/community-cli-plugin` currently [declares an optional peer dependency](https://github.com/facebook/react-native/blob/bae895500052bda2f55e1832b0c8a63a1b449de3/packages/community-cli-plugin/package.json#L39-L45) on `react-native-community/cli-server-api`, however because the latter isn't a dependency of `react-native` or the community template, the peer dependency is not available to package managers that enforce isolated node_modules - see https://github.com/facebook/react-native/issues/47309.

Rather than add an unnecessary dependency to the template (like [this](https://github.com/react-native-community/template/pull/105)), my proposal is to switch to a peer dependency on only `react-native-community/cli`, because that *is* a dependency of the community template and therefore will be resolvable.

Because `react-native-community/cli` doesn't re-export `createDevServerMiddleware` from its dependency on `cli-server-api`, we need to resolve the latter through the former. This can be cleaned up once a re-export lands - https://github.com/react-native-community/cli/pull/2605.

Changelog:
[GENERAL][FIXED] Fix registering of `start` and `bundle` commands with community CLI and isolated node_modules.

Differential Revision: D69848688
2025-02-19 04:25:05 -08:00

51 lines
1.2 KiB
JSON

{
"name": "@react-native/community-cli-plugin",
"version": "0.79.0-main",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
"tools"
],
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/community-cli-plugin#readme",
"bugs": "https://github.com/facebook/react-native/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/react-native.git",
"directory": "packages/community-cli-plugin"
},
"license": "MIT",
"exports": {
".": "./src/index.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"dependencies": {
"@react-native/dev-middleware": "0.79.0-main",
"@react-native/metro-babel-transformer": "0.79.0-main",
"chalk": "^4.0.0",
"debug": "^2.2.0",
"invariant": "^2.2.4",
"metro": "^0.81.0",
"metro-config": "^0.81.0",
"metro-core": "^0.81.0",
"readline": "^1.3.0",
"semver": "^7.1.3"
},
"devDependencies": {
"metro-resolver": "^0.81.0"
},
"peerDependencies": {
"@react-native-community/cli": "*"
},
"peerDependenciesMeta": {
"@react-native-community/cli": {
"optional": true
}
},
"engines": {
"node": ">=18"
}
}