Name: relay-codemod
Owner: relayjs
Description: A set of utility scripts, written using jscodeshift, that can be used by community members and Facebook alike to upgrade Relay APIs in an automated fashion.
Created: 2016-01-05 20:48:24.0
Updated: 2017-11-14 05:50:23.0
Pushed: 2017-06-20 16:42:35.0
Homepage: null
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This repository contains a collection of codemod scripts based for use with JSCodeshift that help update Relay APIs.
npm install -g jscodeshift
git clone https://github.com/relayjs/relay-codemod.git
or download a zip
file from https://github.com/relayjs/relay-codemod/archive/master.zip
jscodeshift -t <codemod-script> <file>
-d
option for a dry-run and use -p
to print the output for
comparisondeshift -t relay-codemod/transforms/upgrade-store-api-0.8.js <file>
Updates method calls on Relay.Store
that were removed in Relay 0.8.0:
Relay.Store.update
=> Relay.Store.commitUpdate
deshift -t relay-codemod/transforms/upgrade-requires-1.0.js <file>
Replaces requires to /classic for upgrading to 1.0.0:
require('react-relay')
=> require('react-relay/classic')
from 'react-relay'
=> from 'react-relay/classic'
deshift -t relay-codemod/transforms/migrate-to-modern-1.0.js <file>
Attempts (in a crude way) to migrate classic APIs to modern ones.
Caveats for initial version:
Options to recast's printer can be provided
through the printOptions
command line argument
jscodeshift -t transform.js <file> --printOptions='{"quote":"double"}'