Skip to content

Commit b41595a

Browse files
authored
Merge pull request #87 from yhatt/puppeteer-browser
Use `@puppeteer/browsers` instead of puppeteer module
2 parents 76d2018 + 8592f44 commit b41595a

7 files changed

Lines changed: 24 additions & 22 deletions

File tree

.github/workflows/github-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131
cache: npm
3232
node-version-file: '.nvmrc'
3333

34-
- name: Install dependencies and Puppeteer
35-
run: npm ci && npm i puppeteer --no-save
34+
- name: Install dependencies
35+
run: npm ci
3636

3737
- name: Build Marp slide deck
38-
run: CHROME_PATH=$(node -e "console.log(require('puppeteer').executablePath())") npm run build
38+
run: CHROME_PATH=$(npx @puppeteer/browsers install chrome@stable --path $(realpath ./tmp) | awk '{print $2}') npm run build
3939
env:
4040
# Please update URL if you want to use custom domain
4141
URL: https://${{ github.event.repository.owner.name }}.github.io/${{ github.event.repository.name }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
public
2+
/tmp
23

34
# Created by https://www.gitignore.io/api/node,windows,macos,linux,sublimetext,emacs,vim,visualstudiocode
45

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.14.1
1+
18.16.1

marp.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

marp.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const canonicalUrl = process.env.URL || undefined
2+
3+
/** @type {import('@marp-team/marp-cli').Config} */
4+
const config = {
5+
allowLocalFiles: true,
6+
ogImage: (() => {
7+
if (canonicalUrl) return `${canonicalUrl}/og-image.jpg`
8+
if (process.env.VERCEL_URL)
9+
return `https://${process.env.VERCEL_URL}/og-image.jpg`
10+
11+
return undefined
12+
})(),
13+
themeSet: 'themes',
14+
url: canonicalUrl,
15+
}
16+
17+
export default config

netlify.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[build]
22
publish = "public"
3-
# NOTE: If pasting this command into the Netlify UI, remove the \ prior to the quotation marks, as they don't need to be escaped in that situation.
4-
command = "npm i puppeteer --no-save && CHROME_PATH=$(node -e \"console.log(require('puppeteer').executablePath())\") npm run build"
3+
command = "CHROME_PATH=$(npx @puppeteer/browsers install chrome@stable --path $(realpath ./tmp) | awk '{print $2}') npm run build"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"deck": "marp --no-stdin PITCHME.md -o public/index.html && ncp assets public/assets",
1010
"og-image": "marp --no-stdin PITCHME.md -o public/og-image.jpg",
1111
"start": "marp -ps .",
12-
"vercel-build": "npm i puppeteer --no-save && MARP_USER=root CHROME_PATH=$(node -e \"console.log(require('puppeteer').executablePath())\") npm run build"
12+
"vercel-build": "MARP_USER=root CHROME_PATH=$(npx @puppeteer/browsers install chrome@stable --path $(realpath ./tmp) | awk '{print $2}') npm run build"
1313
},
1414
"devDependencies": {
1515
"@marp-team/marp-cli": "^3.1.0",

0 commit comments

Comments
 (0)