question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert to a plugin

See original GitHub issue

Changing this project to a react-native plugin, would mean that after installing it locally into project dependencies, you can run react-native create-bridge instead of having global executable.

Would be easier to version, adapt to breaking react-native changes and work across projects.

Since this is not a super documented feature, I would love to send a PR adding this.

Would you be / other users open to having such workflow instead?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
grabboucommented, Jul 17, 2017

@andrerfneves I am busy in upcoming days (travelling), so I am happy to help you as much as I can to land this!

To start - it’s really simple.

React Native CLI has a built-in mechanism for detecting plugins. In order to be detected as a plugin, your package has to meet the following criteria:

  • it has to start with react-native-*
  • it has to be present in package.json of an arbitrary React Native project
  • it has to include rnpm.plugin key in package.json, that points to a main plugin file, e.g.:
{
  "rnpm": {
     "plugin:" "./src/abc.js"
  }
}

Path should be relative to your root directory as we will resolve it later.

The plugin entry file (in our context - src/abc.js) has to be a file with module.exports that is either an object or an array of objects. Here’s is a flow type describing its shape. You can see it in action by checking bundle command definition. Options you define there are later used by the react-native cli to validate user input and print nice --help. For further reference, you can check other commands, like link or run-ios to see how they define the options.

In order to test it, you can just npm link your package to the testing react-native project. Don’t forget to add it to package.json dependencies.

2reactions
peggyrayziscommented, Jul 17, 2017

I absolutely love this idea and would gladly accept a PR! I didn’t even know custom plugins were an option so thank you so much for suggesting this.

I’m going to post on Twitter to see if anyone has any objections, although I don’t think anyone will 😀

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConvertPlug: Home
Convert Plus. All-in-one WordPress Popup plugin that transforms your website into a lead generation powerhouse.
Read more >
Convert Pro - The Best Lead Generation Tool for WordPress
Convert Pro is a powerful lead generation tool that converts your website traffic into leads. Get 300% more leads with Convert Pro.
Read more >
Converting an existing Java project to a plug-in project - IBM
In the Package Explorer view, right-click the Java project that you want to convert to a plug-in project, and click Configure > Convert...
Read more >
Convert Plugin — beets 1.6.0 documentation
The convert plugin lets you convert parts of your collection to a directory of your choice, transcoding audio and embedding album art along...
Read more >
Converter for Media – Optimize images | Convert WebP & AVIF
Upload the plugin files to /wp-content/plugins/webp-converter-for-media directory, or install the plugin through the WordPress plugins screen directly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found