Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thealjey committed Jul 15, 2015
1 parent b3d29af commit 22f976e
Show file tree
Hide file tree
Showing 48 changed files with 2,423 additions and 1,590 deletions.
3 changes: 3 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[ignore]
.*/invalidPackageJson/*
.*/test/*
.*/build/*
.*/node_modules/.*/spec/*

[include]

[libs]
interfaces/

[options]
suppress_comment=.*@noflow.*
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "iojs"
after_script: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,43 @@ library is for.
npm i simple-recursive-watch --save
```

### Example usage
### API Documentation

To get better acquainted with the available tools feel free to skim through the auto-generated
[API Docs](https://rawgit.com/thealjey/simple-recursive-watch/master/docs/index.html).

### Exposes 1 class

`DirectoryWatcher` - recursively watches for file changes in a directory

```
interface DirectoryWatcher {
constructor(dir: string, type: RegExp, ...exclude: Array<string>);
start();
stop();
static watch(dir: string, extension: string, callback: Function, ...exclude: Array<string>): DirectoryWatcher;
}
```
import watch from 'simple-recursive-watch';

watch('lib', 'js', function () {
console.log('something changed');
### Arguments

1. `dir` - a full system path to a directory
2. `type` - a regular expression to match files
3. `exclude` - files/directories to exclude (not full paths, just file/directory names)
4. `extension` - a file extension to watch for
5. `callback` - a callback function to execute whenever a file system change occurs

### Example usage

```javascript
import {DirectoryWatcher} from 'simple-recursive-watch';
import {join} from 'path';

var libDir = join(__dirname, 'lib');

DirectoryWatcher.watch(libDir, 'js', function () {
// some JavaScript file, not named "ignoreMe.js" and not residing
// in a "__tests__" directory, was changed in the "lib" directory
}, '__tests__', 'ignoreMe.js');
```

Expand Down
22 changes: 22 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* @flow */

import {join} from 'path';
import {JS, NativeProcess} from 'webcompiler';

var rootDir = join(__dirname, '..'),
buildDir = join(rootDir, 'build'),
libDir = join(rootDir, 'lib'),
docsDir = join(rootDir, 'docs'),
specDir = join(rootDir, 'spec'),
readme = join(rootDir, 'README.md'),
js = new JS(),
jsdoc = new NativeProcess(join(rootDir, 'node_modules', '.bin', 'jsdoc'));

js.beDir(libDir, buildDir, function () {
jsdoc.run(function (e) {
if (e) {
return console.error(e);
}
console.log('\x1b[32mGenerated API documentation!\x1b[0m');
}, [buildDir, '-d', docsDir, '-R', readme]);
}, specDir, __filename);
33 changes: 0 additions & 33 deletions bin/compile.js

This file was deleted.

0 comments on commit 22f976e

Please sign in to comment.