{"id":13533004,"url":"https://github.com/albertywu/flowshift","last_synced_at":"2025-05-15T08:32:58.373Z","repository":{"id":147187419,"uuid":"168910715","full_name":"albertywu/flowshift","owner":"albertywu","description":"flow to typescript codemods","archived":false,"fork":false,"pushed_at":"2019-02-10T07:33:09.000Z","size":155,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-03T06:41:56.783Z","etag":null,"topics":["flow","flowtype","languages","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albertywu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-03T04:52:47.000Z","updated_at":"2023-09-19T16:28:34.000Z","dependencies_parsed_at":"2023-07-03T21:02:01.318Z","dependency_job_id":null,"html_url":"https://github.com/albertywu/flowshift","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertywu%2Fflowshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertywu%2Fflowshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertywu%2Fflowshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertywu%2Fflowshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertywu","download_url":"https://codeload.github.com/albertywu/flowshift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254304654,"owners_count":22048446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flow","flowtype","languages","typescript"],"created_at":"2024-08-01T07:01:15.757Z","updated_at":"2025-05-15T08:32:56.136Z","avatar_url":"https://github.com/albertywu.png","language":"JavaScript","readme":"# Flowshift\nFlowshift is a toolkit for for transforming [flow](https://flow.org/) to [typescript](http://www.typescriptlang.org/) using [jscodeshift](https://github.com/facebook/jscodeshift).\n\nEach plugin is a jscodeshift-style [transform](https://github.com/facebook/jscodeshift#transform-module), which makes codemods easy to test in isolation. See here for a sample [plugin](https://github.com/albertywu/flowshift/blob/master/plugins/generic-bounds/generic-bounds.js) and its associated [test file](https://github.com/albertywu/flowshift/blob/master/plugins/generic-bounds/__tests__/basics.js).\n\n# Todo\n- [x] exact types removal\n- [x] covariance notation `+ -\u003e readonly`\n- [x] generics \n  - [x] basics\n  - [x] bounded polymorphism\n- [x] maybe types\n- [x] imports remove type\n- [ ] type casting\n- [ ] typeof imports\n- [ ] $Enum\u003cX\u003e -\u003e keyof X\n- [ ] $Record\n- [ ] type-narrowing functions (%checks)\n- [ ] flag unfix-able with a comment\n- [ ] release\n  - [ ] generate a manifest file that maps flow file -\u003e replacements\n  - [ ] docs\n\n# Run a Plugin\n```sh\n# 1) install jscodeshift\nyarn global add jscodeshift\n\n# 2) run a plugin on a flow file\njscodeshift --parser=flow -t \u003cpath-to-plugin-file\u003e \u003cflow file\u003e\n\n# 3) flow file is now modified per plugin!\n```\n\n# Plugins\nPlugins use [jscodeshift](https://github.com/facebook/jscodeshift) to transform flow source code into typescript source code. Plugins are stored in the [plugins](https://github.com/albertywu/flowshift/tree/master/plugins) folder with their associated test fixtures.\n\nA plugin is simply a transform function as defined below. If the function returns a string, then the file is written with the value of the returned string. If the return value is undefined, nothing happens to the original file.\n\nPlugin functions are invoked by the cli command `jscodeshift`.\n\n```js\nfunction transform(fileInfo: FileInfo, api: Api, options: Options): string | undefined {\n  // transform code goes here\n}\n\ntype FileInfo = {\n  path: string;   // file path\n  source: string; // source code\n}\n\ntype Api = {\n  jscodeshift: JsCodeShift; // the main library for flow AST stuff\n  ... // other stuff we don't care about\n}\n\ntype Options = {\n  [key: string]: string // passed in via CLI command `jscodeshift`\n}\n```\n\n# Test\n```\nyarn test\n```\n\n# Install\n```\nyarn\n```\n\n# Contribute\n❤","funding_links":[],"categories":["Typescript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertywu%2Fflowshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertywu%2Fflowshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertywu%2Fflowshift/lists"}