Skip to content
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

Flow init to run as command not flag #2522

Merged
merged 1 commit into from Jun 12, 2017

Conversation

Projects
None yet
4 participants
@khanglu
Copy link
Contributor

commented Jun 12, 2017

  • Call npm run flow --init won't create a .flowconfig file, it should be npm run flow init
Flow init to run as command not flag
- Call `npm run flow --init` won't create a .flowconfig file, it should be `npm run flow init`
@facebook-github-bot

This comment has been minimized.

Copy link

commented Jun 12, 2017

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot

This comment has been minimized.

Copy link

commented Jun 12, 2017

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@Timer

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2017

Does npm run flow -- init work? Note the space after the --.

@khanglu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2017

It does as it is the same as npm run flow init. I believe -- is an empty flag and should do nothing or did I miss your point?

@Timer

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2017

-- is a non-official special operator in bash that signifies the end of a command. What we're doing here is ensuring that init is passed to flow, and not consumed by npm.

If dropping the -- works in npm@>=3, I see no harm in changing this as to reduce confusion.
Can you please test this on npm 3, 4, and 5?

@khanglu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2017

Thanks for the explanation @Timer, new thing to learn everyday!

I tested on npm 3.10.10, 4.6.1 and 5.0.3, same result: npm run flow --init is throwing error of missing .flowconfig file and npm run flow init will create the .flowconfig file. I guess we should drop the -- then.

@Timer

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2017

Neat! And yeah the npm run flow --init is expected to error because you're treating init as a flag.

@Timer

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2017

Sorry to be a bother, but can you please make sure yarn flow init works too?

@@ -690,7 +690,7 @@ To add Flow to a Create React App project, follow these steps:

1. Run `npm install --save-dev flow-bin` (or `yarn add --dev flow-bin`).
2. Add `"flow": "flow"` to the `scripts` section of your `package.json`.
3. Run `npm run flow -- init` (or `yarn flow -- init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory.
3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory.

This comment has been minimized.

Copy link
@luftywiranda13

luftywiranda13 Jun 12, 2017

Contributor

maybe we can update the link to point to https://flow.org/en/docs/usage/#toc-initialize-your-project
it's explaining most of the steps better

This comment has been minimized.

Copy link
@khanglu

khanglu Jun 12, 2017

Author Contributor

Thanks for the suggestion! However, I believe the original purpose here is to show that we can start using flow with just 3 simple steps and the link is to explain what goes inside .flowconfig file. Fixing the command should be sufficient for my purpose of this PR.

This comment has been minimized.

Copy link
@luftywiranda13

luftywiranda13 Jun 12, 2017

Contributor

yeah I got it.
I also agree with your PR here because I think we should just follow
the instruction given by flow on its doc to make things simple and prevent confusion

@khanglu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2017

No problem at all, it is the same case as npm, yarn flow init works and yarn flow --init doesn't.

@Timer

This comment has been minimized.

Copy link
Collaborator

commented Jun 12, 2017

Great, thanks so much!

@Timer Timer merged commit 67f6163 into facebook:master Jun 12, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

paweljedrzejczyk added a commit to paweljedrzejczyk/create-react-app that referenced this pull request Jun 12, 2017

Update from upstream repo facebookincubator/create-react-app (#1)
* Update Travis CI Node versions in User Guide (facebook#2454)

Removed Node v4 (CRA only supports Node >= 6)

* re-add storybook && update the documentation and links (facebook#2331)

* re-add storybook && update the documentation and links

* Change to new documentation domain

* Prioritize index.css over the implicit App.css (facebook#2470)

* Added NamedModulesPlugin in webpack.config.dev.js (facebook#2458)

* Added NamedModulesPlugin in webpack.config.dev.js

* Update webpack.config.dev.js

* Unscope detect-port (facebook#2483)

Resolves facebook#2481

* Update webpack links to point to webpack 2 (facebook#2492)

* Update README.md to make links to webpack point to webpack.js.org instead
  insteade of webpack 1 webpack.githup.io

* chore(templates): Move GitHub templates to hidden .github folder (facebook#2489)

* Fix minor docs typo (facebook#2500)

* Fix link to Storybook docs (facebook#2521)

* Simplify flow init docs (facebook#2522)

- Call `npm run flow --init` won't create a .flowconfig file, it should be `npm run flow init`

@gaearon gaearon referenced this pull request Jun 28, 2017

Merged

Changelog for 1.0.8 #2664

romaindso added a commit to romaindso/create-react-app that referenced this pull request Jul 10, 2017

Simplify flow init docs (facebook#2522)
- Call `npm run flow --init` won't create a .flowconfig file, it should be `npm run flow init`

wmonk referenced this pull request in wmonk/create-react-app-typescript Aug 7, 2017

Simplify flow init docs (#2522)
- Call `npm run flow --init` won't create a .flowconfig file, it should be `npm run flow init`

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.