cli
cli copied to clipboard
Convert configs from .json to .js or .ts
I'm submitting a discussion request
-
Language: all
-
Loader/bundler: all
Current behavior:
Config files are now mostly in .json format which does not allow comments. https://stackoverflow.com/questions/244777/can-comments-be-used-in-json
- What is the desired behavior? Have most config files in .js format Like webpack.config.js
module.exports = {
// same json, but now it can have comments along
}
- What is the motivation / use case for changing the behavior?
I think it would be useful to have commented config files. It improves usage by new developers. And is generally a good practice. Like in website usage - every additional step increases drop rate. Figuring out what that line means and how to use it now requires.. If it's not mentioned in the docs -> hours of googling and parsing the issues That is for the patient ones
Some drawbacks: I guess that now configs are read and modified as objects and are written the same way by the CLI. Maintaining that ease of modifying config with CLI would be a challenge.
there is a jsonc parser by MS https://github.com/Microsoft/node-jsonc-parser
but no writer of course..
Well It is a dream of improving something for newcomers Not actionable
Similar to #781 (Yaml config)... Commented configs is a must.
The huge gap between the cli help and actually having to edit the config file without any help is a big usability gap.
I also want my aurelia.json
to be upgraded to aureliarc.js
, not only for comments (which I want too), but also for simplifying cli implementation. We can conditionally build the config, so we can cut off some code from cli that supports condition in aurelia.json
, like:
{
"name": "aurelia-testing",
"env": "dev"
}
I would like to add a different motivation to prefer js over json config files. In my Aurelia setup I moved all my config files in an npm package (coding standards). JS files can easily extend another js/json config and be merged using a spread operator.
(Not a fan of adding comments btw, if you need to comment code it generally means something needs to be improved)
if you need to comment code it generally means something needs to be improved.
I think most coders will disagree 😃
Remeber that we are discussing add comments to configurations. I would say it is really valuable to have comments in configuration.
I would love to se .ts instead of .json
bump