Skip to content

Commit

Permalink
Add QR codes for deploy preview urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Jan 21, 2025
1 parent cb2a191 commit 6db140d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 28 deletions.
7 changes: 5 additions & 2 deletions dangerFileContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { exec } from 'child_process';
import type * as dangerModule from 'danger';
import replaceUrl from '@mui-internal/api-docs-builder/utils/replaceUrl';
// eslint-disable-next-line import/no-relative-packages
import { loadComparison } from './scripts/sizeSnapshot';
import QRCode from 'qrcode';
import { loadComparison } from 'size-snapshot';

declare const danger: (typeof dangerModule)['danger'];
declare const markdown: (typeof dangerModule)['markdown'];
Expand Down Expand Up @@ -232,7 +233,9 @@ ${
? docs
.map((path) => {
const formattedUrl = formatFileToLink(path);
return `- [${path}](${netlifyPreview}${formattedUrl})`;
const url = `${netlifyPreview}${formattedUrl}`;
const qrDataUrl = QRCode.toDataURL(url, {});
return `<details><summary>[${path}](${url})</summary>![${url}](${qrDataUrl})</details>`;
})
.join('\n')
: netlifyPreview
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"@netlify/functions": "^3.0.0",
"@slack/bolt": "^4.2.0",
"execa": "^9.5.2",
"google-auth-library": "^9.15.0"
"google-auth-library": "^9.15.0",
"qrcode": "^1.5.4"
},
"devDependencies": {
"@argos-ci/core": "^2.12.0",
Expand Down
75 changes: 50 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6db140d

Please sign in to comment.