cordova-common icon indicating copy to clipboard operation
cordova-common copied to clipboard

Fluent interface for ConfigParser

Open raphinesse opened this issue 7 years ago • 2 comments

Implement a Fluent interface for ConfigParser.

As a developer, I want to do

new ConfigParser('...')
    .addEngine(...)
    .addPlugin(...)
    .write();

Should be possible as a non-breaking change. If in doubt, we could export something like the following as a first step:

class FluentConfigParser extends ConfigParser {
    addPlugin (...args) {
        return (super.addPlugin(...args), this);
    }
    addEngine (...args) {
        return (super.addEngine(...args), this);
    }
}

raphinesse avatar Aug 15 '18 11:08 raphinesse

This would be good, however I think we're wanting to move plugins/platforms out of ConfigParser (and hence config.xml). I'll make sure my suggestion for PackageHelper supports this though.

dpogue avatar Aug 15 '18 20:08 dpogue

A Fluent Interface for all remaining non-getters is still desirable, IMHO.

raphinesse avatar Aug 15 '18 20:08 raphinesse