Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Generate .js.flow files #389

Closed
wants to merge 5 commits into from
Closed

Conversation

zpao
Copy link
Contributor

@zpao zpao commented May 12, 2016

I've done this before, it'll only take a few minutes
@zpao, before he realized upgrading Babel was a prereq

The main goal here was to generate .js.flow files and fix #366. Then I needed to upgrade Babel, which meant using the new fbjs preset, which then needed to be updated as it wasn't as done as we thought since Draft has different considerations than fbjs. So now we need facebook/fbjs#147 and facebook/fbjs#148 to land there and ship before we can take this.

The diff of lib/ is pretty boring. Mostly it's a result of a few things:

  • the helpers are different, this is particularly noticeable for classes
  • code generation around comments got better - previously block comments near rewritten nodes (notably require) would be moved but now stay where they should
  • conversely there are a bunch of newlines being inserted now. win some, lose some.
  • a few errant __esModule markers are gone, which is good. Looks like those were a result of the type exports being erroneously detected as real exports. This also means that type-only "modules" are now empty. It might be good to filter those out in the future but in the mean time I don't think they hurt except that there are a few more files.

@ghost ghost added the CLA Signed label May 12, 2016
@@ -90,6 +92,7 @@
"<rootDir>/node_modules/fbjs/lib/UserAgentData.js",
"<rootDir>/node_modules/fbjs-scripts/",
"<rootDir>/node_modules/immutable/",
"<rootDir>/node_modules/object-assign/",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code now has require('object-assign') because I brought that plugin over to the preset. Jest will mock that and so a bunch of tests fail.

@sophiebits
Copy link
Contributor

👍 otherwise. Do you know if there's any difference with the new class helpers?

@zpao
Copy link
Contributor Author

zpao commented May 13, 2016

