Skip to content

Commit

Permalink
fixes?
Browse files Browse the repository at this point in the history
  • Loading branch information
SenjeyB committed Dec 25, 2024
1 parent 464a012 commit caa9529
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 30 deletions.
41 changes: 18 additions & 23 deletions src/commands/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,28 @@ module.exports = function(opts) {
}

try {
const argv = ['eo:docs'].concat(flags(opts));
mvnw(argv, opts.target || '.', opts.batch).then(() => {
const allFiles = readXmirFilesRecursively(inputDir);

const packages = new Set();
allFiles.forEach((filePath) => {
const packageName = getPackageNameFromFilePath(filePath);
packages.add(packageName);
});

for (const packageName of packages) {
const fileName = sanitizeFileName(packageName || 'default');
const outputPath = path.join(outputDir, fileName);
const allFiles = readXmirFilesRecursively(inputDir);

const packages = new Set();
allFiles.forEach(filePath => {
const packageName = getPackageNameFromFilePath(filePath);
packages.add(packageName);
});

fs.writeFileSync(outputPath, '');
}
for (const packageName of packages) {
const fileName = sanitizeFileName(packageName || 'default');
const outputPath = path.join(outputDir, fileName);

fs.writeFileSync(outputPath, '');
}

const packagesPath = path.join(outputDir, 'packages.html');
fs.writeFileSync(packagesPath, '');
const packagesPath = path.join(outputDir, 'packages.html');
fs.writeFileSync(packagesPath, '');

const cssPath = path.join(outputDir, 'styles.css');
fs.writeFileSync(cssPath, '');
const cssPath = path.join(outputDir, 'styles.css');
fs.writeFileSync(cssPath, '');

console.info('Documentation generation completed in %s directory', outputDir);
}).catch((error) => {
console.error('Error executing Maven command:', error);
});
console.info('Documentation generation completed in %s directory', outputDir);
} catch (error) {
console.error('Error generating documentation:', error);
}
Expand Down
15 changes: 8 additions & 7 deletions test/commands/test_docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const { runSync, assertFilesExist } = require('../helpers');
const {runSync} = require('../helpers');

describe('docs', function() {
const testDir = path.resolve('temp/test-docs-command');
Expand All @@ -43,19 +43,20 @@ describe('docs', function() {
* Tests that the 'docs' command generates empty HTML files in the docs directory.
* @param {Mocha.Done} done - Mocha callback signaling asynchronous completion
*/
it('generates empty HTML files for .xmir files', function(done) {
it('generates empty HTML files for packages', function(done) {
const samplePackageDir = path.join(eocDir, 'foo', 'bar');
fs.mkdirSync(samplePackageDir, { recursive: true });
const xmirFilePath = path.join(samplePackageDir, 'test.xmir');
fs.writeFileSync(xmirFilePath, '<program name="test" />');

const oldCwd = process.cwd();
process.chdir(testDir);
try {
runSync(['docs']);
} finally {
process.chdir(oldCwd);
}
runSync([
'docs',
'--verbose',
'-s', path.resolve('./src'),
'-t', path.resolve('./target'),
]);

assert(fs.existsSync(docsDir), 'Expected the docs directory to be created but it is missing');

Expand Down

0 comments on commit caa9529

Please sign in to comment.