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
Merged

Flow init to run as command not flag #2522

merged 1 commit into from
Jun 12, 2017

Conversation

khanglu
Copy link
Contributor

@khanglu khanglu commented Jun 12, 2017

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

- Call `npm run flow --init` won't create a .flowconfig file, it should be `npm run flow init`
@facebook-github-bot
Copy link

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
Copy link

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

@Timer
Copy link
Contributor

Timer commented Jun 12, 2017

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

@khanglu
Copy link
Contributor Author

khanglu 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
Copy link
Contributor

Timer 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
Copy link
Contributor Author

khanglu 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
Copy link
Contributor

Timer 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
Copy link
Contributor

Timer 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

@khanglu khanglu Jun 12, 2017

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor Author

khanglu 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
Copy link
Contributor

Timer commented Jun 12, 2017

Great, thanks so much!

@Timer Timer merged commit 67f6163 into facebook:master Jun 12, 2017
paweljedrzejczyk pushed a commit to paweljedrzejczyk/create-react-app that referenced this pull request Jun 12, 2017
* 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 mentioned this pull request Jun 28, 2017
romaindso pushed a commit to romaindso/create-react-app that referenced this pull request Jul 10, 2017
- 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
- 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants