Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.env
dist/
node_modules/
node_modules/
.vscode/
17 changes: 15 additions & 2 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const menuItems = require('./src/menu.js');
const { encode } = require('html-entities');
const { JSDOM } = require('jsdom');
const yaml = require('js-yaml');
const esbuild = require('esbuild');

const site = "https://docs.puter.com";

Expand Down Expand Up @@ -447,7 +448,7 @@ function generateDocsHTML(filePath, rootDir, page, isIndex = false) {

html += generateSearchUIHTML();

html += `<script src="/${baseURL}/assets/js/app.js"></script>`;
html += `<script src="/${baseURL}/assets/js/bundle.js"></script>`;
html += `</body>`;
const relativeDir = path.relative(rootDir, path.dirname(filePath));
const newDir = path.join(rootDir, '..', 'dist', relativeDir, path.basename(filePath, '.md'));
Expand Down Expand Up @@ -516,9 +517,21 @@ function findMdFiles(rootDir) {
}

// Updated main function to start the process
function generateDocumentation(rootDir) {
async function generateDocumentation(rootDir) {
const distDir = path.join(rootDir, '..', 'dist');
removeDirectoryRecursively(distDir); // Remove the existing 'dist' directory
try {
await esbuild.build({
entryPoints: ['src/assets/js/index.js'],
bundle: true,
outfile: 'dist/assets/js/bundle.js',
minify: true,
sourcemap: true,
allowOverwrite: true
})
} catch (error) {
console.error(error);
}
findMdFiles(rootDir); // Process files based on sidebar
}

Expand Down
Loading