facebook/relay

Custom `artifactDirectory` has to exist and is not automatically created (like `__generate__`)

Open

#3782 aperta il 31 gen 2022

Vedi su GitHub
 (10 commenti) (6 reazioni) (0 assegnatari)Rust (1874 fork)batch import
help wantedrust

Metriche repository

Star
 (18.930 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

When specifying a custom artifactDirectory in the relay compiler config, ​the compiler requires this directory to exist. Otherwise you get:

[ERROR] Config `/home/.../frontend/relay.config.js` is invalid:
​- The `artifactDirectory` does not exist at `/home/.../frontend/src/query-types`.

This is particularly annoying when using git, as you cannot check empty folders into git. The typical ".gitkeep file in folder" trick does not work well, because the relay-compiler deletes all files from the artifact directory on each compile, always leading to a dirty working directory.

I think the best is to use the same behavior as for the default __generated__ folder: create it, if it doesn't exist.


This problem only occurred after upgrading to v13 (i.e. the compiler written in Rust).

Guida contributor