facebook / facebook/relay

relay-compiler 13 custom transforms

Open
#3,899 2 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

It would be nice to be able to add custom transforms like it was possible in v12

in our project we used it to add some code in generated files
```ts
// our code is something like
import { relayCompiler } from 'relay-compiler';

const tsPluginDefault = require('relay-compiler-language-typescript').default();
const { inputExtensions, outputExtension, findGraphQLTags, typeGenerator } = tsPluginDefault;

const langPlugin = {
inputExtensions,
outputExtension,
findGraphQLTags,
// in the formatModule we transform the ouput files to add some code specific to the request
formatModule: ourSpecificFormatModule,
typeGenerator,
}

await relayCompiler({
...moreConfig,
language: langPlugin,
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.