Update CHANGELOG, README. Bump v0.3.0

pull/63/merge v0.3.0
Kyle Robinson Young 12 years ago
parent 4f9d0be130
commit e86fd7df90

@ -1,3 +1,13 @@
v0.3.0:
date: 2013-02-27
changes:
- nospawn option added to run tasks without spawning as child processes.
- Watch emits 'watch' events upon files being triggered with grunt.event.
- Completion time in seconds and date/time shown after tasks ran.
- Negate file patterns fixed.
- Tasks debounced individually to handle simultaneous triggering for multiple targets.
- Errors handled better and viewable with --stack cli option.
- Code complexity reduced making the watch task code easier to read.
v0.2.0: v0.2.0:
date: 2013-02-15 date: 2013-02-15
changes: changes:

@ -40,8 +40,27 @@ Type: `String|Array`
This defines which tasks to run when a watched file event occurs. This defines which tasks to run when a watched file event occurs.
#### options.nospawn
Type: `Boolean`
Default: false
This instructs the watch task to not spawn task runs in a child process. Setting this option also speeds up the reaction time of the watch (usually 500ms faster for most) and allows subsequent task runs to share the same context (i.e., using a reload task). Not spawning task runs can make the watch more prone to failing so please use as needed.
Example:
```js
watch: {
scripts: {
files: ['**/*.js'],
tasks: ['livereload'],
options: {
nospawn: true
}
}
}
```
#### options.interrupt #### options.interrupt
Type: `boolean` Type: `Boolean`
Default: false Default: false
As files are modified this watch task will spawn tasks in child processes. The default behavior will only spawn a new child process per target when the previous process has finished. Set the `interrupt` option to true to terminate the previous process and spawn a new one upon later changes. As files are modified this watch task will spawn tasks in child processes. The default behavior will only spawn a new child process per target when the previous process has finished. Set the `interrupt` option to true to terminate the previous process and spawn a new one upon later changes.
@ -119,6 +138,22 @@ grunt.initConfig({
}); });
``` ```
```js
// Example using watch events
grunt.initConfig({
watch: {
scripts: {
files: ['lib/*.js']
}
}
});
// Listen for events when files are modified
grunt.event.on('watch', function(action, filepath) {
grunt.log.writeln(filepath + ' has ' + action);
});
```
### FAQs ### FAQs
#### How do I fix the error `EMFILE: Too many opened files.`? #### How do I fix the error `EMFILE: Too many opened files.`?
@ -130,9 +165,17 @@ Yes. Although `grunt-contrib-watch` is a replacement watch task for Grunt v0.4,
#### Why is the watch devouring all my memory? #### Why is the watch devouring all my memory?
Likely because of an enthusiastic pattern trying to watch thousands of files. Such as `'**/*.js'` but forgetting to exclude the `node_modules` folder with `'!node_modules/**/*.js'`. Try grouping your files within a subfolder or be more explicit with your file matching pattern. Likely because of an enthusiastic pattern trying to watch thousands of files. Such as `'**/*.js'` but forgetting to exclude the `node_modules` folder with `'!node_modules/**/*.js'`. Try grouping your files within a subfolder or be more explicit with your file matching pattern.
#### Why spawn as child processes as a default?
The goal of this watch task is as files are changed, run tasks as if they were triggered by the user themself. Each time a user runs `grunt` a process is spawned and tasks are ran in succession. In an effort to keep the experience consistent and continualy produce expected results, this watch task spawns tasks as child processes by default.
Sandboxing task runs also allows this watch task to run more stable over long periods of time. As well as more efficiently with more complex tasks and file structures.
Spawning does cause a performance hit (usually 500ms for most environments). It also cripples tasks that rely on the watch task to share the context with each subsequent run (i.e., reload tasks). If you would like a faster watch task or need to share the context please set the `nospawn` option to `true`. Just be aware that with this option enabled, the watch task is more prone to failure.
## Release History ## Release History
* 2013-02-26v0.3.0nospawn option added to run tasks without spawning as child processes. Watch emits 'watch' events upon files being triggered with grunt.event. Completion time in seconds and date/time shown after tasks ran. Negate file patterns fixed. Tasks debounced individually to handle simultaneous triggering for multiple targets. Errors handled better and viewable with --stack cli option. Code complexity reduced making the watch task code easier to read.
* 2013-02-14v0.2.0First official release for Grunt 0.4.0. * 2013-02-14v0.2.0First official release for Grunt 0.4.0.
* 2013-01-17v0.2.0rc7Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. * 2013-01-17v0.2.0rc7Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
* 2013-01-08v0.2.0rc5Updating to work with grunt v0.4.0rc5. * 2013-01-08v0.2.0rc5Updating to work with grunt v0.4.0rc5.
@ -147,4 +190,4 @@ Likely because of an enthusiastic pattern trying to watch thousands of files. Su
Task submitted by [Kyle Robinson Young](http://dontkry.com) Task submitted by [Kyle Robinson Young](http://dontkry.com)
*This file was generated on Wed Feb 20 2013 12:36:23.* *This file was generated on Wed Feb 27 2013 14:08:02.*

@ -1,7 +1,7 @@
{ {
"name": "grunt-contrib-watch", "name": "grunt-contrib-watch",
"description": "Run predefined tasks whenever watched file patterns are added, changed or deleted.", "description": "Run predefined tasks whenever watched file patterns are added, changed or deleted.",
"version": "0.2.0", "version": "0.3.0",
"homepage": "https://github.com/gruntjs/grunt-contrib-watch", "homepage": "https://github.com/gruntjs/grunt-contrib-watch",
"author": { "author": {
"name": "Grunt Team", "name": "Grunt Team",
@ -34,7 +34,7 @@
"grunt": "~0.4.0", "grunt": "~0.4.0",
"grunt-contrib-jshint": "~0.2.0", "grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-nodeunit": "~0.1.2", "grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-internal": "~0.4.0" "grunt-contrib-internal": "~0.4.3"
}, },
"peerDependencies": { "peerDependencies": {
"grunt": "~0.4.0" "grunt": "~0.4.0"

@ -13,7 +13,7 @@ function cleanUp() {
]); ]);
} }
exports.nospawn = { exports.patterns = {
setUp: function(done) { setUp: function(done) {
cleanUp(); cleanUp();
fs.symlinkSync(path.join(__dirname, '../../node_modules'), path.join(fixtures, 'patterns', 'node_modules')); fs.symlinkSync(path.join(__dirname, '../../node_modules'), path.join(fixtures, 'patterns', 'node_modules'));

Loading…
Cancel
Save