Skip to content

Commit

Permalink
Expose flow typings with gen-flow-files (#468)
Browse files Browse the repository at this point in the history
Summary:
Fixes #165
Use https://github.com/lessmess-dev/gen-flow-files to generate flow type definitions for consuming applications

This generates tons of flow errors that can't be resolved though so users have to add the dependency to their `[declarations]`

```
[declarations]
.*node_modules/recoil/.*
```

Otherwise you get errors such as:
<img width="908" alt="Screen Shot 2020-07-11 at 7 47 03 pm" src="https://user-images.githubusercontent.com/12436524/87221437-53bfe700-c3af-11ea-9ab5-31a1c7c82d40.png">

Pull Request resolved: #468

Reviewed By: drarmstr

Differential Revision: D23144185

Pulled By: mondaychen

fbshipit-source-id: 7359ac1e75b29cfa24ef516f1a3d7ed0221d3a29
  • Loading branch information
Brianzchen authored and facebook-github-bot committed Aug 17, 2020
1 parent c6b2ba2 commit 4a25ce6
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -15,7 +15,8 @@
"license": "MIT",
"scripts": {
"prepare": "install-peers",
"build": "rollup -c && node scripts/postbuild.js",
"build:flow": "gen-flow-files src --out-dir lib && mv lib/Recoil_index.js.flow lib/recoil.js.flow",
"build": "rollup -c && node scripts/postbuild.js && yarn build:flow",
"test": "jest src/*",
"format": "prettier --write \"./**/*.{js,md,json}\"",
"flow": "flow --show-all-errors",
Expand Down Expand Up @@ -52,6 +53,7 @@
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-react": "^7.20.0",
"flow-bin": "^0.126.1",
"gen-flow-files": "^0.4.11",
"husky": ">=4",
"immutable": "^4.0.0-rc.12",
"install-peers-cli": "^2.2.0",
Expand Down
154 changes: 153 additions & 1 deletion yarn.lock
Expand Up @@ -8,6 +8,13 @@
dependencies:
"@babel/highlight" "^7.10.1"

"@babel/code-frame@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==
dependencies:
"@babel/highlight" "^7.10.4"

"@babel/core@^7.1.0", "@babel/core@^7.7.5", "@babel/core@^7.9.6":
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.2.tgz#bd6786046668a925ac2bd2fd95b579b92a23b36a"
Expand Down Expand Up @@ -38,6 +45,16 @@
lodash "^4.17.13"
source-map "^0.5.0"

"@babel/generator@^7.10.4", "@babel/generator@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.10.4.tgz#e49eeed9fe114b62fa5b181856a43a5e32f5f243"
integrity sha512-toLIHUIAgcQygFZRAQcsLQV3CBuX6yOIru1kJk/qqqvcRmZrYe6WavZTSG+bB8MxhnL9YPf+pKQfuiP161q7ng==
dependencies:
"@babel/types" "^7.10.4"
jsesc "^2.5.1"
lodash "^4.17.13"
source-map "^0.5.0"

"@babel/helper-annotate-as-pure@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.1.tgz#f6d08acc6f70bbd59b436262553fb2e259a1a268"
Expand Down Expand Up @@ -86,12 +103,28 @@
"@babel/template" "^7.10.1"
"@babel/types" "^7.10.1"

"@babel/helper-function-name@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a"
integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==
dependencies:
"@babel/helper-get-function-arity" "^7.10.4"
"@babel/template" "^7.10.4"
"@babel/types" "^7.10.4"

"@babel/helper-get-function-arity@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.1.tgz#7303390a81ba7cb59613895a192b93850e373f7d"
dependencies:
"@babel/types" "^7.10.1"

"@babel/helper-get-function-arity@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2"
integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==
dependencies:
"@babel/types" "^7.10.4"

"@babel/helper-member-expression-to-functions@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.1.tgz#432967fd7e12a4afef66c4687d4ca22bc0456f15"
Expand Down Expand Up @@ -126,6 +159,11 @@
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.1.tgz#ec5a5cf0eec925b66c60580328b122c01230a127"

"@babel/helper-plugin-utils@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==

"@babel/helper-replace-supers@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.1.tgz#ec6859d20c5d8087f6a2dc4e014db7228975f13d"
Expand All @@ -148,10 +186,22 @@
dependencies:
"@babel/types" "^7.10.1"

"@babel/helper-split-export-declaration@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1"
integrity sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg==
dependencies:
"@babel/types" "^7.10.4"

"@babel/helper-validator-identifier@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz#5770b0c1a826c4f53f5ede5e153163e0318e94b5"

"@babel/helper-validator-identifier@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==

"@babel/helpers@^7.10.1":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.1.tgz#a6827b7cb975c9d9cef5fd61d919f60d8844a973"
Expand All @@ -168,10 +218,24 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/highlight@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143"
integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==
dependencies:
"@babel/helper-validator-identifier" "^7.10.4"
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@^7.1.0", "@babel/parser@^7.10.1", "@babel/parser@^7.10.2", "@babel/parser@^7.7.0":
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.2.tgz#871807f10442b92ff97e4783b9b54f6a0ca812d0"

"@babel/parser@^7.10.4", "@babel/parser@^7.7.5":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.4.tgz#9eedf27e1998d87739fb5028a5120557c06a1a64"
integrity sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA==

"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.8.3":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.1.tgz#046bc7f6550bb08d9bd1d4f060f5f5a4f1087e01"
Expand Down Expand Up @@ -201,6 +265,14 @@
"@babel/helper-plugin-utils" "^7.10.1"
"@babel/plugin-syntax-optional-chaining" "^7.8.0"

"@babel/plugin-proposal-throw-expressions@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-throw-expressions/-/plugin-proposal-throw-expressions-7.10.4.tgz#501154a3c1b33cb1ad5b899204481fa2859cd3f3"
integrity sha512-m7K9duXeH/rko36i9G9seLOg2AVdeVTn65k8nnTxgozex0hkDSUr6cktJxTO7jElGEpmMz410pTs0Jn8+empxw==
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-syntax-throw-expressions" "^7.10.4"

"@babel/plugin-syntax-async-generators@^7.8.4":
version "7.8.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d"
Expand All @@ -225,6 +297,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.1"

"@babel/plugin-syntax-flow@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.10.4.tgz#53351dd7ae01995e567d04ce42af1a6e0ba846a6"
integrity sha512-yxQsX1dJixF4qEEdzVbst3SZQ58Nrooz8NV9Z9GL4byTE25BvJgl5lf0RECUf0fh28rZBb/RYTWn/eeKwCMrZQ==
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"

"@babel/plugin-syntax-import-meta@^7.8.3":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.1.tgz#3e59120ed8b3c2ccc5abb1cfc7aaa3ea01cd36b6"
Expand Down Expand Up @@ -279,6 +358,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/plugin-syntax-throw-expressions@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-throw-expressions/-/plugin-syntax-throw-expressions-7.10.4.tgz#a588df9fa2203207a3ac7e35f0db3b67bf68eca3"
integrity sha512-Yac/4W71+JdAiOV3aLbnUUe2R0NZzNvdy5EqdauFnBQTxIXT58M89lOplIFVELTSus6PxFMjmbi2vXaJDiV/PQ==
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"

"@babel/plugin-transform-arrow-functions@^7.0.0":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.1.tgz#cb5ee3a36f0863c06ead0b409b4cc43a889b295b"
Expand Down Expand Up @@ -481,6 +567,15 @@
"@babel/parser" "^7.10.1"
"@babel/types" "^7.10.1"

"@babel/template@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278"
integrity sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"

"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.1", "@babel/traverse@^7.7.0":
version "7.10.1"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.1.tgz#bbcef3031e4152a6c0b50147f4958df54ca0dd27"
Expand All @@ -495,6 +590,21 @@
globals "^11.1.0"
lodash "^4.17.13"

"@babel/traverse@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.4.tgz#e642e5395a3b09cc95c8e74a27432b484b697818"
integrity sha512-aSy7p5THgSYm4YyxNGz6jZpXf+Ok40QF3aA2LyIONkDHpAcJzDUqlCKXv6peqYUs2gmic849C/t2HKw2a2K20Q==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/generator" "^7.10.4"
"@babel/helper-function-name" "^7.10.4"
"@babel/helper-split-export-declaration" "^7.10.4"
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.13"

"@babel/types@^7.0.0", "@babel/types@^7.10.1", "@babel/types@^7.10.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.7.0":
version "7.10.2"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.2.tgz#30283be31cad0dbf6fb00bd40641ca0ea675172d"
Expand All @@ -503,6 +613,15 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@babel/types@^7.10.4", "@babel/types@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.4.tgz#369517188352e18219981efd156bfdb199fff1ee"
integrity sha512-UTCFOxC3FsFHb7lkRMVvgLzaRVamXuAs2Tz4wajva4WxtVY82eZeaUBtC2Zt95FU9TiznuC0Zk35tsim8jeVpg==
dependencies:
"@babel/helper-validator-identifier" "^7.10.4"
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
Expand Down Expand Up @@ -2247,6 +2366,22 @@ gauge@~2.7.3:
strip-ansi "^3.0.1"
wide-align "^1.1.0"

gen-flow-files@^0.4.11:
version "0.4.11"
resolved "https://registry.yarnpkg.com/gen-flow-files/-/gen-flow-files-0.4.11.tgz#ace4934f529aa6a40c83337f21494ed6dc57ac4e"
integrity sha512-88WjoL6gaxTaJtSal6Nsw9LerVKRVjQEAJy330VOmCS1k+lu2h1HJEJyU9LhviaphZBNG088j6JigA6YiP0xGQ==
dependencies:
"@babel/core" "^7.7.5"
"@babel/generator" "^7.7.4"
"@babel/parser" "^7.7.5"
"@babel/plugin-proposal-throw-expressions" "^7.7.4"
"@babel/plugin-syntax-flow" "^7.7.4"
"@babel/traverse" "^7.7.4"
"@babel/types" "^7.7.4"
glob "^7.1.6"
mkdirp "^0.5.1"
yargs "^15.0.2"

gensync@^1.0.0-beta.1:
version "1.0.0-beta.1"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269"
Expand Down Expand Up @@ -4995,13 +5130,30 @@ yaml@^1.7.2:
version "1.10.0"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"

yargs-parser@^18.1.1:
yargs-parser@^18.1.1, yargs-parser@^18.1.2:
version "18.1.3"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"

yargs@^15.0.2:
version "15.4.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
dependencies:
cliui "^6.0.0"
decamelize "^1.2.0"
find-up "^4.1.0"
get-caller-file "^2.0.1"
require-directory "^2.1.1"
require-main-filename "^2.0.0"
set-blocking "^2.0.0"
string-width "^4.2.0"
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^18.1.2"

yargs@^15.1.0, yargs@^15.3.1:
version "15.3.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b"
Expand Down

0 comments on commit 4a25ce6

Please sign in to comment.