Open fcisio opened 3 years ago
looks like your request got solved:
4_finally_repair.ejs.t
---
sh: jsonrepair package.json > package.json
---
@airtonix Yes! I created a feature request which was deved pretty quickly 👍
a workaround for me was to create my own node executable. Something like
#!/usr/bin/env node
const foo = require('my-favourite-lib')
// get something from `process.argv`
// do any operations you like
and then in the hygen template just
---
sh: path/to/my/executable.js
---
and if you are struggling with having the correct path to the executable, you can setup a hygen helper to always use the absolute path :crossed_fingers:
I think it is reasonable to add a postprocess
stage which takes a command, and the end of generation is passed to this custom command, for each text-manipulating operation
Scheduling for v7
Hey! I'm generating some
package.json
and the end result is pretty dirty.I'm able to run
prettier
as a command with thesh
option of the front-matter. I would also like to runjsonrepair
, which would allow not to write logic just for the commas in json.jsonrepair
doesn't have a CLI and I can't seem to find an alternative.So I'm thinking it would be nice to be able to do something like:
This would also allow to clean up pretty much anything with
prettier
.As an alternative, I tried creating an helper, but there is no way to preserve
ejs
syntax, passing it in a function.Possibly related to #296