From 13917718bdbcc12415b5626f0638aafd4130504b Mon Sep 17 00:00:00 2001 From: Nikolai Dorofeev Date: Sun, 16 Jun 2024 09:53:36 +0400 Subject: [PATCH] Extract image generation (#16) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Init dog package * Move image generation logic * Remove image generation from d0xigen * Somehow generate images using backroad * Make it run * CLI generation * Run web from CLI * Rename jpeg to jpg * Update plugin recommendations * Update netlify configuration * Create utils folder * Prepare pdf CDN script * Lintfix * Fix resume paths * Fix resume paths * lintfix * Uninstall node-html-parser * Resume -> Resumé * Generate PDF * CDN build workflow * Redirect PDF link to CDN * Fix resume print view * Change CDN build trigger * Prepare dog for publishing --- .changeset/silly-hounds-sit.md | 5 + .changeset/tasty-spies-shop.md | 5 + .github/workflows/cdn.build.yaml | 28 + .vscode/extensions.json | 1 - apps/d0rich.me/components/layouts/DHeader.vue | 2 +- .../components/resume/CertificatesCard.vue | 8 +- .../components/resume/ProjectNote.vue | 2 +- .../components/resume/ProjectsCard.vue | 8 +- apps/d0rich.me/components/resume/TimeNote.vue | 8 +- apps/d0rich.me/netlify.toml | 3 + apps/d0rich.me/nuxt.config.ts | 8 +- apps/d0rich.me/package.json | 2 - apps/d0rich.me/pages/resume/[type].vue | 21 +- .../server/routes/api/resume/[type].pdf.ts | 21 - .../server/routes/api/resume/list.json.ts | 12 + apps/d0rich.me/server/utils/puppeteer.ts | 68 - apps/d0xigen.d0rich.me/app.config.ts | 2 +- apps/d0xigen.d0rich.me/netlify.toml | 3 + apps/d0xigen.d0rich.me/public/favicon.ico | Bin 0 -> 285478 bytes apps/d0xigen.d0rich.me/public/og/image.jpg | Bin 0 -> 74975 bytes apps/design.d0rich.me/netlify.toml | 3 + cdn/package-lock.json | 2976 ++++++++++++++ cdn/package.json | 20 + cdn/src/config.ts | 3 + cdn/src/features/resume/collectResumeList.ts | 14 + cdn/src/features/resume/getResumePdf.ts | 32 + cdn/src/features/resume/saveAllResume.ts | 17 + cdn/src/main.ts | 10 + cdn/src/models/ResumeList.ts | 8 + cdn/src/store/browser.ts | 14 + cdn/src/store/dist.ts | 6 + package-lock.json | 3495 ++++++++++++----- package.json | 3 +- packages/d0xigen/app.config.ts | 2 +- packages/d0xigen/nuxt.config.ts | 2 - packages/d0xigen/package.json | 2 - packages/d0xigen/server/routes/favicon.ico.ts | 3 - .../d0xigen/server/routes/og/image.jpg.ts | 3 - packages/d0xigen/server/utils/favicon.ts | 45 - packages/d0xigen/server/utils/og-image.ts | 35 - utils/dog/.gitignore | 1 + .../dog}/assets/templates/background.svg | 0 .../dog}/assets/templates/favicon.html | 0 .../dog}/assets/templates/favicon.svg | 0 .../dog}/assets/templates/og-image.html | 0 utils/dog/package.json | 52 + utils/dog/src/cli.ts | 63 + utils/dog/src/generators/favicon.ts | 38 + utils/dog/src/generators/index.ts | 2 + utils/dog/src/generators/og-image.ts | 32 + utils/dog/src/runWeb.ts | 3 + utils/dog/src/storage.ts | 15 + utils/dog/src/utils/bufferToImgSrc.ts | 7 + utils/dog/src/webApp.ts | 57 + utils/dog/tsconfig.json | 17 + 55 files changed, 6059 insertions(+), 1128 deletions(-) create mode 100644 .changeset/silly-hounds-sit.md create mode 100644 .changeset/tasty-spies-shop.md create mode 100644 .github/workflows/cdn.build.yaml delete mode 100644 apps/d0rich.me/server/routes/api/resume/[type].pdf.ts create mode 100644 apps/d0rich.me/server/routes/api/resume/list.json.ts delete mode 100644 apps/d0rich.me/server/utils/puppeteer.ts create mode 100644 apps/d0xigen.d0rich.me/public/favicon.ico create mode 100644 apps/d0xigen.d0rich.me/public/og/image.jpg create mode 100644 cdn/package-lock.json create mode 100644 cdn/package.json create mode 100644 cdn/src/config.ts create mode 100644 cdn/src/features/resume/collectResumeList.ts create mode 100644 cdn/src/features/resume/getResumePdf.ts create mode 100644 cdn/src/features/resume/saveAllResume.ts create mode 100644 cdn/src/main.ts create mode 100644 cdn/src/models/ResumeList.ts create mode 100644 cdn/src/store/browser.ts create mode 100644 cdn/src/store/dist.ts delete mode 100644 packages/d0xigen/server/routes/favicon.ico.ts delete mode 100644 packages/d0xigen/server/routes/og/image.jpg.ts delete mode 100644 packages/d0xigen/server/utils/favicon.ts delete mode 100644 packages/d0xigen/server/utils/og-image.ts create mode 100644 utils/dog/.gitignore rename {packages/d0xigen/server => utils/dog}/assets/templates/background.svg (100%) rename {packages/d0xigen/server => utils/dog}/assets/templates/favicon.html (100%) rename {packages/d0xigen/server => utils/dog}/assets/templates/favicon.svg (100%) rename {packages/d0xigen/server => utils/dog}/assets/templates/og-image.html (100%) create mode 100644 utils/dog/package.json create mode 100644 utils/dog/src/cli.ts create mode 100644 utils/dog/src/generators/favicon.ts create mode 100644 utils/dog/src/generators/index.ts create mode 100644 utils/dog/src/generators/og-image.ts create mode 100644 utils/dog/src/runWeb.ts create mode 100644 utils/dog/src/storage.ts create mode 100644 utils/dog/src/utils/bufferToImgSrc.ts create mode 100644 utils/dog/src/webApp.ts create mode 100644 utils/dog/tsconfig.json diff --git a/.changeset/silly-hounds-sit.md b/.changeset/silly-hounds-sit.md new file mode 100644 index 00000000..96dffa51 --- /dev/null +++ b/.changeset/silly-hounds-sit.md @@ -0,0 +1,5 @@ +--- +'@d0rich/dog': minor +--- + +Implement OG images generator CLI and web UI diff --git a/.changeset/tasty-spies-shop.md b/.changeset/tasty-spies-shop.md new file mode 100644 index 00000000..e30f1107 --- /dev/null +++ b/.changeset/tasty-spies-shop.md @@ -0,0 +1,5 @@ +--- +'d0xigen': minor +--- + +Remove image generations. Now it will be available via @d0rich/dog diff --git a/.github/workflows/cdn.build.yaml b/.github/workflows/cdn.build.yaml new file mode 100644 index 00000000..6e282a5f --- /dev/null +++ b/.github/workflows/cdn.build.yaml @@ -0,0 +1,28 @@ +name: Build CDN +on: + schedule: + # Run every day + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + - name: Install dependencies + working-directory: ./cdn + run: npm ci + - name: Build + working-directory: ./cdn + run: npm run build + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./cdn/dist + publish_branch: cdn diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ca40ae86..3e79a111 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,5 @@ { "recommendations": [ - "vue.vscode-typescript-vue-plugin", "vue.volar", "nuxt.mdc", "bradlc.vscode-tailwindcss", diff --git a/apps/d0rich.me/components/layouts/DHeader.vue b/apps/d0rich.me/components/layouts/DHeader.vue index a5ad0f2f..e817fbff 100644 --- a/apps/d0rich.me/components/layouts/DHeader.vue +++ b/apps/d0rich.me/components/layouts/DHeader.vue @@ -15,7 +15,7 @@ Dorich Projects Blog - Resume + Resumé diff --git a/apps/d0rich.me/components/resume/CertificatesCard.vue b/apps/d0rich.me/components/resume/CertificatesCard.vue index 584b41d6..1330437a 100644 --- a/apps/d0rich.me/components/resume/CertificatesCard.vue +++ b/apps/d0rich.me/components/resume/CertificatesCard.vue @@ -7,9 +7,13 @@ defineProps<{