Skip to content

Conversation

@philikon
Copy link
Contributor

@philikon philikon commented Jun 7, 2016

This will allow consumers to supply their own transformer to all react-native cli commands by simply implementing rn-cli.config.js and overriding getTransformModulePath(). That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a --transformer command line argument.

Test plan: Applied this patch to the React Native version in my app, implemented getTransformModulePath() in my rn-cli.config.js, and verified that my custom transformer is invoked.

@ghost
Copy link

ghost commented Jun 7, 2016

By analyzing the blame information on this pull request, we identified @sam-swarr and @martinbigio to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jun 7, 2016
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
transformModulePath: path.resolve(args.transformer),
transformModulePath: path.resolve(args.transformer) ||
config.getTransformModulePath(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this never gets hit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I get for last minute refactoring.

@ide
Copy link
Contributor

ide commented Jun 7, 2016

path.resolve(null) crashes -- see the tests

@ghost
Copy link

ghost commented Jun 8, 2016

@philikon updated the pull request.

@philikon philikon force-pushed the transformer_config branch from 7266a5b to 1939e98 Compare June 8, 2016 01:18
@ghost
Copy link

ghost commented Jun 8, 2016

@philikon updated the pull request.

1 similar comment
@ghost
Copy link

ghost commented Jun 8, 2016

@philikon updated the pull request.

@ide
Copy link
Contributor

ide commented Jun 8, 2016

@facebook-github-bot shipit

@ghost ghost added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Jun 8, 2016
@ghost
Copy link

ghost commented Jun 8, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review.

@philikon
Copy link
Contributor Author

philikon commented Jun 8, 2016

@ide <3 thanks!

@ghost ghost added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Jun 8, 2016
@ghost
Copy link

ghost commented Jun 8, 2016

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@philikon
Copy link
Contributor Author

@mkonicek some help please?

@philikon
Copy link
Contributor Author

Hey folks, can I just get a stack trace or some other hint for why it's failing on the FB side?

@philikon philikon force-pushed the transformer_config branch from 1939e98 to c44e449 Compare June 17, 2016 04:10
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.
@mkonicek
Copy link
Contributor

@philikon I pinged the RN oncall. For some reason it throws when used from the internal CLI:

TypeError: config.getTransformModulePath is not a function
    at _dependencies (react-native-github/local-cli/dependencies/dependencies.js:57:90)
    at react-native-github/local-cli/dependencies/dependencies.js:23:5
    at tryCallTwo (react-native-github/node_modules/promise/lib/core.js:45:5)
    at doResolve (react-native-github/node_modules/promise/lib/core.js:200:13)
    at new Promise (react-native-github/node_modules/promise/lib/core.js:66:3)
    at dependencies (react-native-github/local-cli/dependencies/dependencies.js:22:10)
    at Object.run (react-native-internal-cli/src/cli.js:36:10)

@mkonicek
Copy link
Contributor

Assigning to @foghina so it shows up in the internal diff queue, if you're swamped can you assign it to Andrei who's the next oncall?

@mkonicek
Copy link
Contributor

@philikon Is it a breaking change? Does the stack trace make sense? Should we fix our internal code to work with this?

@philikon
Copy link
Contributor Author

Thanks @mkonicek!

It shouldn't be a breaking change because I'm providing a fallback in local-cli/default.config.js. I suspect that react-native-internal-cli provides its own default.config.js that doesn't have the fallback, so that's why it's failing.

It'd be great if the default config in react-native-internal-cli were updated, or even better, react-native-internal-cli would fallback to react-native/local-cli/default.config.js, so that something like this doesn't happen in the future.

@philikon
Copy link
Contributor Author

@foghina let me know if I can help in any way besides my comment above. Either way, I'll buy you many beers next time I'm in London :)

@foghina
Copy link
Contributor

foghina commented Jun 22, 2016

@philikon I think I fixed it internally. It's landing now, let's see what happens...

@ghost ghost closed this in dd9b3e1 Jun 22, 2016
@philikon
Copy link
Contributor Author

<3 <3 <3 @foghina

@philikon philikon deleted the transformer_config branch June 22, 2016 18:44
bubblesunyum pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.

**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes facebook#7961

Differential Revision: D3404201

Pulled By: foghina

fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.

**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes facebook#7961

Differential Revision: D3404201

Pulled By: foghina

fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
philikon referenced this pull request Sep 7, 2016
Summary:
This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.).

It's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.

<s>This is still WIP and some of the commands are left commented out.</s>

For the `config` of `rnpm` (functions get info about project and dependency), <s>I am thinking we can merge them with</s> we decided to merge it with [`default.config.js`](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/default.config.js#L33), so they are available on the `new Config()` [instance](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/cliEntry.js#L59) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e
Closes #7899

Differential Revision: D3613193

Pulled By: bestander

fbshipit-source-id: 09a072f3b21e5239dfcd8da88a205bd28dc5d037
philikon added a commit to philikon/react-native that referenced this pull request Sep 7, 2016
Restores feature introduced in facebook#7961 after it's been paved partially by facebook#7899
philikon added a commit to philikon/react-native that referenced this pull request Sep 8, 2016
Restores feature introduced in facebook#7961 after it's been paved partially by facebook#7899
ghost pushed a commit that referenced this pull request Sep 12, 2016
Summary:
Restores feature introduced in #7961 after it's been paved partially by #7899

**Test Plan:** ran example in https://github.com/philikon/ReactNativify against a React Native with and without this patch
Closes #9799

Differential Revision: D3852601

Pulled By: mkonicek

fbshipit-source-id: fc3c80bdb254145fefa870eea1828b4ef33f9297
miklschmidt pushed a commit to secoya/react-native that referenced this pull request Oct 7, 2016
Summary:
Restores feature introduced in facebook#7961 after it's been paved partially by facebook#7899

**Test Plan:** ran example in https://github.com/philikon/ReactNativify against a React Native with and without this patch
Closes facebook#9799

Differential Revision: D3852601

Pulled By: mkonicek

fbshipit-source-id: fc3c80bdb254145fefa870eea1828b4ef33f9297
@vikeri
Copy link
Contributor

vikeri commented Oct 20, 2016

@philikon What is the use case of this? Is it something that would be useful for us developing React Native with ClojureScript? (Where the Clojurescript compiler already outputs ES3 compliant code).

cpojer pushed a commit to facebook/metro that referenced this pull request Jan 26, 2017
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.

**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes facebook/react-native#7961

Differential Revision: D3404201

Pulled By: foghina

fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.

**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes facebook/react-native#7961

Differential Revision: D3404201

Pulled By: foghina

fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants