New Feature: JS formatter and prettifier#917
Conversation
|
Done a little test From: var DSP_POWERDNS = NewDnsProvider("powerdns", "POWERDNS", {
'default_ns' : [
'a.anydns.io.',
'b.anydns.io.'
],
'zonetype': 'native',
});
var REG_CHANGEME = NewRegistrar("ThirdParty", "NONE");
var REG_GANDI = NewRegistrar("gandi", "GANDI_V5");
var ips = require('ips.json');
if(true)
{
console.log("jj")
}
// load base file
// contains records which are shared across zones
require('nameserver.js');
require('base.js');
// load zones
require_glob("zones/", false);
require_glob("reverse/", false);To: var DSP_POWERDNS = NewDnsProvider("powerdns", "POWERDNS", {
'default_ns': [
'a.anydns.io.',
'b.anydns.io.'
],
'zonetype': 'native',
});
var REG_CHANGEME = NewRegistrar("ThirdParty", "NONE");
var REG_GANDI = NewRegistrar("gandi", "GANDI_V5");
var ips = require('ips.json');
if (true) {
console.log("jj")
}
// load base file
// contains records which are shared across zones
require('nameserver.js');
require('base.js');
// load zones
require_glob("zones/", false);
require_glob("reverse/", false); |
|
Wow! I kind of filed that feature request as a joke because I didn't think anyone would implement it. I had no idea that someone had made a js beatifier that could be used as a library! This is super cool! Really made my day! I ran the POC on Stack Overflow's dnsconfig.js and it worked really well. Only whitespace changes and nothing too radical. Of course, I had to file a feature request for my favorite rewrite rule (see ditashi/jsbeautifier-go#7). This would be a great addition to the project! |
|
Ok cool, then i invest some more time into it and make it merge ready :) The library seems to be unmaintained, unfortunately. |
|
Yeah, the fact that it is unmaintained is very concerning to me. I'm actually worried about otto's lack of updates for the same reason. Maybe it would be better to provide a shell script wrapper that calls an external beautifier with a fixed set of options? |
|
Hmm yea would be simpler .. But i liked the idea to have it in dnscontrol without dealing with npm or something else. |
|
I'd like to develop a way to accept experimental features like this. |
|
I've now marked this to be merged. I've also added a |
|
Thanks for the review. I've implemented your feedback |
|
I just reformatted stackoverflow's internal dnsconfig.js and it sure does look better! Thanks! |
I liked the idea to have a JS prettifier for dnsconfig.js but i would like to have it integrated into dnscontrol, so you don't need to install an other tool.
This is currently a PoC but i wanted to create a PR for it, so you can have a look at it :)
Fixes #874