This is a really nice project.
I wonder if it's possible to have some small webpack plugin, which watches avsc files and generates typescript files on the fly.
EDIT: I've written some minimal plugin example code, which reads a single avsc file and writes a ts file (never written a webpack plugin before)
var avroTypescript = require("avro-typescript");
var fs = require('fs');
var path = require('path');
function AvroTypescriptPlugin(options) {
}
AvroTypescriptPlugin.prototype.apply = function(compiler) {
compiler.plugin('done', function() {
var file = fs.readFileSync(path.join(__dirname, './schema.avsc'), 'utf8');
var json = JSON.parse(file);
var ts = avroTypescript.avroToTypeScript(json);
fs.writeFileSync(path.join(__dirname, './schema.ts'), ts);
});
};
module.exports = AvroTypescriptPlugin;
This is a really nice project.
I wonder if it's possible to have some small webpack plugin, which watches avsc files and generates typescript files on the fly.
EDIT: I've written some minimal plugin example code, which reads a single avsc file and writes a ts file (never written a webpack plugin before)