@@ -170,7 +170,7 @@ class Compiler {
170
170
_copySubgraphFile ( maybeRelativeFile , sourceDir , targetDir , spinner ) {
171
171
let absoluteSourceFile = path . resolve ( sourceDir , maybeRelativeFile )
172
172
let relativeSourceFile = path . relative ( sourceDir , absoluteSourceFile )
173
- let targetFile = path . join ( targetDir , relativeSourceFile )
173
+ let targetFile = path . resolve ( targetDir , relativeSourceFile )
174
174
step ( spinner , 'Copy subgraph file' , this . displayPath ( targetFile ) )
175
175
fs . mkdirsSync ( path . dirname ( targetFile ) )
176
176
fs . copyFileSync ( absoluteSourceFile , targetFile )
@@ -402,17 +402,14 @@ class Compiler {
402
402
`Warnings while writing compiled subgraph to ${ displayDir } ` ,
403
403
async spinner => {
404
404
// Copy schema and update its path
405
- subgraph = subgraph . updateIn ( [ 'schema' , 'file' ] , schemaFile =>
406
- path . relative (
407
- this . options . outputDir ,
408
- this . _copySubgraphFile (
409
- schemaFile ,
410
- this . sourceDir ,
411
- this . options . outputDir ,
412
- spinner ,
413
- ) ,
414
- ) ,
415
- )
405
+ subgraph = subgraph . updateIn ( [ 'schema' , 'file' ] , schemaFile => {
406
+ const schemaFilePath = path . resolve ( this . sourceDir , schemaFile )
407
+ const schemaFileName = path . basename ( schemaFile )
408
+ const targetFile = path . resolve ( this . options . outputDir , schemaFileName )
409
+ step ( spinner , 'Copy schema file' , this . displayPath ( targetFile ) )
410
+ fs . copyFileSync ( schemaFilePath , targetFile )
411
+ return path . relative ( this . options . outputDir , targetFile )
412
+ } )
416
413
417
414
// Copy data source files and update their paths
418
415
subgraph = subgraph . update ( 'dataSources' , dataSources => {
0 commit comments