是否有任何包可以让您记录您的 gruntfile,类似于 Node 的 apiDocs?

Is there any package that lets you document your gruntfile, similar to apiDocs for Node?

我建立了一个很棒的项目,里面有很多繁重的任务。问题是,它肿了。仅 gruntfile.js 就有 1200 多行。我希望能够通过像 apiDocs 这样的代码中的注释来记录我安装的所有这些 grunt 插件。是否有任何软件包可以做到这一点?或者,是否有不同的方式来记录您的 grunt 文件?

如果你的 Gruntfile 有 1200 行长,我强烈建议你split it into multiple files

你的 gruntfile 只是一个 NodeJs 应用程序,这意味着它是用 JS 编写的,最受欢迎的 JS 文档器是 JSDoc

因此任务可能如下所示:

grunt/uglify.js

/**
 * Minify javascript files
 *
 * @description
 * Here is a detailed explanation of what this uglify task can do
 * 
 * @type {Object}
 */
module.exports = {
  dist: {
    files: {
      'dist/build.min.js': ['dist/build.js']
    }
  }
};