Open liu946 opened 8 years ago
I have checked your code and find that config file is 'path/to/dir/esdoc.json'. please use the input string user-defined path instead when config is a STRING.
So the solution is to require your config file like so
const esdocConfig = require( "./path/to/dir/esdoc.json" );
then:
gulp.src(["./src"]).pipe( esDoc( esdocConfig ) );
Should do it!
This plugin supports ESDoc config file. The real issue is in the name of the file it looks for: tt should look for .esdoc.json
as stated by the docs, but instead looks for a esdoc.json
file.
ESDoc automatically finds the configuration file path by the order, if you don't specify -c esdoc.json.
- .esdoc.json in the current directory
- .esdoc.js in the current directory
- esdoc property in package.json
In the meantime, you could do something like this ES6 code, which I myself use:
let esdocConfigPath = path.join(process.cwd(), '.esdoc.json'), data, esdocConfig;
if (fs.existsSync(esdocConfigPath)) {
data = fs.readFileSync(esdocConfigPath, { encoding: 'utf8' });
esdocConfig = !data ? {} : JSON.parse(data);
console.log('Found ESDoc config in .esdoc.json!');
} else {
esdocConfig = {};
}
the .esdocrc file can use in esdoc module. I didn't find a way to use config-file way in gulp-esdoc.