Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(sourceFiles).forEach(function(file) {
var source
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened)
helper.registerLink(sourceFiles[file].shortened, sourceOutfile)
try {
source = {
kind: 'source',
code: helper.htmlsafe(
fs.readFileSync(sourceFiles[file].resolved, encoding)
)
}
} catch (e) {
logger.error('Error while generating source file %s: %s', file, e.message)
}
generate(
'Source: ' + sourceFiles[file].shortened,
[source],
sourceOutfile,
false
)
})
}
Object.keys(sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
};
}
catch(e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile,
false);
});
}
Object.keys(sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
};
}
catch(e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile,
false);
});
}
Object.keys(sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
};
}
catch (e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile,
false);
});
}
Object.keys(sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
sourceFilenames.push(sourceOutfile);
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
};
}
catch(e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
generate('Source', sourceFiles[file].shortened, [source], sourceOutfile, false);
});
return sourceFilenames;
var i;
var info;
var l;
var packageDocs;
var packageJson;
var sourceFiles;
var template;
defaultOpts = {
destination: './out/',
encoding: 'utf8'
};
// get JSDoc version number
info = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
env.version = {
number: info.version,
revision: new Date(parseInt(info.revision, 10)).toUTCString()
};
env.opts = jsdoc.opts.args.parse(env.args);
confPath = env.opts.configure || path.join(__dirname, 'conf.json');
if ( !fs.statSync(confPath).isFile() && !env.opts.configure ) {
confPath = path.join(__dirname, 'conf.json.EXAMPLE');
}
try {
env.conf = new jsdoc.Config( fs.readFileSync(confPath, 'utf8') )
.get();
}
Object.keys(sourceFiles).forEach(function(file) {
var source;
// links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);
helper.registerLink(sourceFiles[file].shortened, sourceOutfile);
try {
source = {
kind: 'source',
code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )
};
}
catch (e) {
logger.error('Error while generating source file %s: %s', file, e.message);
}
generate(sourceFiles[file].shortened, 'Source', [source], sourceOutfile,
false);
});
}
function readProjectInfo() {
try {
return JSON.parse(fs.readFileSync(process.cwd() + '/package.json', 'utf8'))
} catch (err) {
console.error('package.json is invalid')
}
}
srcExists = fs.existsSync(src),
destExists = fs.existsSync(dest),
stats = srcExists && fs.statSync(src),
isDirectory = srcExists && stats.isDirectory();
if (srcExists) {
if (isDirectory) {
if (!destExists) {
fs.mkdirSync(dest);
}
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName),
path.join(dest, childItemName));
});
} else {
contents = fs.readFileSync(src);
fs.writeFileSync(dest, contents);
}
}
};