Implement deprecate API and deprecate APIs
Ref: https://github.com/gruntjs/rfcs/pull/1
This implements an internal deprecations API that displays a warning in the console if one of the deprecated APIs are used.
To hide deprecation warnings, use --hide-deprecations on the CLI or grunt.option('hide-deprecations', true) in your Gruntfile.
When --stack or grunt.option('stack', true) is enabled, the deprecation warnings will print stack traces out to locate the deprecated APIs.
The following APIs will be publicly deprecated:
- All functions on
grunt.util._ - All functions on
grunt.util.async - All functions on
grunt.util.namespace - All functions on
grunt.util.hooker grunt.util.exitgrunt.util.toArraygrunt.util.repeat- All functions on
grunt.file.glob - All functions on
grunt.file.minimatch - All functions on
grunt.file.findup grunt.file.readYAMLgrunt.file.readJSON- All functions on
grunt.event
The following APIs should be considered for deprecation although there isn't simple alternatives to point people to at this time (help?):
grunt.util.spawngrunt.util.callbackifygrunt.util.kindOfgrunt.util.pluralizegrunt.util.recurse
~~Internally Grunt still uses these deprecated APIs. We should address those deprecation warning internally first too.~~
All deprecations have now been fixed in this PR.
This can be released on next minor release as it is backwards compatible but only adds a new behavior. Removing the deprecated APIs will happen on the next major release.
Overall, makes sense to me, Thanks, @shama for doing this. I do like the idea, though, of first implementing the warnings in verbose mode only, then in a subsequent minor release, in non-verbose mode, and then finally removing the exposed methods in a future major release. However, I'm not sure how much I care :)
Code looks good, but I will need to run this locally to make sure it deprecates. I Will try to get to that soon