Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate gruntfile API #744

Closed
sindresorhus opened this issue Jan 20, 2015 · 3 comments
Closed

Deprecate gruntfile API #744

sindresorhus opened this issue Jan 20, 2015 · 3 comments

Comments

@sindresorhus
Copy link
Member

While the generator system is supposed to be generic this API is highly specific to a use-case.

Would be better for users needing it to just require() it themselves.

generator/lib/base.js

Lines 157 to 179 in b611741

// Only instantiate the Gruntfile API when requested
Object.defineProperty(this, 'gruntfile', {
get: function () {
if (!this.env.gruntfile) {
var gruntfile = this.fs.read(this.destinationPath('Gruntfile.js'), {
defaults: ''
});
this.env.gruntfile = new GruntfileEditor(gruntfile);
}
// Schedule the creation/update of the Gruntfile
this.env.runLoop.add('writing', function (done) {
this.fs.write(
this.destinationPath('Gruntfile.js'),
this.env.gruntfile.toString()
);
done();
}.bind(this), { once: 'gruntfile:write' });
return this.env.gruntfile;
}
});
};

@SBoudrias Thoughts?

@eddiemonge
Copy link
Member

I agree if that functionality was pulled into a separate module to keep it easy for end users to still use/require it.

@SBoudrias
Copy link
Member

By nature, this module cannot be used per case because the point is:

  1. Sharing the Gruntfile edition in order to allow composability of multiple configs
  2. Being binded to the yeoman in memory file-system

As so, I feel if we expect people to use it, then we must provide the interface inside the generators. Composability is still new and haven't been used a whole lot in our official generators. I believe it is still too early to make a judgement calls on the removal of composability features.

@SBoudrias
Copy link
Member

A thing we could do though is extract the logic of sharing the Gruntfile to a generator subclass or in a mixin. So people who don't need it won't have it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants