{"id":15393241,"url":"https://github.com/zaubernerd/react-native-contains-native-code","last_synced_at":"2025-06-21T20:04:48.354Z","repository":{"id":144629745,"uuid":"87019847","full_name":"ZauberNerd/react-native-contains-native-code","owner":"ZauberNerd","description":"A small module to test whether a given react-native dependency contains native or JS-only code.","archived":false,"fork":false,"pushed_at":"2017-04-03T21:46:52.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T23:42:48.955Z","etag":null,"topics":["android","cli","code-push","devops","ios","react-native","utility","xcode"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"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/ZauberNerd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-02T22:18:05.000Z","updated_at":"2017-04-03T04:52:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"c931e86f-5e70-4e7e-99cb-629d452200cc","html_url":"https://github.com/ZauberNerd/react-native-contains-native-code","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"143062dc8a0c01395fd89c55297f4b502660f6f3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ZauberNerd/react-native-contains-native-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZauberNerd%2Freact-native-contains-native-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZauberNerd%2Freact-native-contains-native-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZauberNerd%2Freact-native-contains-native-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZauberNerd%2Freact-native-contains-native-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZauberNerd","download_url":"https://codeload.github.com/ZauberNerd/react-native-contains-native-code/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZauberNerd%2Freact-native-contains-native-code/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186757,"owners_count":23121942,"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":["android","cli","code-push","devops","ios","react-native","utility","xcode"],"created_at":"2024-10-01T15:18:26.711Z","updated_at":"2025-06-21T20:04:43.340Z","avatar_url":"https://github.com/ZauberNerd.png","language":"JavaScript","readme":"# react-native-contains-native-code\nA small module to test whether a given react-native dependency contains native or JS-only code.\n\n* Checks if the dependency contains an xcode or gradle project ✓\n* Checks if the dependency contains RNPM hooks ✓\n* CLI ✓\n* API ✓\n\n# ToC\n* [Why](#why)\n* [Usage](#usage)\n    * [CLI](#cli)\n    * [API](#api)\n* [How does it work?](#how-does-it-work)\n* [An example integration](#an-example-integration)\n\n# Why\nThis utility was built in order to support \"web-like release agility\" for react-native projects.\n\nThis means, in detail, that paired with a tool like [Microsoft code-push](https://github.com/Microsoft/react-native-code-push) and a little bit of extra scripting,\ndeployments can be made continuously and be released either as JS-only changes via code-push or with native changes through the iOS App Store / Google Play Store.\n\n# Usage\n## CLI\nThe binary can be used with either absolute or paths:\n```shell\n$ contains-native-code /home/myname/work/myproject/node_modules/a-react-native-dependency\n```\nor with the name of a dependency:\n```shell\n$ contains-native-code another-react-native-dependency\n```\nIn the latter case it will look in the same `node_modules` folder where it has been installed for a dependeny with the given name.\n\nThe binary itself will be installed to `node_modules/.bin` and is available on the npm path.\n\n## API\nThis package exports a single function that can be called with a path to the dependency in question:\n```javascript\nvar containsNativeCode = require('react-native-contains-native-code');\nconsole.log(containsNativeCode('/path/to/a/react-native-dependency'));\n```\nOr, with ES6 syntax:\n```javascript\nimport containsNativeCode from 'react-native-contains-native-code';\nconsole.log(containsNativeCode('/path/to/a/react-native-dependency'));\n```\n\n# How does it work?\nThe script reads the `package.json` manifest of the given dependency and checks:\n* whether the key `rnpm` is present\n* wheter the given dependency contains a `*.xcodeproj` file\n* whether the given dependency contains an `android/build.gradle` or `android/app/build.gradle` file\n\nThis is a similar behaviour to how `react-native link` works internally.\n\n# An example integration\nIn order to use this script in a automated release process the deployment script needs to do the following tasks:\n1. check if commits have been made inside the projects `android/` or `ios/` folder\n2. create a list of added/removed/changed dependencies from the package.json\n3. run this script for every dependency that has been found through step 1\n    * if it turns out that no native changes were made between the last version and current `HEAD` do a code-push release\n    * otherwise build the native code and push to the app/play store\n\nTo be able to execute these steps the source code of the application needs to be versioned via a version control system (for example git).\n\nIt is recommended to not directly push to production but to employ a \"staging\" environment and use manual or automated integration tests to verify the release because this method might not be bullet proof.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaubernerd%2Freact-native-contains-native-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaubernerd%2Freact-native-contains-native-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaubernerd%2Freact-native-contains-native-code/lists"}