Open loreanvictor opened 1 year ago
It generally is a nice idea to support more config formats. That said, JavaScript itself is used commonly as a config format and will be enforced on large projects such as eslint. Perhaps tools like recast can be used to handle JS code in a similar manner to JSON or YAML, however JS config files do not have a specific format, and this might result in flaky recipes that only work in particular scenarios. Can this be helped with additional helpers? If so, to which extent? Something to think about.
a note on the flaky recipes of js configs: this will only result in flaky reusable recipes. templates can control the config format, so they wouldn't have issues with such shenanigans.
This would be very handy for updating a package.json
file with variations on a name string entered by the user. Right now, I think I'll need to maintain a template package.json
and keep it in sync with the real one.
write
andfrom file
commands can benefit from being able to specific fields in JSON / YAML files, specifically for recipes that want to alter an existing projects. For example, the following could read the name of the package:Or the following could add dependencies:
Write can support
at
,before
andafter
properties to allow inserting to arrays as well. The field addressing syntax is JSON Pointer. It is important to not screw up files that are written to, maintaining their styling, for which packages such as json-source-map and mapped-yaml can be used (perhaps a separate package should be written for this specific purpose). Additionally, the filesystem object might want to do some caching of files that are read / written to, to save on processing costs (though this might be a later-on feature).