Skip to content

Commit 01d0640

Browse files
omarghoNicolasCARPi
authored andcommitted
add --watch tag (apidoc#835)
fix apidoc#833 and remove Node v6 from Travis CI
1 parent b5e506a commit 01d0640

File tree

4 files changed

+670
-19
lines changed

4 files changed

+670
-19
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
language: node_js
22
sudo: false
33
node_js:
4-
- 6
4+
- 12
5+
- 11
6+
- 10
7+
- 8
58
before_script:
69
- npm install -g grunt-cli

bin/apidoc

+16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
var path = require('path');
1515
var cmd = require('commander');
16+
var nodemon = require('nodemon');
1617
var apidoc = require('../lib/index');
1718

1819
var argv = cmd
@@ -57,6 +58,8 @@ var argv = cmd
5758

5859
.option('--filter-by <tag-filter=value>', 'Filter documentation by tag')
5960

61+
.option('--watch', 'Watch the Input/Source dirname for changes to rebuild the docs')
62+
6063
.parse(process.argv)
6164
;
6265

@@ -120,6 +123,19 @@ var options = {
120123
filterBy : argv.filterBy,
121124
};
122125

126+
if (argv.watch) {
127+
nodemon({watch: options.src});
128+
console.log('Watching mode is Activated\nListening for changes...');
129+
nodemon.on('quit', function () {
130+
console.log('ApiDoc has exited');
131+
process.exit()
132+
}).on('restart', function () {
133+
console.log('Changes detected, Rebuilding the docs...');
134+
apidoc.createDoc(options);
135+
console.log('Listening for changes...');
136+
});
137+
}
138+
123139
if (apidoc.createDoc(options) === false) {
124140
process.exit(1);
125141
}

0 commit comments

Comments
 (0)