Skip to content

Cannot read property 'parseExtension' of undefined #869

Open
@dasblitz

Description

@dasblitz

First of all thx for this great library, I've been using it with no problems for the past few months however since upgrading to the latest version I'm running into an error.

I'm using documentation version 5.1.1 installed as an npm module. But when I try to run
node generate-docs.js (see file content of generate-docs below)

I'm getting the following error:

Cannot read property 'parseExtension' of undefined

The error happens in documentation/lib/merge_config.js at line 72 where the config passed into the mergeConfig function is undefined.

I've had the script working on an older version where instead of the returned promise documentation.build() was using callback functions. I've tried to search stackoverflow but documentation is not the easiest search term :) From the documentation I understood that the config.yml was optional. Any help on a possible solution would be greatly appreciated :)

/* generate-docs.js */
/* eslint-disable no-console */
process.env.NODE_ENV = 'production';

var documentation = require('documentation');
var paths = require('../config/paths');
var streamArray = require('stream-array');
var vfs = require('vinyl-fs');

var files = [
    'src/index.js',
    'src/entities/player.js'
];

console.log('Building API documentation...');

documentation.build(files, {shallow: true})
.then(documentation.formats.html)
.then(function(output){
    streamArray(output).pipe(vfs.dest(paths.appBuildDocs));
    console.log('API docs generated');
})
.catch(function(err){
    console.log(err);
});

Edit: some additional info, it works for version 4.0.0-beta.18 with the following code:

/* eslint-disable no-console */
process.env.NODE_ENV = 'production';

var documentation = require('documentation');
var paths = require('../config/paths');
var streamArray = require('stream-array');
var vfs = require('vinyl-fs');

var files = [
    'src/index.js',
    'src/entities/player.js'
];

console.log('Building API documentation...');

documentation.build(files, {shallow: true}, function(err, res) {
    if(err) {
        console.error(err);
        return;
    }
    documentation.formats.html(res, {}, function(err, output) {
        streamArray(output).pipe(vfs.dest(paths.appBuildDocs));
        console.log('API docs generated');
    });
});

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions