{"id":4820,"url":"https://github.com/rnpm/rnpm","last_synced_at":"2025-05-14T20:08:46.663Z","repository":{"id":47843923,"uuid":"46366544","full_name":"rnpm/rnpm","owner":"rnpm","description":":iphone: React Native Package Manager","archived":false,"fork":false,"pushed_at":"2016-08-01T09:24:46.000Z","size":317,"stargazers_count":2507,"open_issues_count":14,"forks_count":74,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-13T14:07:41.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnpm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-17T18:23:39.000Z","updated_at":"2025-03-06T01:03:53.000Z","dependencies_parsed_at":"2022-09-21T05:17:17.693Z","dependency_job_id":null,"html_url":"https://github.com/rnpm/rnpm","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnpm%2Frnpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnpm%2Frnpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnpm%2Frnpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnpm%2Frnpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnpm","download_url":"https://codeload.github.com/rnpm/rnpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724636,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:25.188Z","updated_at":"2025-04-13T14:07:46.921Z","avatar_url":"https://github.com/rnpm.png","language":"JavaScript","readme":"# Dear friends,\n\nLast November me ([@Kureev](https://github.com/Kureev)) and Mike ([@grabbou](https://github.com/grabbou)) started RNPM. We aimed to bring you a better developer experience and bridge the tooling gap we had back then. Now, as you may know, RNPM is merged into [React Native core](https://github.com/facebook/react-native). It means that from now on you don't need to install a third-party software to use your favorite linking functionality (just use a react-native cli). We'd like to say a big \"Thank you!\" to everybody who supported us, filed new issues, composed PRs and helped us to review them.\n\nNow, when RNPM is a part of React Native, we're going to seal this repository and keep working on React Native tooling inside the core. That said, I kindly ask you to file all new issues / prs in react-native repo and cc us. This repo (and other rnpm plugins) will be a available for a few more months in a read-only mode.\n\nWith love, \nAlexey Kureev and Michał Grabowski\n\n![](http://esq.h-cdn.co/assets/16/17/640x360/gallery-1462115295-obama-mic-drop.gif)\n\n\n\n![rnpm logo](http://s18.postimg.org/ex7oladjt/logornpm_final4.png)\n\n![npm version](https://img.shields.io/npm/v/rnpm.svg) ![dependencies](https://img.shields.io/david/rnpm/rnpm.svg) [![Code Climate](https://codeclimate.com/github/rnpm/rnpm/badges/gpa.svg)](https://codeclimate.com/github/rnpm/rnpm) [![Test Coverage](https://codeclimate.com/github/rnpm/rnpm/badges/coverage.svg)](https://codeclimate.com/github/rnpm/rnpm/coverage) [![Circle CI](https://img.shields.io/circleci/project/rnpm/rnpm/master.svg)](https://circleci.com/gh/rnpm/rnpm)\n\n**React Native Package Manager** built to ease your daily React Native development. Inspired by `CocoaPods`, `fastlane` and `react-native link` it acts as your best friend and guides you through the native unknowns. It aims to work with almost all packages available with no extra configuration required.\n\n\u003e RNPM should always be run in projects that use **version control** to ensure any changes made can be easily reverted\n\n## Requirements\n\n- node \u003e= 4.1\n\n## Getting started\n\n#### Installation\n```bash\n$ npm install rnpm -g\n```\n\n#### Running\n\n**Installing dependency:**\n\nIf you want to install a dependency and link it in one run:\n```bash\n$ rnpm install \u003cname\u003e\n```\n\n**Linking dependency:**\n\nIf you already have some installed (but not linked) modules, run:\n```bash\n$ rnpm link\n```\nIn the case you want to link only one dependency, you can specify its name as an argument:\n```bash\n$ rnpm link \u003cname\u003e\n```\n\n## Rationale\n\nWhy? Tooling is important. We all know this. One of the biggest advantages of native iOS development is Xcode and its great tools. Unfortunately, the process of adding native dependencies to React Native projects is far from perfect and our aim is to make it fun again.\n\nReact Native Package Manager provides you with (soon) multiple actions to help you with daily development, including automatic app store releases, over-the-air integration with AppHub and react-native-playground shares.\n\n**But hey, we are tired of tools and 9000+ .rc files**\n\nSo are we. That's why we have spent great amount of work on getting configuration done right. Our packager automatically scans your source directory and dependencies you are working with. This approach allows it to link all the things without supplying any extra configuration. It detects Android package names, import paths, gradle location - and for iOS - it works with any code structure you have ever came up with.\n\nAnd don't worry - in case it fails, you can always add `rnpm` object to your `package.json` - our `npm` in a name is not a mistake! We embrace existing ecosystem and integrate with the present tooling for maximum developer experience.\n\n## Available commands\n\n#### rnpm link [name]\nAutomatically updates your project by linking all dependencies for Android (if present) and for iOS (if present). It's a great fit to your `postinstall` hook to always make sure you are linked. You can supply optional [name] argument to link only one dependency, e.g.\n\n```bash\n$ npm install react-native-module --save\n$ rnpm link react-native-module\n```\n\nSource: https://github.com/rnpm/rnpm-plugin-link\n\n#### rnpm install [name]\nAutomatically installs the given package and links it to your project. It's equivalent to running the previous example. It's just instead of running two commands, you can now just:\n\n```bash\n$ rnpm install react-native-module\n```\n\nSource: https://github.com/rnpm/rnpm-plugin-install\n\n## Advanced usage\nIf you're authoring an awesome react-native library with custom assets, you probably need an additional step after linking - copying assets to the application folder. Well, that's not complicated: just add `rnpm` section in your `package.json` file:\n```json\n...\n\"rnpm\": {\n  \"assets\": [\"Fonts\"]\n},\n...\n```\nWe'll copy your assets carefully with love for Android :heart: For iOS, we will add files to `Resources` group and update Info.plist so fonts are available for you to use straight away!\n\n## Plugins\n\nAs of version 1.1.0, rnpm supports plugin system. It allows you to write your own / use third-party commands to make your `rnpm` sharpened for specific purposes.\n\n#### Installing plugins\n\nIn order to install 3rd party plugin simply run below from your project directory:\n```bash\n$ npm install rnpm-plugin-\u003cname\u003e --save-dev\n$ rnpm --help # you'll see installed plugin in the commands list\n```\n\nCommand exported by installed plugin will be available straight away.\n\n#### Mastering your first plugin\n\nFirst of all, every plugin is [just a function](https://github.com/rnpm/rnpm-plugin-link/blob/master/src/link.js#L81) which accepts `config` and `args` parameters. Every plugin consists of [public interface](https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js) for CLI and [implementation intself](https://github.com/rnpm/rnpm-plugin-link/blob/master/src/link.js).\n\nWe use **public interface** to make your plugins auto-pluggable and easy to use for end-users. Every public interface consists of `name`, `func` \u0026 `description` fields:\n- `name` - Name of the plugin. After plugin installation it'll be used as a command name. For instance a plugin with the following interface:\n  ```javascript\n  module.exports = {\n    func: require('./src/link'),\n    description: 'This action updates your project and links all native dependencies',\n    name: 'link [packageName]',\n  };\n  ```\n  can be used like via rnpm like this:\n  ```bash\n  $ rnpm link\n  ```\n\n- `func` - Plugin itself. This function will be used when you run a command above\n- `description` - Command description. If user runs `$ rnpm --help`, this field will be displayed as a command description.\n- `options` - An array of flags user can specify for your plugin to run. When defined, your exported `func` will receive an object of options as a 3rd argument. For instance a plugin with the following:\n  \n  ```js\n  options: [{\n    flags: '-L, --list [path]',\n    description: 'List flag',\n    parse: (val) =\u003e val.split(',').map(Number),\n    default: [1,2,3],\n  }],\n  ```\n  will receive the following object:\n  ```\n  { list: [1,2,3] }\n  ```\n  by default.\n  \n  **Note**: `parse` and `default` are optional. You can check [commander.js](https://github.com/tj/commander.js#option-parsing) docs for more information on how to define `flags` value. \n\nAlso, in the case you want to expose multiple commands from the one plugin, you may use an array syntax:\n```javascript\nmodule.exports = [{\n  func: require('./src/link'),\n  description: 'This action updates your project and links all native dependencies',\n  name: 'link [packageName]',\n}, {\n  func: require('./src/unlink'),\n  description: 'This action updates your project and unlink specific dependency',\n  name: 'unlink \u003cpackageName\u003e',\n}]\n```\n\n#### Using third-party plugins\n\nAll existing plugins follows a naming convention: `rnpm-plugin-\u003cplugin name\u003e` (e.g. [`rnpm-plugin-link`]((https://github.com/rnpm/rnpm-plugin-link))). To include plugin to your rnpm build, just install it as a npm package, it'll be included to your rnpm tool automatically (wow, magic!). Let's consider following example: we have a `rnpm-plugin-something` plugin which we doesn't provide you automatically with `rnpm` tool. To install it manually, you need to run `npm install rnpm-plugin-something --save-dev` inside your project folder. Then, you can run it by `rnpm something` or check if command has been successfully installed by running `rnpm --help` - you should see a new plugin in the list of commands.\n\nFor further reading you can check our [example plugin](https://github.com/rnpm/rnpm-plugin-link)\n\n### Commands\nIn the case you need an additional input from the user, you may make a `command` for this purpose. Commands works similar to the npm scripts.\n\n*Depdendency's `package.json`:*\n```json\n\"rnpm\": {\n  \"commands\": {\n    \"prelink\": \"./bin/requestGAToken\",\n    \"postlink\": \"./bin/linkingSucceeded\"\n  }\n}\n```\nIn this scenario we're using custom `prelink` and `postlink` hooks for `rnpm-plugin-link` to tell `rnpm` that we want to run `prelink` script before and `postlink` after the linking process.\n\n**Note:** `commands` may be async and require some user input using third-party libraries (inquirer for instance). You don't need to worry about async queues, we do it for you under the rnpm hood.\n\nWhile making your own plugins for `rnpm` you may use any names for the commands, but we strongly recommend you to use a convention we suggest to avoid collisions: `when` + `plugin name`: `prelink` = `pre` + `link`.\n\n### Params\nOn Android - you can specify a custom `packageInstance` to be used when linking your project. The reason for that is often that your package constructor simply requires extra user provided config (e.g. API token). `rnpm` allows you to define an array of additional arguments to get from user during linking process that you can then, reference in your `packageInstance`.\n\nSimply include the following in your package.json:\n```json\n\"rnpm\": {\n  \"params\": [{\n    \"type\": \"input\",\n    \"name\": \"gaToken\",\n    \"message\": \"What's your GA token\"\n  }]\n}\n```\nand update your `packageInstance` with the new variable:\n```json\n\"rnpm\": {\n  \"android\": {\n    \"packageInstance\": \"new SomeLibName(this, ${gaToken})\"\n  }\n}\n```\n\nStarting from now on - users will be presented an interactive form powered by `inquirer` each time they run `rnpm link`.\n\n**Note**: We pass `params` array directly to inquirer which means you can also let users choose an answer from a list as well as provide a default value! See [API docs](https://github.com/SBoudrias/Inquirer.js/#question) for more details.\n\n### Developers\n\nThe documentation is still in progress, but if you are interested in the concept and good practices, see sample implementation [here](https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js)\n\nWe're open for community ideas!\nIf you know how to improve `rnpm` - please, [let us know](https://github.com/rnpm/rnpm/issues/new)!\n\n## FAQ\n\n#### How's that different from react-native link\n\n`react-native link` is great, but it only works for Android now. It also does not automatically add packages to your project nor support custom folder configuration. We aim to solve these issues by analyzing folders and getting maximum informations available from them. When running `rnpm link` you don't have to think about the package exported by developer or the import path to include in your Java project.\n\n#### Does it work with CocoaPods?\n\nYes, in fact - it has nothing to do with it. What it does is just linking static libraries automatically to your xcodeproj in the normal way you have been doing that. There are no more other changes.\n\n#### Can I use `rnpm link` with npm's postinstall hook?\nSure you can! Try doing something like this in your package.json:\n```json\n...\n\"scripts\": {\n  \"postinstall\": \"rnpm link\"\n},\n...\n```\n\n### `rnpm link \u003cname\u003e` fails with `ERRINVALIDPROJ`\n\nMake sure you have run `npm install \u003cname\u003e --save` first\n\n### `rnpm link` skip react-native module that it should not\n\nTo be as fast as possible, `rnpm link` gets list of modules to link from package.json's `dependencies`. If you have them in `devDependencies`, they are going to be skipped.\n\n## Special thanks\n\nSpecial thanks to [**coreh**](https://github.com/coreh) for giving us the `rnpm` name in the registry.\n\n## Versioning\n\nThis project follows semver. There are several 0.x versions published to npm registry you should not install as they belong to the previous project that was using that name 2 years ago.\n\n## Contributing\n\nWe welcome all contributors, simply make an issue or send over a pull request. We really appreciate your help - let's build this tool together!\n\nSpecial thanks to [Sonny Lazuardi](https://github.com/sonnylazuardi) for the awesome rnpm logo!\n\n## Sponsors\n\nThis tool development and maintenance is sponsored by below companies:\n\n\u003ca href=\"http://callstack.io\" title=\"Callstack.io\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/2464966/14333364/9df04cb6-fc4e-11e5-92ce-88a95d146a75.png\" width=\"200\" /\u003e\u003c/a\u003e\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Mike Grabowski, 2015 Alexey Kureev\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["Utilities","Tooling","JavaScript","Libraries"],"sub_categories":["Other Platforms","综合"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnpm%2Frnpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnpm%2Frnpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnpm%2Frnpm/lists"}