castle
castle copied to clipboard
avro-ts-cli: Wildcard search for files doesn't work
When running the CLI using wildcard for finding avro files, it fails.
$ avro-ts avro-files/*.avsc
Converting Avro to TypeScript
internal/fs/utils.js:230
throw err;
^
Error: ENOENT: no such file or directory, open 'avro-files/*.avsc'
at Object.openSync (fs.js:457:3)
at Object.readFileSync (fs.js:359:35)
at %AppData%\Roaming\npm\node_modules\@ovotech\avro-ts-cli\dist\convert.js:72:55
at Array.map (<anonymous>)
If I take one file at a time it works fine.
I'm running on Windows.
Oh dear yeah that might be an issue for Windows. in Linux/Mac if you do avro-ts avro-files/*.avsc
what the command underneath actually receives is avro-ts avro-files/file1.avsc avro-files/file2.avsc avro-files/file3.avsc
kind of thing.
As a work around you might do that for the time being, until I can come up with a way to do it on windows.
Another option is WSL, which should have all those bash goodies baked in.
For now, I have wrapped it in a shell script that gets all files and then runs them one by one.
But you could look at something like glob
to get the files.
Hey :wave: . Not directly related to the original issue, but supporting a double-star **
could be a nice addition also, when there are multiple directories containing avro files.
avro-ts avro-files/**/*.avsc
I'm kind of reluctant to add support for that inside of node itself, mainly because the libraries usually bring an ungodly number of dependencies themselves. Though I might just add the one that's most popular as you would be having it anyway, and it would only be for the CLI package.
avro-ts avro-files/**/*.avsc
Already works in most shells anyway.