Skip to content

Commit

Permalink
fix(docgen): remove not necessary path and use build-in fs.promises
Browse files Browse the repository at this point in the history
closes #44
  • Loading branch information
ph1p committed Aug 30, 2021
1 parent fff7d06 commit 5e7ba4a
Show file tree
Hide file tree
Showing 5 changed files with 1,383 additions and 1,399 deletions.
11 changes: 3 additions & 8 deletions cmds/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const fs = require('fs.promised/promisify')(require('bluebird'));
const fs = require('fs').promises;
const path = require('path');
const mkdirp = require('mkdirp');
const jsdoc2md = require('jsdoc-to-markdown');
Expand Down Expand Up @@ -138,18 +138,13 @@ async function generate(argv) {
let mdFileData = '';

if (/\.vue$/.test(file)) {
const nodeModulesPath = path.join(path.dirname(fs.realpathSync(__filename)), '../node_modules');
const rootProjectFolder = process.cwd();
process.chdir(folder); // Change current working directory to the folder of the current source file
const shellCommand = quote([
`${nodeModulesPath}/.bin/vue-docgen`,
file,
path.join(rootProjectFolder, folderPath)
]);
const shellCommand = quote(['vue-docgen', file, path.join(rootProjectFolder, folderPath)]);
child_process.execSync(shellCommand);
process.chdir(rootProjectFolder); // Reset current working directory to root project folder

mdFileData = fs.readFileSync(`${folderPath}/${fileName}.md`, 'utf-8');
mdFileData = await fs.readFile(`${folderPath}/${fileName}.md`, 'utf-8');
} else if (/\.(js|ts|jsx|tsx)$/.test(file) && fileData) {
const configPath = argv.jsDocConfigPath;

Expand Down
Loading

0 comments on commit 5e7ba4a

Please sign in to comment.