Skip to content

Commit

Permalink
fix(flow): resolve errors on other flow versions (uber#2901)
Browse files Browse the repository at this point in the history
* fix(flow): maintain suppression comment position

* feat(flow): add tests to validate build against many flow versions

* fix(flow): yarn install in regression test dir

* fix(flow): lint build deps output

* fix(flow): convert spawn to spawnSync

* fix(flow): resolve flow errors on v0.111

* fix(flow): use public registry

* fix(flow): only check flow 110 and 111

* fix(flow): ignore react-window errors

* fix(flow): lint

* chore(flow): test script cp result

* fix(flow): build before flow check

* chore(flow): debug build copy

* chore(flow): log commands to stdout

* chore(flow): copy correctly on linux ci machine

* chore(flow): use an npm package
  • Loading branch information
chasestarr authored Feb 24, 2020
1 parent 4f37ccb commit ae3c3ab
Showing 24 changed files with 819 additions and 150 deletions.
18 changes: 18 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -28,62 +28,71 @@ steps:
run: baseui
agents:
queue: workers

- name: ':typescript:'
command: yarn tsc
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':eslint:'
command: yarn lint
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':flowtype:'
command: yarn flow check
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':jest:'
command: yarn unit-test
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':fossa:'
command: 'curl https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash && fossa'
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':deploy:'
command: './deploy.sh'
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':guard-component-sizes:'
command: './scripts/component-sizes.js'
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':documentation-site-link-checker:'
command: ./scripts/link-checker.js
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers

- name: ':e2e:'
# we have to install puppeteer here to trigger the install.js script
# and also to make sure we do not add this to the released build artifact
@@ -98,6 +107,7 @@ steps:
- e2e-server-healthy
agents:
queue: workers

- name: ':vrt:'
command: yarn vrt:ci
artifact_paths:
@@ -110,3 +120,11 @@ steps:
- e2e-server-healthy
agents:
queue: workers

- name: flow-check-build
command: ./scripts/flow-check-build.js
plugins:
'docker-compose#v3.0.3':
run: baseui
agents:
queue: workers
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[ignore]
<PROJECT_ROOT>/dist/.*
<PROJECT_ROOT>/src/codemods/.*
<PROJECT_ROOT>/packages/.*
babel
storybook-static
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -136,6 +136,7 @@
"extract-react-types": "^0.23.0",
"extract-react-types-loader": "^0.3.10",
"flow-bin": "^0.110.0",
"fs-extra": "^8.1.0",
"globby": "^10.0.1",
"husky": "^3.0.0",
"isomorphic-fetch": "^2.2.1",
15 changes: 15 additions & 0 deletions packages/flow-check-build/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[ignore]
; flow does not support negative lookaheads therefore each package with errors
; must be ignored individually https://github.com/facebook/flow/issues/564
.*/node_modules/react-window/.*\.js.flow$

[include]
index.js

[libs]

[lints]

[options]

[strict]
1 change: 1 addition & 0 deletions packages/flow-check-build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.npmrc
1 change: 1 addition & 0 deletions packages/flow-check-build/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
41 changes: 41 additions & 0 deletions packages/flow-check-build/build-dependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env node
/*
Copyright (c) 2018-2020 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/

/* eslint-env node */
/* eslint-disable flowtype/require-valid-file-annotation */
const fs = require('fs');
const path = require('path');

const baseui = fs
.readdirSync(path.resolve(__dirname, 'node_modules/baseui'))
.filter(item => {
const ignore = ['es', 'esm', 'a11y', 'helpers', 'utils', 'node_modules'];
return !ignore.includes(item) && !item.includes('.');
});

const imports = baseui
.map((item, index) => {
return `import * as $${index} from 'baseui/${item}';`;
})
.join('\n');

const source = `/*
Copyright (c) 2018-2020 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
/* eslint-disable */
${imports}
import * as baseui from 'baseui';
/* eslint-enable */
`;

fs.writeFileSync(path.resolve(__dirname, 'index.js'), source);
/* eslint-enable flowtype/require-valid-file-annotation */
66 changes: 66 additions & 0 deletions packages/flow-check-build/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Copyright (c) 2018-2020 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
/* eslint-disable */
import * as $0 from 'baseui/accordion';
import * as $1 from 'baseui/aspect-ratio-box';
import * as $2 from 'baseui/avatar';
import * as $3 from 'baseui/block';
import * as $4 from 'baseui/breadcrumbs';
import * as $5 from 'baseui/button';
import * as $6 from 'baseui/button-group';
import * as $7 from 'baseui/card';
import * as $8 from 'baseui/checkbox';
import * as $9 from 'baseui/data-table';
import * as $10 from 'baseui/datepicker';
import * as $11 from 'baseui/dnd-list';
import * as $12 from 'baseui/drawer';
import * as $13 from 'baseui/file-uploader';
import * as $14 from 'baseui/flex-grid';
import * as $15 from 'baseui/form-control';
import * as $16 from 'baseui/header-navigation';
import * as $17 from 'baseui/heading';
import * as $18 from 'baseui/icon';
import * as $19 from 'baseui/input';
import * as $20 from 'baseui/layer';
import * as $21 from 'baseui/layout-grid';
import * as $22 from 'baseui/link';
import * as $23 from 'baseui/list';
import * as $24 from 'baseui/locale';
import * as $25 from 'baseui/menu';
import * as $26 from 'baseui/modal';
import * as $27 from 'baseui/notification';
import * as $28 from 'baseui/pagination';
import * as $29 from 'baseui/payment-card';
import * as $30 from 'baseui/phone-input';
import * as $31 from 'baseui/pin-code';
import * as $32 from 'baseui/popover';
import * as $33 from 'baseui/progress-bar';
import * as $34 from 'baseui/progress-steps';
import * as $35 from 'baseui/radio';
import * as $36 from 'baseui/rating';
import * as $37 from 'baseui/select';
import * as $38 from 'baseui/side-navigation';
import * as $39 from 'baseui/slider';
import * as $40 from 'baseui/spinner';
import * as $41 from 'baseui/styles';
import * as $42 from 'baseui/table';
import * as $43 from 'baseui/table-grid';
import * as $44 from 'baseui/table-semantic';
import * as $45 from 'baseui/tabs';
import * as $46 from 'baseui/tag';
import * as $47 from 'baseui/textarea';
import * as $48 from 'baseui/themes';
import * as $49 from 'baseui/timepicker';
import * as $50 from 'baseui/timezonepicker';
import * as $51 from 'baseui/toast';
import * as $52 from 'baseui/tokens';
import * as $53 from 'baseui/tooltip';
import * as $54 from 'baseui/tree-view';
import * as $55 from 'baseui/typography';
import * as baseui from 'baseui';
/* eslint-enable */
15 changes: 15 additions & 0 deletions packages/flow-check-build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "flow-check-build",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"flow": "flow"
},
"author": "",
"license": "ISC",
"dependencies": {
"baseui": "latest",
"flow-bin": "0.110"
}
}
Loading

0 comments on commit ae3c3ab

Please sign in to comment.