Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow RelayFileWriter to specify the filesystem object #2837

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/relay-compiler/codegen/RelayFileWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
'use strict';

const ASTConvert = require('../core/ASTConvert');
const CodegenDirectory = require('../codegen/CodegenDirectory');
const CompilerContext = require('../core/GraphQLCompilerContext');
const Profiler = require('../core/GraphQLCompilerProfiler');
const RelayParser = require('../core/RelayParser');
const RelayValidator = require('../core/RelayValidator');
const SchemaUtils = require('../core/GraphQLSchemaUtils');

const CodegenDirectory = require('./CodegenDirectory');
const compileRelayArtifacts = require('./compileRelayArtifacts');
const crypto = require('crypto');
const graphql = require('graphql');
Expand All @@ -31,15 +31,16 @@ const {
} = require('../core/GraphQLDerivedFromMetadata');
const {Map: ImmutableMap} = require('immutable');

import type {DocumentNode, GraphQLSchema, ValidationContext} from 'graphql';
import type {
FormatModule,
TypeGenerator,
} from '../language/RelayLanguagePluginInterface';
import type {ScalarTypeMapping} from '../language/javascript/RelayFlowTypeTransformers';
import type {GraphQLReporter as Reporter} from '../reporters/GraphQLReporter';
import type {Filesystem} from './CodegenDirectory';
import type {SourceControl} from './SourceControl';
import type {RelayCompilerTransforms} from './compileRelayArtifacts';
import type {DocumentNode, GraphQLSchema, ValidationContext} from 'graphql';

const {isExecutableDefinitionAST} = SchemaUtils;

Expand Down Expand Up @@ -75,6 +76,7 @@ export type WriterConfig = {
LOCAL_RULES?: $ReadOnlyArray<ValidationRule>,
},
printModuleDependency?: string => string,
filesystem?: Filesystem,
repersist?: boolean,
};

Expand Down Expand Up @@ -259,6 +261,7 @@ function writeAll({
const addCodegenDir = dirPath => {
const codegenDir = new CodegenDirectory(dirPath, {
onlyValidate: onlyValidate,
filesystem: writerConfig.filesystem,
});
allOutputDirectories.set(dirPath, codegenDir);
return codegenDir;
Expand Down