Skip to content
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

build: allow to customize tmpdir #7243

Merged
merged 23 commits into from Sep 23, 2021
Merged

build: allow to customize tmpdir #7243

merged 23 commits into from Sep 23, 2021

Conversation

Kikobeats
Copy link
Contributor

@Kikobeats Kikobeats commented May 16, 2021

Hello,

This change allows customizing the directory for temporary files, setting up the current behavior as default.

I'm particularly interested in this change because I want to use a memory filesystem (memfs) to speed up a bit the puppeteer process.

@google-cla google-cla bot added the cla: yes label May 16, 2021
@Kikobeats
Copy link
Contributor Author

hum checks are failing for a non related thing.

Copy link
Member

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option is named tmpdir but it should be tmpDir to match the casing convention.

If we want to do this then introducing an environment variable like PUPPETEER_TMP_DIR seems like a cleaner option.

The patch would also need to include a test and the relevant changes to documentation. WDYT?

@Kikobeats
Copy link
Contributor Author

ops, fixed the camel case naming 🙂

I'm not sure about PUPPETEER_TMP_DIR because it's limiting the possibility to use a function where the path can change over time, rather than a static string.

@mathiasbynens
Copy link
Member

I'm not sure about PUPPETEER_TMP_DIR because it's limiting the possibility to use a function where the path can change over time, rather than a static string.

If the path changes over time and your code knows about it, can't you have it update the PUPPETEER_TMP_DIR env var accordingly?

@Kikobeats
Copy link
Contributor Author

you're right; I'm assuming os.tmpdir() will return a different path every time, but it looks like constant value:

Screen Shot 2021-05-17 at 11 06 05

let me do the code changes for a new environment variable 🙂

@Kikobeats
Copy link
Contributor Author

@mathiasbynens done at 083ea5f

Do you think it could be moved into a common, so it just could be declared once?

@Kikobeats Kikobeats mentioned this pull request Jun 1, 2021
8 tasks
danpark-salesforce and others added 2 commits June 4, 2021 10:25
This commit adds drag-and-drop support, leveraging new additions to the CDP
Input domain (Input.setInterceptDrags, Input.dispatchDragEvent, and
Input.dragIntercepted).
@Kikobeats
Copy link
Contributor Author

@mathiasbynens Can I do something to move this PR forward? 🙂

@mathiasbynens
Copy link
Member

The diff seems to include lots of unrelated changes. Could you please check?

@Kikobeats
Copy link
Contributor Author

@mathiasbynens updated 👍

src/node/Launcher.ts Outdated Show resolved Hide resolved
@Kikobeats
Copy link
Contributor Author

@mathiasbynens all green now 🙂

experimental/puppeteer-firefox/lib/Launcher.js Outdated Show resolved Hide resolved
docs/api.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jschfflr jschfflr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you maybe move the implementation of const tmpDir = () => process.env.PUPPETEER_TMP_DIR || os.tmpdir(); into a separate file like helpers.ts or something similar to reduce code duplication?

@Kikobeats
Copy link
Contributor Author

Could you maybe move the implementation of const tmpDir = () => process.env.PUPPETEER_TMP_DIR || os.tmpdir(); into a separate file like helpers.ts or something similar to reduce code duplication?

I want to do that, experimental/puppeteer-firefox/lib/Launcher.js is CJS and src/node/Launcher.ts is ESM.

I guess I can't just create a file that can be loaded on both parts; am I wrong?

@jschfflr
Copy link
Contributor

Could you maybe move the implementation of const tmpDir = () => process.env.PUPPETEER_TMP_DIR || os.tmpdir(); into a separate file like helpers.ts or something similar to reduce code duplication?

I want to do that, experimental/puppeteer-firefox/lib/Launcher.js is CJS and src/node/Launcher.ts is ESM.

I guess I can't just create a file that can be loaded on both parts; am I wrong?

Ah sorry, I didn't see that one is for Firefox and one in src. In this case, I think this change looks good!

@Kikobeats
Copy link
Contributor Author

@jschfflr @mathiasbynens any chance to merge this? it's already approved and tests pass on green 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants