alexgs / grunt-available-tasks Goto Github PK
View Code? Open in Web Editor NEWList available Grunt tasks & targets.
License: MIT License
List available Grunt tasks & targets.
License: MIT License
Is there any possible way to install this plugin globally, so I could use it in any project, without editing Gruntfile.js ?
See issue
Alphabetically ordering the tasks is nice, but in my project I'd rather reorder it so more important tasks come first. It would be good if there was an option to specify my own ordering. Would you be amenable to a PR for this?
Either this should be done in shouldLogTask() itself, or before tasks are logged to the console, but tasks should be removed from the task list if they were included or excluded by a filter, not simply skipped over. This way, we can accurately get the name of the longest task in the list, rather than showing up a load of unnecessary whitespace.
Deleting any tasks that don't pass a filter is also a much simpler solution than what we have at the moment. I'd imagine it would work using _.reject
(for exclude) and _.filter
(for include).
I installed the module and customized my Gruntfile as per instructions.
$ grunt --help
Grunt: The JavaScript Task Runner (v0.4.5)
...
Available tasks
availabletasks List available Grunt tasks & targets. *
connect Start a connect web server. *
uglify Minify files with UglifyJS. *
watch Run predefined tasks whenever watched files change.
livereload Start/Reload a LiveReload server
createServer Alias for "connect:server" task.
build Alias for "uglify:dist" task.
run Alias for "createServer", "watch" tasks.
But if I try to use it, I get the above message. Did I miss something?
Looking at the way reporters are set up, they are a little limited; the module itself handles all of the iteration through each group, which can be slightly confusing when you try to output something more than just a header before each group. The markdown reporter is slightly flawed in this regard when it comes to nesting the headers properly.
If each reporter were to be passed the tasks
variable itself, which has all of the tasks grouped, filtered etc, then it can choose whether it wants to run some code before/after the whole series of tasks, or each task individually. It allows for more flexibility, with the drawback of having to write more code for if/when you want a custom reporter.
Slightly related; the default reporter may be kept around, but a nicer reporter should probably be made that is more informative. It shouldn't have to be necessary for someone to read this project's README in order to understand what >
, ->
and =>
mean.
I don't use Grunt anymore so I'm not going to be maintaining this module going forward. I'm going to leave this open until the end of January and deprecate this module if I don't find a new maintainer.
Happy to transfer the repository to a new home if anyone is willing!
Hi,
I recently updated to version 0.6.0 and am now getting the following error :
´´´
D:\something>grunt --stack
Running "availabletasks:tasks" (availabletasks) task
Warning: Cannot set property 'info' of undefined Use --force to continue.
TypeError: Cannot set property 'info' of undefined
at D:\something\node_modules\grunt-available-tasks\tasks\available_tasks.js:37:23
at Array.forEach (native)
at Object. (D:\something\node_modules\grunt-available-tasks\tasks\available_tasks.js:35:43)
at Object. (D:\something\node_modules\grunt\lib\grunt\task.js:264:15)
at Object.thisTask.fn (D:\something\node_modules\grunt\lib\grunt\task.js:82:16)
at Object. (D:\something\node_modules\grunt\lib\util\task.js:301:30)
at Task.runTaskFn (D:\something\node_modules\grunt\lib\util\task.js:251:24)
at Task. (D:\something\node_modules\grunt\lib\util\task.js:300:12)
at D:\something\node_modules\grunt\lib\util\task.js:227:11
at process._tickCallback (node.js:355:11)
´´´
I am using the 'descriptions' option to override the default messages! From looking at the source it seems like (one of) my tasks cannot be found anymore?
The latest task I added is a custom task.
I am getting an error when running availabletasks
.
Running "availabletasks" task
Warning: An error occurred while processing a template (title is not defined). Use --force to continue.
Aborted due to warnings.
This is baffling because I don't know which task may be causing the issue. If I run with --force
I do get a task listing of everything so I am unsure where the problem lies. Running with --debug
yields no valuable information either. I am trying to NOT test each task as I have over 50 tasks/aliases but if I must then I will. Any help pointing me to the right direction would be helpful.
Note: I do have linked npm tasks in my project but they are not the gurnt-tasks type. they are things such as lodash, coffee, glob, etc. I have tried running availabletasks
in other projects and it is working fine. Just lost with this error message.
Does the plugin support this?
The screenshot in your documentation shows:
clean -> Clean files and folders. (dist | tmp | templates)
Is the text in brackets documentation of the available sub tasks ? ie clean:dist
, clean:tmp
and clean:templates
If so, how do I configure the plugin to include information about these sub tasks?
Thanks.
Hello
Groups should be ordered in the same order as it is defined in the task :
As an example :
availabletasks: {
tasks: {
options: {
filter: 'include',
groups: {
'Development': ['dev', 'test:unit', 'test:e2e', 'report'],
'Production': ['package'],
'Continuous Integration': ['ci']
},
}
}
}
should display
Development
dev => ...
test:unit => ...
test:e2e => ...
report => ...
Production
package => ...
Continuous Integration
ci => ...
instead of
Continuous Integration
ci => ...
Development
dev => ...
test:unit => ...
test:e2e => ...
report => ...
Production
package => ...
I suppose now it is ordered alphabetically
Best Regards !
Grunt fails with this error:
> grunt ts --verbose
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'grunt-available-tasks/node_modules/underscore.string'
>> at Function.Module._resolveFilename (module.js:339:15)
>> at Function.Module._load (module.js:290:25)
>> at Module.require (module.js:367:17)
>> at require (internal/module.js:16:19)
>> at Object.<anonymous> (D:\xampp\htdocs\sirin-solarin.teaser\tools\build\grunt\availabletasks.js:1:72)
>> at Module._compile (module.js:413:34)
>> at Object.Module._extensions..js (module.js:422:10)
>> at Module.load (module.js:357:32)
>> at Function.Module._load (module.js:314:12)
>> at Module.require (module.js:367:17)
Running tasks: ts
Warning: Task "ts" not found. Use --force to continue.
Aborted due to warnings.
Using:
v5.10.0
3.8.3
0.4.5
0.6.0
My gruntfile:
module.exports = function (grunt)
{
setupGruntTime(grunt);
var pkg = grunt.file.readJSON('package.json');
var path = require('path');
var sourceDir = 'deploy/htdocs/version/src/';
var buildDir = 'build/';
var buildVersionDir = 'build/version/';
var gruntDir = path.normalize(process.cwd() + '/');
var version = pkg.appversion;
var appName = pkg.appname;
var exportSourceMaps = true;
var base = '../../';
grunt.config('version', version);
grunt.config('sourceDir', sourceDir);
grunt.config('base', base);
require('load-grunt-config')(grunt, {
//auto grunt.initConfig
init: true,
//data passed into config. Can use with <%= test %>
data: {
sourceDir: sourceDir,
buildDir: buildDir,
buildVersionDir: buildVersionDir,
gruntDir: gruntDir,
version: version,
appName: appName,
exportSourceMaps: exportSourceMaps
},
// auto-loads tasks when needed, instead of by default
jitGrunt: {
// here you can pass options to jit-grunt (or just jitGrunt: true)
customTasksDir: 'tasks',
pluginsRoot: 'tools/build/node_modules',
staticMappings: {
availabletasks: 'grunt-available-tasks',
scsslint: 'grunt-scss-lint'
}
}
});
// change base so tasks don't have to '../'
grunt.file.setBase(base);
};
Edit: formatting
When run the availabletasks task in my gruntfile, I get:
Warning: An error occurred while processing a template (Cannot read property 'dir' of undefined). Use --force to continue.
One of my tasks has a command with a string template of the form var.dir
. If I comment it out, I don't get this error anymore.
grunt-cli v0.1.13
grunt v0.4.4
availabletasks v0.5.0
availabletasks: {
options: {
}
},
grunt.registerTask('default', ['availabletasks']);
Nothing it outputted. Any ideas?
Grunt provides a way to alias tasks with another name; for example you could alias availabletasks
to just tasks
to save yourself some typing by doing the following:
grunt.registerTask('tasks', 'Alias for availabletasks.', ['availabletasks']);
However, what if a plugin author hasn't made it clear what the plugin does, or worse, left the description as 'Your description goes here'? Perhaps you'd like to override this description with one of your own. This could look something like the following:
availabletasks: {
options: {
descriptions: {
'jshint' : 'Check JavaScript files for sloppy code.'
}
}
}
I liked the way you output grunt tasks, but it isn't nice to install it as a dependency on every project I have. I don't like the idea to plug this in my Gruntfile.
It would be great you if you make it work as a cli command or a grunt-cli extension.
I guess the upgrade to Lodash and underscore.string newest versions has something to do with this: starting from 0.5.5 I don't get any output (but no errors, either).
0.5.4 still works. I'm on on node 0.10.35.
Let me know if you need more info to reproduce..
Some users might be confused by how this tool is set up and used (that part where you have to set up the Gruntfile config but then use it via CLI), so it might be worth clarifying this via step-by-step instructions. E.g.
npm
…initConfig
object…grunt availabletasks
in CLIOne thing I'd really like to do is give the user some more flexibility when it comes to reporting their task list. The standard reporter is pretty nice, but I think we can do better; we should give the user the ability to customise the whole look of it by specifying a function that gets passed the parameters for each task. This is also why I've deprecated options.dimmed
, because the extra distinction for availabletasks is redundant when you have a custom reporter.
For example I'd really like to be able to report in Markdown so I can add availabletasks to my README in a nice way.
Thinking this will be 0.4.0 stuff. We've still got a little refactoring to do before this. :-)
Hi,
For some reason when the task tries to access the reportoptions.meta.longest.name.length
propery on line 97 of available_tasks.js, a warning is thrown that kills the task.
I was able to fix this by removing the call to the .name.length
property from line 97.
Just incase you need this, below is my availabletasks.js file:
var grunt = require('grunt');
module.exports = {
options: {
sort: false,
hideUngrouped: true,
descriptions: {
'dev': 'Build project for development with browsersync',
'devadmin': 'Build admin for development with browsersync',
'devsite': 'Build site for development with browsersync',
'build': 'Build project for production',
'buildadmin': 'Build admin for production',
'buildsite': 'Build site for production',
'tasks': 'Show all available tasks',
'purge': 'Clean build folder'
}
},
all: {
options: {
groups: {
'Tasks listings': ['tasks'],
'Tasks for development processes': ['dev', 'devadmin', 'devsite'],
'Tasks for production processes': ['build', 'buildadmin', 'buildsite'],
'Tasks for project maintenance': ['purge']
}
}
}
};
I'm getting below error while running grunt commands. please help on this.
Running "string-replace:dist" (string-replace) task
[D] Task source: C:\Program Files\nodejs\apigee-deploy-grunt-plugin\node_modules\grunt-string-replace\tasks\string-replace.js
Warning: An error occurred while processing a template (Unable to read "common/apiproxy/proxies/xmltojson-js-steps-common-frag.xml" file (Error code: ENOENT).). Use -
-force to continue.
Aborted due to warnings.
Execution Time (2018-05-17 14:20:09 UTC+5:30)
loading tasks 2.1s ███████████████████████████████████████████████████████████████████████████████ 64%
apigeeGruntPluginBanner 172ms ███████ 5%
prompt:target 343ms █████████████ 10%
clean:0 94ms ████ 3%
saveGitRevision 203ms ████████ 6%
copy:apiproxy 62ms ███ 2%
copy:node-target 63ms ███ 2%
copy:node-js-root 47ms ██ 1%
string-replace:dist 157ms ██████ 5%
Total 3.3s
C:\Program Files\nodejs\apigee-deploy-grunt-plugin>
Right now grunt-available-tasks
looks through all tasks and outputs a list of them; you can specify which ones to remove from the list but it doesn't have any grouping. What would be nice is to be able to categorize tasks into groups; so you can define a bunch of tasks under image manipulation, code linting and so on. I'd imagine the output looking something like this:
Code Quality
------------
jscs => Description
jshint => Description
lintspaces => Description
Production
----------
uglify => Description
Where the headers could be done using grunt.log.subhead
or similar. Personally I think this could be really good for people who want to group their tasks, but at the same time show all tasks in the same output. A sample configuration could look like this:
availabletasks : {
groups: {
"Code Quality" : ['jscs', 'jshint', 'lintspaces'],
"Production" : ['uglify']
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.