nexus icon indicating copy to clipboard operation
nexus copied to clipboard

Feature: Callback after GenerateArtifacts

Open meabed opened this issue 2 years ago • 0 comments

Thank you so much for great effort in building this.

In generating artefacts

    outputs: {
      schema
      typegen
    }

it would be great to have a callback after writing the file, for example I want to modify the file or calculate checksum of the schema. currently I am implementing this with overriding the prototype

const oldWriteFile = TypegenMetadata.prototype['writeFile'];
TypegenMetadata.prototype['writeFile'] = function (...args) {
  if (args[2].includes('schema.graphql')) {
    // add something in the file and output checksum
  }
  return oldWriteFile.apply(this, args);
};

If you think this feature would be good in the lib - I could also open a PR with the changes.

Thank you

meabed avatar Jun 16 '22 17:06 meabed