utils/postinstall.js
function resolveJSDocConfigPath() {
    var jsdocConfJson = require('../jsdoc_conf.json'),
        jsdocConfPath;

    try {
        fs.statSync(jsdocConfJson.opts.template);
        console.log('jsdoc template from default config exists');
    } catch (err) {
        if (err.code === 'ENOENT') {
            jsdocConfJson.opts.template = path.join(process.cwd(), '../ink-docstrap/template');
            console.log('jsdoc template from default config did NOT exist! Testing alternative location',
                jsdocConfJson.opts.template);

            try {
                fs.statSync(jsdocConfJson.opts.template);
                jsdocConfPath = path.join(process.cwd(), 'jsdoc_alt_conf.json');
                console.log('alternative location existed, generating alternative configuration', jsdocConfPath);
                fs.writeFileSync(jsdocConfPath, JSON.stringify(jsdocConfJson), 'utf8');

            } catch (err2) {
                if (err.code === 'ENOENT') {
                    console.error('Will not generate source code documentation files!');
                    jsdocConfPath = false;
                } else {
                    console.error(err);
                }
            }
        } else {
            console.error(err);
        }
    }

    return jsdocConfPath;
}
function resolveJSDocConfigPath() {
    var jsdocConfJson = require('../jsdoc_conf.json'),
        jsdocConfPath;

    try {
        fs.statSync(jsdocConfJson.opts.template);
        console.log('jsdoc template from default config exists');
    } catch (err) {
        if (err.code === 'ENOENT') {
            jsdocConfJson.opts.template = path.join(process.cwd(), '../ink-docstrap/template');
            console.log('jsdoc template from default config did NOT exist! Testing alternative location',
                jsdocConfJson.opts.template);

            try {
                fs.statSync(jsdocConfJson.opts.template);
                jsdocConfPath = path.join(process.cwd(), 'jsdoc_alt_conf.json');
                console.log('alternative location existed, generating alternative configuration', jsdocConfPath);
                fs.writeFileSync(jsdocConfPath, JSON.stringify(jsdocConfJson), 'utf8');

            } catch (err2) {
                if (err.code === 'ENOENT') {
                    console.error('Will not generate source code documentation files!');
                    jsdocConfPath = false;
                } else {
                    console.error(err);
                }
            }
        } else {
            console.error(err);
        }
    }

    return jsdocConfPath;
}
function resolveJSDocConfigPath ( ) { var jsdocConfJson = require ( '../jsdoc_conf.json' ) , jsdocConfPath ; try { fs . statSync ( jsdocConfJson . opts . template ) ; console . log ( 'jsdoc template from default config exists' ) ; } catch ( err ) { if ( err . code === 'ENOENT' ) { jsdocConfJson . opts . template = path . join ( process . cwd ( ) , '../ink-docstrap/template' ) ; console . log ( 'jsdoc template from default config did NOT exist! Testing alternative location' , jsdocConfJson . opts . template ) ; try { fs . statSync ( jsdocConfJson . opts . template ) ; jsdocConfPath = path . join ( process . cwd ( ) , 'jsdoc_alt_conf.json' ) ; console . log ( 'alternative location existed, generating alternative configuration' , jsdocConfPath ) ; fs . writeFileSync ( jsdocConfPath , JSON . stringify ( jsdocConfJson ) , 'utf8' ) ; } catch ( err2 ) { if ( err . code === 'ENOENT' ) { console . error ( 'Will not generate source code documentation files!' ) ; jsdocConfPath = false ; } else { console . error ( err ) ; } } } else { console . error ( err ) ; } } return jsdocConfPath ; }
The path to the template in the jsdoc.json does not match for npm > 3 when webgme
is installed in another repo. I these cases we need to generate an alternative config
with the resolved path to the template.
@return {string} Path to jsdoc that should be used.
The path to the template in the jsdoc . json does not match for npm > 3 when webgme is installed in another repo . I these cases we need to generate an alternative config with the resolved path to the template .