Skip to content

Commit

Permalink
better vue doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
syrk4web committed Jul 2, 2024
1 parent edb688d commit 9f1dbef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
4 changes: 4 additions & 0 deletions docs/ui-components.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# UI Components

This page contains all the UI components used in the application.

## Builder

### Bans.vue
Expand Down
24 changes: 9 additions & 15 deletions docs/vue2md.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function mergeMd() {
});

// Create the md file to merge
const merge = path.join(ouputFolder, finalFile);
const merge = path.join(finalFile);
fs.writeFileSync(merge, "", "utf8");
// Append each file in order
order.forEach((item) => {
Expand All @@ -144,7 +144,7 @@ function mergeMd() {
// Format merge file
function formatMd() {
// Create a md file to merge
const merge = path.join(ouputFolder, finalFile);
const merge = path.join(finalFile);

// Get data from merge
let data = fs.readFileSync(merge, "utf8");
Expand Down Expand Up @@ -221,25 +221,19 @@ function formatMd() {
// Update the data with split
data = dataSplit.join("\n");

// Add title and description
const title = "# UI Components";
const description =
"This page contains all the UI components used in the application.";
data = `${title}\n\n${description}\n\n${data}`;

fs.writeFileSync(merge, data, "utf8");
fs.rmSync(ouputFolder, { recursive: true });
}

// Move final file to root with others pages
// And delete output folder
function moveMd() {

fs.rename(`./output/${finalFile}`, `./${finalFile}`, function (err) {
if (err) throw err
})

// Delete output folder
fs.rmdirSync(ouputFolder, { recursive: true });

}


vue2js();
js2md();
mergeMd();
formatMd();
moveMd();

0 comments on commit 9f1dbef

Please sign in to comment.