diff --git a/.github/workflows/build-site.yml b/.github/workflows/build-site.yml deleted file mode 100644 index e961d93..0000000 --- a/.github/workflows/build-site.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build Site - -on: - push: - branches: - - main -jobs: - build: - runs-on: ubuntu-latest - if: github.actor != 'github-actions[bot]' && github.ref == 'refs/heads/main' - permissions: - contents: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Build site - run: node build.js - - - name: Commit and push changes - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - # Add all HTML files in the website directory - git add -- 'website/*.html' - # Only commit if there are staged changes - git diff --staged --quiet || git commit -m "Automated build: Update generated site files" - git push diff --git a/build.js b/build.js index 9c70e4e..cac81fb 100644 --- a/build.js +++ b/build.js @@ -13,16 +13,53 @@ function extractBlock(content, startDelimiter, endDelimiter) { return { blockContent: block, remainingContent: remaining.trim() }; } +// Helper function to copy files recursively +async function copyWebsiteFiles() { + const websiteDir = path.join(__dirname, 'website'); + const buildDir = path.join(__dirname, 'build'); + + try { + const websiteExists = await fs.access(websiteDir).then(() => true).catch(() => false); + if (!websiteExists) { + console.log("No website directory found, skipping copy."); + return; + } + + async function copyRecursive(src, dest) { + const stats = await fs.stat(src); + + if (stats.isDirectory()) { + await fs.mkdir(dest, { recursive: true }); + const items = await fs.readdir(src); + + for (const item of items) { + const srcPath = path.join(src, item); + const destPath = path.join(dest, item); + await copyRecursive(srcPath, destPath); + } + } else { + await fs.copyFile(src, dest); + } + } + + await copyRecursive(websiteDir, buildDir); + console.log("Website files copied successfully."); + } catch (error) { + console.error('Error copying website files:', error); + throw error; + } +} + async function buildPage(pageName, outputName) { const layoutPath = path.join(__dirname, 'templates', '_layout.html'); const commonHeaderPath = path.join(__dirname, 'templates', '_header.html'); const commonFooterPath = path.join(__dirname, 'templates', '_footer.html'); const contentPath = path.join(__dirname, 'src', `${pageName}.html`); - const outputDir = path.join(__dirname, 'website'); + const outputDir = path.join(__dirname, 'build'); const outputPath = path.join(outputDir, `${outputName}.html`); try { - // Ensure the website directory exists + // Ensure the build directory exists await fs.mkdir(outputDir, { recursive: true }); let layoutContent = await fs.readFile(layoutPath, 'utf-8'); @@ -110,6 +147,9 @@ async function buildPage(pageName, outputName) { async function main() { try { + // Copy website files first + await copyWebsiteFiles(); + const srcDir = path.join(__dirname, 'src'); const files = await fs.readdir(srcDir); diff --git a/website/index.html b/website/index.html deleted file mode 100644 index b9f9ecf..0000000 --- a/website/index.html +++ /dev/null @@ -1,87 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I respect your privacy.
- -My apps do not collect, store, or share any personal information. No analytics, no tracking, no funny business.
- -This site may collect anonymous usage data (such as page views or general browser information) to help improve functionality and performance. This data is non-personal and cannot be used to identify you. I do not sell or share this data with third parties.
-Additionally, this site uses Cloudflare for performance and security. Cloudflare may collect its own analytics and statistical data, subject to their privacy policy.
- -By using this site, you agree to this policy.
-