Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting Third-party Platforms in RNPM + Metro Bundler #21

Closed
empyrical opened this issue Aug 24, 2018 · 6 comments
Closed

Supporting Third-party Platforms in RNPM + Metro Bundler #21

empyrical opened this issue Aug 24, 2018 · 6 comments
Labels
🗣 Discussion This label identifies an ongoing discussion on a subject

Comments

@empyrical
Copy link
Member

Right now (in 0.56 and the first RC of 0.57) you need to modify jest/hasteImpl.js and local-cli/core/index.js so Metro and Haste can find your platform's JS files, as can be seen with windows (facebook/react-native@5494274) and dom (facebook/react-native#20393)

@matthargett has a pull request in the main RN repo tackling this: facebook/react-native#20662

I have not turned this commit into a PR yet, but I think that an additional "haste" key could be added under a platform's "rnpm" entry in package.json (much like how it works with jest, see here)

Example:

{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-foo"
      ],
      "platforms": [
        "foo"
      ]
    }
}

My commit: empyrical/react-native@d7a0c6b (I have opted not to make a PR until more discussion is had)

I think that also whatever way is added to support custom platform plugins makes its way in, there should be some sort of unit test added in with a dummy platform to help ensure that custom platform support is unbroken. A simple little test fixture with the bare minimum files required for a successful bundle to be built. I will probably take a stab at this too.

@kelset kelset changed the title RFC/General Discussion: Supporting Third-party Platforms in RNPM + Metro Bundler Supporting Third-party Platforms in RNPM + Metro Bundler Aug 24, 2018
@kelset kelset added the 🗣 Discussion This label identifies an ongoing discussion on a subject label Aug 24, 2018
@empyrical
Copy link
Member Author

My pull request implementing the idea in the OP is going to land in the RN repo.

Perhaps this issue could be used to talk about other ways in which RN could be enhanced for add-on platforms? Otherwise, I may close it.

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Aug 30, 2018
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: #20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
@kelset
Copy link
Member

kelset commented Aug 31, 2018

Yeah it looks like it landed! 🎉

Thanks for the PR first off - second, I think it may be worth talking about your question in core

Would it be worth documenting this out-of-platform registration syntax on react-native-website?

I think it would be great, maybe it could be even worth its own page in the Guides, similar to this -> https://facebook.github.io/react-native/docs/0.56/native-modules-setup

kelset pushed a commit to facebook/react-native that referenced this issue Aug 31, 2018
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: #20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
@empyrical
Copy link
Member Author

I've made a PR adding a whole new page about this. I also thought it would be worth mentioning the existing platforms that have been made for React Native in the docs as well:

facebook/react-native-website#541

gengjiawen pushed a commit to gengjiawen/react-native that referenced this issue Sep 14, 2018
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds facebook#20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
aleclarson pushed a commit to aleclarson/react-native that referenced this issue Sep 16, 2018
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds facebook#20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
grabbou pushed a commit to react-native-community/cli that referenced this issue Sep 26, 2018
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook/react-native#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
@grabbou
Copy link
Member

grabbou commented Nov 19, 2018

Regarding support of additional platforms, this is still something that I would love to discuss with interested people and work on the plan going forward.

My interest is particularly targeted at supporting different platforms within React Native CLI. Right now, there's "initial" support for external platforms (and their respective commands) via plug-in system. Some code paths are also hard-coded inside link and unlink command to support that functionality on Windows.

I don't really like how the latter ended up evolving from the maintenance perspective and would like to simplify it a bit.

It would be great to have a meeting regarding that in order to understand how other platforms integrate with React Native right now, what are the limitations and what would be the expected outcome.

Shall I set up a meeting?

aleclarson added a commit to aleclarson/react-native-macos that referenced this issue Dec 25, 2018
Taken from: facebook/react-native@03476a2

Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook/react-native#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
aleclarson added a commit to aleclarson/react-native-macos that referenced this issue Jan 29, 2019
Taken from: facebook/react-native@03476a2

Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook/react-native#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
aleclarson added a commit to aleclarson/react-native-macos that referenced this issue Jan 29, 2019
Taken from: facebook/react-native@03476a2

Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook/react-native#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
aleclarson added a commit to aleclarson/react-native-macos that referenced this issue Mar 3, 2019
Taken from: facebook/react-native@03476a2

Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook/react-native#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
@rozele
Copy link
Collaborator

rozele commented Mar 6, 2019

@grabbou did you ever set up a meeting about this?

@grabbou
Copy link
Member

grabbou commented Mar 7, 2019

Not yet, but it's on our roadmap. We want to improve the integration, especially for the link itself. If you'd be interested in discussing this at some point, we could schedule a meeting.

t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds facebook#20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds facebook#20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: react-native-community/discussions-and-proposals#21
Pull Request resolved: facebook#20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
@kelset kelset closed this as completed Jun 8, 2021
@react-native-community react-native-community locked and limited conversation to collaborators Jun 8, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
🗣 Discussion This label identifies an ongoing discussion on a subject
Projects
None yet
Development

No branches or pull requests

4 participants