Skip to content

Commit 79b302f

Browse files
committed
Renamed pkg variable.
1 parent d1ef4bc commit 79b302f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

bin/doxdox

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ const doxdox = require('../lib/doxdox');
99

1010
const findPackageFileInPath = require('../lib/utils').findPackageFileInPath;
1111

12+
const pkg = require('../package');
13+
1214
const args = require('parse-cmd-args')(null, {
1315
'allowMultipleInputs': true,
1416
'requireUserInput': true
1517
});
1618

1719
if (args.flags['--version'] || args.flags['-v']) {
1820

19-
process.stdout.write(`${require('../package').version}\n`);
21+
process.stdout.write(`${pkg.version}\n`);
2022
process.exit();
2123

2224
} else if (!args.inputs.length || args.flags['--help'] || args.flags['-h']) {
@@ -46,39 +48,37 @@ ${chalk.yellow(' -t, --title')} Sets title.
4648

4749
} else {
4850

49-
let pkg = findPackageFileInPath(args.flags['--package'] || args.flags['-p']);
50-
51-
try {
51+
const projectPkgPath = findPackageFileInPath(args.flags['--package'] || args.flags['-p']);
5252

53-
const pkgStats = fs.statSync(pkg);
53+
let projectPkg = {};
5454

55-
if (pkgStats.isFile()) {
55+
try {
5656

57-
pkg = require(pkg);
57+
const projectPkgStats = fs.statSync(projectPkgPath);
5858

59-
} else {
59+
if (projectPkgStats.isFile()) {
6060

61-
pkg = {};
61+
projectPkg = require(projectPkgPath);
6262

6363
}
6464

6565
} catch (err) {
6666

67-
pkg = {};
67+
process.stderr.write(`${err.toString()}\n`);
6868

6969
}
7070

7171
const config = {
72-
'description': args.flags['--description'] || args.flags['-d'] || pkg.description || '',
72+
'description': args.flags['--description'] || args.flags['-d'] || projectPkg.description || '',
7373
'ignore': (args.flags['--ignore'] || args.flags['-i'] || '').split(/\s*,\s*/),
7474
'layout': (args.flags['--layout'] || args.flags['-l'] || 'markdown').toLowerCase(),
7575
'parser': (args.flags['--parser'] || args.flags['-r'] || 'dox').toLowerCase(),
76-
'title': args.flags['--title'] || args.flags['-t'] || pkg.name || 'Untitled Project'
76+
'title': args.flags['--title'] || args.flags['-t'] || projectPkg.name || 'Untitled Project'
7777
};
7878

7979
const output = args.flags['--output'] || args.flags['-o'] || null;
8080

81-
doxdox.parseInputs(args.inputs, Object.assign({pkg}, config)).then(content => {
81+
doxdox.parseInputs(args.inputs, Object.assign({projectPkg}, config)).then(content => {
8282

8383
if (output) {
8484

0 commit comments

Comments
 (0)