Skip to content

Commit

Permalink
Watch only files with API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinchernev committed Jan 15, 2017
1 parent 5713535 commit ccfa0f9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions bin/swagger-jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ var input = process.argv.slice(2);
// The spec, following a convention.
var output = 'swagger.json';

// No-cache module loading.
function requireNoCache(module) {
delete require.cache[require.resolve(module)];
return require(module);
}

/**
* Creates a swagger specification from a definition and a set of files.
* @function
Expand Down Expand Up @@ -93,7 +87,7 @@ fs.readFile(program.definition, 'utf-8', function(err, data) {
}

// Get an object of the definition file configuration.
var swaggerDefinition = requireNoCache(path.resolve(program.definition));
var swaggerDefinition = require(path.resolve(program.definition));

// Check for info object in the definition.
if (!swaggerDefinition.hasOwnProperty('info')) {
Expand All @@ -116,7 +110,7 @@ fs.readFile(program.definition, 'utf-8', function(err, data) {

// If watch flag is turned on, listen for changes.
if (program.watch) {
var watcher = chokidar.watch([program.definition, program.args], {
var watcher = chokidar.watch(program.args, {
awaitWriteFinish: {
stabilityThreshold: 2000,
pollInterval: 100,
Expand Down

0 comments on commit ccfa0f9

Please sign in to comment.