-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Previews: support creating thumbnails and full-height screenshots #312
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8434842
allow scaled thumbnails
ryantxu 44939a8
added support for full page images
ArturWierzbicki 402223b
add `acceptBeforeUnload` handler
ArturWierzbicki 72f315d
use png files
ryantxu 1bcb5c6
produce requested thumbnail size
ryantxu 35d9eef
Update src/browser/browser.ts
ArturWierzbicki b845641
review fix: move variable away from misleading comment
ArturWierzbicki 7cb0a4c
review fix: added default `headed` option to the default and dev env …
ArturWierzbicki 1369770
review fix: removed ternary expression
ArturWierzbicki fc308a3
review fix: remove `withFullPageViewport`
ArturWierzbicki efa7e73
review fix: fixed full page screenshots for non-kiosk mode
ArturWierzbicki aa56dcb
add script downloading platform-specific sharp binary
ArturWierzbicki 8fe5525
update yarnlock
ArturWierzbicki bc6f4af
fix package_Target script
ArturWierzbicki f01214f
update circleci node version
ArturWierzbicki 23ae8ad
update package json
ArturWierzbicki 9310287
fix package.json -> pkg.assets paths
ArturWierzbicki ab07b2d
downgrade pkg to fix sharp build issue
ArturWierzbicki abd24d0
working m1 (#318)
ArturWierzbicki 7f176e0
replace `mkdir -p` with `fs.mkdirSync {recursive: true}`
ArturWierzbicki 57b8115
Merge branch 'scaled-thumb-result' of https://github.com/grafana/graf…
ArturWierzbicki cd6f79e
Update scripts/download_sharp.js
ArturWierzbicki e5bf620
Update scripts/download_sharp.js
ArturWierzbicki 4bcf42a
Update scripts/package_target.sh
ArturWierzbicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,5 @@ dist/**/* | |
|
||
# Ignore output from coverage report | ||
coverage | ||
|
||
scripts/sharp-downloader |
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
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,42 @@ | ||
const child_process = require('child_process'); | ||
const fs = require('fs') | ||
|
||
const archArg = process.argv[2]; | ||
|
||
// https://sharp.pixelplumbing.com/install#cross-platform | ||
const [ | ||
platform, // linux, darwin, win32 | ||
arch // x64, ia32, arm, arm64 | ||
] = archArg.split('-'); | ||
|
||
const packageJson = JSON.parse(fs.readFileSync('./package.json')) | ||
|
||
const packageName = 'sharp'; | ||
const packageVersion = Object.entries(packageJson.dependencies).find(([depName]) => depName === packageName)[1] | ||
|
||
console.log(`Found ${packageName} with version ${packageVersion}`) | ||
|
||
const targetNodeModules = './node_modules' | ||
const currentSharp = `${targetNodeModules}/sharp` | ||
const sharpDownloader = './scripts/sharp-downloader' | ||
|
||
if(!fs.existsSync(sharpDownloader)) { | ||
fs.mkdirSync(sharpDownloader) | ||
} | ||
|
||
fs.writeFileSync(`${sharpDownloader}/package.json`, JSON.stringify({ | ||
"name": "sharp-downloader", | ||
"dependencies": { | ||
[packageName]: packageVersion | ||
} | ||
} | ||
)) | ||
|
||
const downloadedSharp = `${sharpDownloader}/node_modules/sharp` | ||
|
||
try { | ||
child_process.execSync(`cd ${sharpDownloader} && npm install --platform=${platform} --arch=${arch}`, {stdio: 'inherit'}) | ||
child_process.execSync(`rm -rf ${currentSharp} && cp -RP ${downloadedSharp} ${targetNodeModules}`); | ||
} finally { | ||
fs.rmSync(sharpDownloader, {recursive: true, force: true}) | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AgnesToulet what is the process for documenting the changes here?
The behavior changes are:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for the image renderer is in the grafana repo: https://github.com/grafana/grafana/blob/main/docs/sources/image-rendering but we don't really have documentation on how to call the image renderer (more on how to configure and run it).
I guess we could add a section in the main file or a new file for that. @achatterjee-grafana Do you have any opinion on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good @AgnesToulet. Let me know if you need any help.