From 17a9c88c02eea739ac9b339cde77a506112c4db9 Mon Sep 17 00:00:00 2001 From: VictorDoyle Date: Tue, 3 Dec 2024 22:23:37 -0500 Subject: [PATCH] redeploy --- .github/workflows/deploy-pages.yml | 53 ++++++++++++++++++++++++++++++ .gitignore | 4 ++- package.json | 3 +- src/workers/fileProcessor.ts | 34 +++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy-pages.yml create mode 100644 src/workers/fileProcessor.ts diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..9ec4750 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,53 @@ +name: Deploy Documentation to Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Install Dependencies + run: npm install + + - name: Generate Documentation + run: npx generate-docs + + - name: Build Documentation + run: cd docs/codexMaker && npm install && npm run build && npm run export + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: docs/codexMaker/out + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.gitignore b/.gitignore index bdf953f..c3ba038 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ dist/ *.log .DS_Store .vscode -codex-tests/ \ No newline at end of file +codex-tests/ +out/ +.next/ \ No newline at end of file diff --git a/package.json b/package.json index b803f26..f34c193 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "build": "tsc", "test": "npx generate-docs && cd docs && cd codexMaker && npm run dev", "prepare": "npm run build", - "destroy": "rm -rf docs" + "destroy": "rm -rf docs", + "build-docs": "cd docs/codexMaker && next build && next export" }, "keywords": [ "documentation", diff --git a/src/workers/fileProcessor.ts b/src/workers/fileProcessor.ts new file mode 100644 index 0000000..1d17a7c --- /dev/null +++ b/src/workers/fileProcessor.ts @@ -0,0 +1,34 @@ +import { parentPort, workerData } from 'worker_threads'; +import { availableParsers } from '../parsers'; + +async function processWorkerFile() { + if (!parentPort) throw new Error('This file must be run as a worker'); + + try { + const { filePath, content } = workerData; + + // find correct parser + const parser = availableParsers.find(p => p.canParse(filePath)); + if (!parser) { + parentPort.postMessage({ + functions: [], + errors: [`No parser available for file: ${filePath}`] + }); + return; + } + + // parse file + const result = await parser.parseFile(filePath, content); + parentPort.postMessage(result); + } catch (error) { + parentPort.postMessage({ + functions: [], + errors: [`Worker error processing ${workerData.filePath}: ${(error as Error).message}`] + }); + } +} + +processWorkerFile().catch(error => { + console.error('Worker error:', error); + process.exit(1); +}); \ No newline at end of file