Search code examples
relayjs

Does relay-compiler delete unused generated files?


My CI process, to ensure reliability of generated files, rm -rf all __generated__ dirs then generates again. It seems there is a problem (somewhere), as my results are occasionally different on OSX (local) vs Linux (CI). I'm wondering if it is a timing problem with file events and watchman.

Then I thought, do I need to wipe out these files or will relay-compiler delete old/unused generated files?


Solution

  • In my experience it deletes files. Here's an example from a terminal I have open:

    Parsed default in 0.32s
    
    Writing default
    Writer time: 0.46s [0.09s compiling, 0.37s generating, 0.00s extra]
    Created:
     - deleteCustomsBondMutation.graphql.js
     - putCustomsBondMutation.graphql.js
    Updated:
     - BondInformationQuery.graphql.js
    Deleted:
     - deleteCustomsBondMutation.graphql.js
     - putCustomsBondMutation.graphql.js
    Unchanged: 5 files
    Written default in 0.51s
    Watching for changes to default...
    

    Notice that it deleted two files. This was because I moved my mutations into a different directory.