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

Publish Flow type definitions alongside compiled bundle #6963

Closed
anandthakker opened this issue Jul 13, 2018 · 1 comment
Closed

Publish Flow type definitions alongside compiled bundle #6963

anandthakker opened this issue Jul 13, 2018 · 1 comment

Comments

@anandthakker
Copy link
Contributor

There isn't currently a straightforward way for a downstream consumer of Mapbox GL JS to benefit from the Flow type annotations that exist throughout our source code (and, specifically, on our public API). We should find a way to distribute dist/mapbox-gl.js.flow alongside the main bundle.

facebook/flow#5871 suggests that the flow gen-flow-types tool may get deprecated soon and so we probably don't want to rely on that.

Since we do include src/ in our npm package, we could use the approach mentioned in facebook/flow#5871 (comment) -- i.e., have dist/mapbox-gl.js.flow look like:

// @flow
export * from '../src/index.js';

This almost works, except that the downstream package would need to add many of the ignores that we use:

.*/node_modules/@mapbox/jsonlint-lines-primitives/.*
.*/node_modules/stylelint/.*
.*/node_modules/unflowify/.*
.*/node_modules/flow-coverage-report/.*
.*/node_modules/babel-plugin-transform-react-remove-prop-types/.*
.*/node_modules/conventional-changelog-core/.*
.*/node_modules/htmltojsx/.*
.*/node_modules/documentation/.*
.*/node_modules/module-deps/.*
.*/test/unit/style-spec/fixture/invalidjson.input.json
.*/test/integration/render-tests/.*

@shanshanzhu
Copy link

Can you try this in the .flowconfig? <PROJECT_ROOT>/node_modules/.*

anandthakker pushed a commit that referenced this issue Aug 3, 2018
anandthakker pushed a commit that referenced this issue Aug 3, 2018
anandthakker pushed a commit that referenced this issue Aug 3, 2018
anandthakker added a commit that referenced this issue Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants