gulp-help-doc
Advanced tools
Comparing version 1.0.6 to 1.0.7
36
index.js
@@ -39,3 +39,5 @@ /** | ||
* }, | ||
* isTypescript: boolean | ||
* isTypescript: boolean, | ||
* displayDependencies: boolean, | ||
* emptyLineBetweenTasks: boolean | ||
* }} ConfigOptions | ||
@@ -54,3 +56,5 @@ */ | ||
logger: console, | ||
isTypescript: fs.existsSync('gulpfile.ts') | ||
isTypescript: fs.existsSync('gulpfile.ts'), | ||
displayDependencies: true, | ||
emptyLineBetweenTasks: true | ||
}; | ||
@@ -120,2 +124,3 @@ | ||
var rxArgs = '@arg\\s+\\{(.*?)\\}(.*?)\\r?\\n'; | ||
var rxOrder = '@order\\s+\\{(\\d+)\\}(.*?)\\r?\\n'; | ||
var globalRxDoc = new RegExp(rxDoc, 'g'); | ||
@@ -125,2 +130,4 @@ var localRxDoc = new RegExp(rxDoc); | ||
var localRxArgs = new RegExp(rxArgs); | ||
var globalRxOrder = new RegExp(rxOrder, 'g'); | ||
var localRxOrder = new RegExp(rxOrder); | ||
var jsDoc = source.match(globalRxDoc); | ||
@@ -162,2 +169,10 @@ var tasks = gulpTasks(gulp); | ||
}); | ||
reflection[name].order = (function () { | ||
var orderParts = block.match(globalRxOrder); | ||
if (orderParts) { | ||
return +orderParts[0].match(localRxOrder)[1]; | ||
} else { | ||
return Number.MAX_SAFE_INTEGER; | ||
} | ||
})(); | ||
}); | ||
@@ -207,2 +222,3 @@ } | ||
.sort() | ||
.sort(function(a, b) { return reflection[a].order - reflection[b].order; }) | ||
.forEach(function (name) { | ||
@@ -257,9 +273,13 @@ var task = reflection[name]; | ||
(deps.length) && (OPTIONS.logger.log( | ||
' '.repeat(OPTIONS.keysColumnWidth) + | ||
chalk.bold.gray('Depends: ') + | ||
chalk.grey(JSON.stringify(deps)) | ||
)); | ||
if (OPTIONS.displayDependencies && deps.length) { | ||
OPTIONS.logger.log( | ||
' '.repeat(OPTIONS.keysColumnWidth) + | ||
chalk.bold.gray('Depends: ') + | ||
chalk.grey(JSON.stringify(deps)) | ||
); | ||
} | ||
OPTIONS.logger.log(''); | ||
if (OPTIONS.emptyLineBetweenTasks) { | ||
OPTIONS.logger.log(''); | ||
} | ||
}); | ||
@@ -266,0 +286,0 @@ } |
{ | ||
"name": "gulp-help-doc", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Gulp available tasks usage information based on jsdoc-like notations", | ||
@@ -21,2 +21,8 @@ "main": "index.js", | ||
"author": "Mykhailo Stadnyk <mikhus@gmail.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Wojciech Frącz", | ||
"url": "https://github.com/fracz" | ||
} | ||
], | ||
"license": "MIT", | ||
@@ -23,0 +29,0 @@ "bugs": { |
@@ -51,2 +51,3 @@ # gulp-help-doc | ||
* @task {demo} | ||
* @order {1} | ||
*/ | ||
@@ -124,2 +125,7 @@ gulp.task('demo', function() {}); | ||
Optionally, you can use the `@order` tag to sort the tasks descriptions | ||
in the output. A task with `@order {1}` will appear before a task | ||
with `@order {2}`. All tasks without this tag will appear at the end | ||
of the list, sorted alphabetically. | ||
## Restrictions | ||
@@ -148,2 +154,6 @@ | ||
to gulp-util or some other printing device if required. | ||
* **displayDependencies** - if set to `true` (default), prints the task | ||
dependencies below its help description | ||
* **emptyLineBetweenTasks** - if set to `true` (default), prints an empty | ||
line between tasks help descriptions | ||
@@ -167,2 +177,2 @@ Example of custom configuration: | ||
[MIT](https://raw.githubusercontent.com/Mikhus/gulp-help-doc/master/LICENSE) | ||
[MIT](https://raw.githubusercontent.com/Mikhus/gulp-help-doc/master/LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17929
349
175