-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from marp-team/preview-on-macos-catalina
Support preview mode in macOS Catalina
- Loading branch information
Showing
6 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as chromeFinder from 'chrome-launcher/dist/chrome-finder' | ||
|
||
let cachedPath: string | undefined | false = false | ||
|
||
export default function findChrome() { | ||
if (cachedPath === false) { | ||
const finder: (() => string[]) | undefined = (() => { | ||
// Use already known path within Marp CLI official Docker image | ||
if (process.env.IS_DOCKER) return () => ['/usr/bin/chromium-browser'] | ||
|
||
// Use Chrome installed to Windows within WSL | ||
if (require('is-wsl')) return chromeFinder.wsl | ||
|
||
return chromeFinder[process.platform] | ||
})() | ||
|
||
cachedPath = finder ? finder()[0] : undefined | ||
} | ||
return cachedPath | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters