-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
798 additions
and
1,260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { readdir, readFile } from 'fs/promises' | ||
import { dirname, join } from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)) | ||
|
||
const packages = [] | ||
|
||
const packagesPath = join(__dirname, '../../packages') | ||
|
||
for (const packagePath of await readdir(packagesPath)) { | ||
const pkg = join(packagesPath, packagePath, 'package.json') | ||
const { name } = JSON.parse(await readFile(pkg)) | ||
packages.push(name) | ||
} | ||
|
||
console.log(`{"package":${JSON.stringify(packages)}}`) | ||
|
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,46 @@ | ||
<!DOCTYPE html> | ||
<html><head> | ||
<title>Example Domain</title> | ||
|
||
<meta charset="utf-8"> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<style type="text/css"> | ||
body { | ||
background-color: #f0f0f2; | ||
margin: 0; | ||
padding: 0; | ||
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
|
||
} | ||
div { | ||
width: 600px; | ||
margin: 5em auto; | ||
padding: 2em; | ||
background-color: #fdfdff; | ||
border-radius: 0.5em; | ||
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02); | ||
} | ||
a:link, a:visited { | ||
color: #38488f; | ||
text-decoration: none; | ||
} | ||
@media (max-width: 700px) { | ||
div { | ||
margin: 0 auto; | ||
width: auto; | ||
} | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div> | ||
<h1>Example Domain</h1> | ||
<p>This domain is for use in illustrative examples in documents. You may use this | ||
domain in literature without prior coordination or asking for permission.</p> | ||
<p><a href="https://www.iana.org/domains/example">More information...</a></p> | ||
</div> | ||
|
||
|
||
</body></html> |
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,28 @@ | ||
'use strict' | ||
|
||
const createBrowser = require('browserless') | ||
const path = require('path') | ||
|
||
const remoteBrowser = createBrowser() | ||
|
||
const optimizeForSpeed = process.argv[2] === 'true' | ||
|
||
const fileUrl = `file://${path.join(__dirname, './fixtures/example.html')}` | ||
|
||
/** | ||
* Run: | ||
* $ hyperfine -L optimizeForSpeed false,true 'node src/screenshot/speed.js {optimizeForSpeed}' | ||
*/ | ||
const main = async () => { | ||
const browserless = await remoteBrowser.createContext() | ||
await browserless.screenshot(fileUrl, { optimizeForSpeed }) | ||
await browserless.destroyContext() | ||
await remoteBrowser.close() | ||
} | ||
|
||
main() | ||
.then(remoteBrowser.close) | ||
.catch(error => { | ||
console.log(error) | ||
process.exit(1) | ||
}) |
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
Oops, something went wrong.