It looks like the biggest change is actually that the preset has "loose" classes turned on (which maybe it shouldn't…) but we weren't doing that previously in this project (but we were in most others). So there are probably some subtle things there.

@ryyppy
Copy link

ryyppy commented Jun 20, 2016

Hey @zpao I see that your blocking issues facebook/fbjs#147 and facebook/fbjs#148 are merged, is there any way to make this PR work now?

@nikgraf
Copy link
Contributor

nikgraf commented Jun 28, 2016

Seems like the script is missing. I guess the PR is just a little outdated. Really looking forward to get all the flow-types …

Error: Cannot find module './scripts/module-map'

@paulyoung
Copy link
Contributor

I merged this with master locally, fixed the conflicts, and got the same result.

@zpao – did you forget to commit ./scripts/module-map?

@zpao
Copy link
Contributor Author

zpao commented Jun 29, 2016

I'll be coming back to this shortly.

@zpao zpao mentioned this pull request Jun 29, 2016
6 tasks
@zpao
Copy link
Contributor Author

zpao commented Jul 1, 2016

@facebook-github-bot import

@facebook-github-bot
Copy link

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

zpao added 5 commits July 5, 2016 11:12
Ideally we'd use something local and based on Babel 6 but that's a bit
more work, it looks like there still isn't a drop-in replacement so this
will do.
Node 6 and npm 3 appear to work fine, not seeing any issues with Flow
nor Jest.
@ghost ghost closed this in d9a1898 Jul 5, 2016
ouchxp pushed a commit to ouchxp/draft-js that referenced this pull request Apr 7, 2017
Summary:
> I've done this before, it'll only take a few minutes
> — zpao, before he realized upgrading Babel was a prereq

The main goal here was to generate `.js.flow` files and fix facebookarchive#366. Then I needed to upgrade Babel, which meant using the new fbjs preset, which then needed to be updated as it wasn't as done as we thought since Draft has different considerations than fbjs. So now we need facebook/fbjs#147 and facebook/fbjs#148 to land there and ship before we can take this.

The [diff of lib/](https://gist.github.com/zpao/32c511aa1151aef1009eccb4f1cf0a5f) is pretty boring. Mostly it's a result of a few things:
- the helpers are different, this is particularly noticeable for classes
- code generation around comments got better - previously block comments near rewritten nodes (notably `require`) would be moved but now stay where they should
- conversely there are a bunch of newlines being inserted now. win some, lose some.
- a few errant `__esModule` markers
Closes facebookarchive#389

Reviewed By: hellendag

Differential Revision: D3512297

fbshipit-source-id: 440de7b0f8110a850d20aa2dc420fd5638e1878a
midas19910709 added a commit to midas19910709/draft-js that referenced this pull request Mar 30, 2022
Summary:
> I've done this before, it'll only take a few minutes
> — zpao, before he realized upgrading Babel was a prereq

The main goal here was to generate `.js.flow` files and fix #366. Then I needed to upgrade Babel, which meant using the new fbjs preset, which then needed to be updated as it wasn't as done as we thought since Draft has different considerations than fbjs. So now we need facebook/fbjs#147 and facebook/fbjs#148 to land there and ship before we can take this.

The [diff of lib/](https://gist.github.com/zpao/32c511aa1151aef1009eccb4f1cf0a5f) is pretty boring. Mostly it's a result of a few things:
- the helpers are different, this is particularly noticeable for classes
- code generation around comments got better - previously block comments near rewritten nodes (notably `require`) would be moved but now stay where they should
- conversely there are a bunch of newlines being inserted now. win some, lose some.
- a few errant `__esModule` markers
Closes facebookarchive/draft-js#389

Reviewed By: hellendag

Differential Revision: D3512297

fbshipit-source-id: 440de7b0f8110a850d20aa2dc420fd5638e1878a
alicayan008 pushed a commit to alicayan008/draft-js that referenced this pull request Jul 4, 2023
Summary:
> I've done this before, it'll only take a few minutes
> — zpao, before he realized upgrading Babel was a prereq

The main goal here was to generate `.js.flow` files and fix #366. Then I needed to upgrade Babel, which meant using the new fbjs preset, which then needed to be updated as it wasn't as done as we thought since Draft has different considerations than fbjs. So now we need facebook/fbjs#147 and facebook/fbjs#148 to land there and ship before we can take this.

The [diff of lib/](https://gist.github.com/zpao/32c511aa1151aef1009eccb4f1cf0a5f) is pretty boring. Mostly it's a result of a few things:
- the helpers are different, this is particularly noticeable for classes
- code generation around comments got better - previously block comments near rewritten nodes (notably `require`) would be moved but now stay where they should
- conversely there are a bunch of newlines being inserted now. win some, lose some.
- a few errant `__esModule` markers
Closes facebookarchive/draft-js#389

Reviewed By: hellendag

Differential Revision: D3512297

fbshipit-source-id: 440de7b0f8110a850d20aa2dc420fd5638e1878a
aforismesen added a commit to aforismesen/draft-js that referenced this pull request Jul 12, 2024
Summary:
> I've done this before, it'll only take a few minutes
> — zpao, before he realized upgrading Babel was a prereq

The main goal here was to generate `.js.flow` files and fix #366. Then I needed to upgrade Babel, which meant using the new fbjs preset, which then needed to be updated as it wasn't as done as we thought since Draft has different considerations than fbjs. So now we need facebook/fbjs#147 and facebook/fbjs#148 to land there and ship before we can take this.

The [diff of lib/](https://gist.github.com/zpao/32c511aa1151aef1009eccb4f1cf0a5f) is pretty boring. Mostly it's a result of a few things:
- the helpers are different, this is particularly noticeable for classes
- code generation around comments got better - previously block comments near rewritten nodes (notably `require`) would be moved but now stay where they should
- conversely there are a bunch of newlines being inserted now. win some, lose some.
- a few errant `__esModule` markers
Closes facebookarchive/draft-js#389

Reviewed By: hellendag

Differential Revision: D3512297

fbshipit-source-id: 440de7b0f8110a850d20aa2dc420fd5638e1878a
This pull request was closed.
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.

Expose flow.
6 participants