grunt-freeport
v0.1.1
Published
Grunt task to get a free port number on localhost from specified range
Downloads
176
Maintainers
Readme
grunt-freeport
Grunt task to get a free port number on localhost from specified range. Uses node-portscanner.
Install
$ npm i -S grunt-freeport
Usage
grunt.initConfig({
freeport: {
sometask: {
options: {
start: 8080,
end: 8089
}
}
},
sometask: {
options: {
port: '<%= freeport.sometask %>'
}
}
});
// common, start using `load-grunt-tasks`
grunt.loadNpmTasks('grunt-freeport');
grunt.registerTask('default', [ 'freeport:sometask', 'sometask' ]);
Options
start
– start point to find a free port, must be>= 1
,1
by defaultend
– end point to find a free port, must be<= 65535
,65535
by default
If task target is omitted then it will use default variable name freeport
, i.e. you should use '<%= freeport %>'
.