-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Run application using package.json scripts #12004
Conversation
Awesome, thank you! 👍 |
@facebook-github-bot shipit |
@mkonicek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Why this should be supported? Is there any benefit of adding arbitrary commands to users package.json, like ios and android if there's already react-native run-ios available? What's the benefit? Ah, now I see (after reading Slack) that this is to make it compatible after ejecting from |
@@ -240,7 +240,9 @@ function createProject(name, options) { | |||
version: '0.0.1', | |||
private: true, | |||
scripts: { | |||
start: 'node node_modules/react-native/local-cli/cli.js start' | |||
start: 'node node_modules/react-native/local-cli/cli.js start', | |||
ios: 'react-native run-ios', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is actually going to work? In this context, react-native
points to the executable in node_modules/.bin/react-native
, which is this: https://github.com/facebook/react-native/blob/master/package.json#L114 and is used to warn users that react-native
cannot be installed globally. There's imo no way to refer to react-native-cli
from npm scripts context as far as I remember.
If you want to refer to the local-cli, access it like in start
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added these ios
and android
scripts to the scaffolded application and tried both of them - everything works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that is because you have the cli installed globally? What @grabbou is saying makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there was no react native in node modules and the script referred to local cli that found React Native up the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*referred to global cli
Ideally I would like to see all of the npm-local commands to have complete parity with the commands in react native local-cli. Then ideally we would release a new global The main advantage I can think of with this behavior is the ability for people to customize the actual implementation of start and run for their project, by adding flags or pointing to another command. Also people can add commands in their projects locally, and still have a similar interface. For example, windows users could enable |
Thanks for your feedback, guys! Yeah, I have |
This is already possible thanks to plugin system that ships out of the box (not yet documented), but things like
The above plugin system also allows you to override predefined commands and enhance their functionality by doing any kind of custom functionality you want. I am currently working on shipping that feature which is going to be used in Exponent mainly. All of these are currently possible with the
That's interesting idea, however it makes it complicated to add new commands or modify the existing pre-defined functionalities. I think given that all the benefits of doing so can be already achieved with the current implementation, there's no need in changing the way it's structured at this point. |
The reason I prefer to use the npm scripts is because it is highly standard across the community. This is how
I don't see how it is complicated. If |
In that case I think it makes sense, given that it uses a fallback to local cli (missed that point). Makes sense now. I'll make sure to follow up on that one tomorrow as it's related to my current work in that area |
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Summary: **Motivation:** According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands. **Test plan (required)** - [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)` Closes facebook/react-native#12004 Differential Revision: D4441837 Pulled By: mkonicek fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
Motivation:
According to the meeting notes published by @mkonicek yesterday, RN should support
yarn run ios
andyarn run android
commands.Test plan (required)
yarn(npm) run ios(android)