Skip to content

Change temp directory #723

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

Closed
harryhorton opened this issue Aug 10, 2018 · 3 comments
Closed

Change temp directory #723

harryhorton opened this issue Aug 10, 2018 · 3 comments
Labels
type: feature request Request to add a new feature version: next Planned to do or already included in the next(1.0.0) version

Comments

@harryhorton
Copy link

Feature request

Enable users to change the location of the .temp directory for the build process.

What problem does this feature solve?

I'm attempting to run VuePress within Google Cloud functions where the node_modules folder is readonly. Based on the errors I'm getting, it looks like VuePress is attempting to make use of a temp directory within node_modules, rather than in the src or dist locations.

What does the proposed API look like?

For the cli vuepress build --dist .vuepress/dist --temp /tmp/vuepresstemp /tmp/client/

Though an extra configuration option would be helpful as well.

How should this be implemented in your opinion?

Are you willing to work on this yourself?**

With some general direction, I'd be happy to make a PR.

@ulivz ulivz added the type: feature request Request to add a new feature label Aug 11, 2018
@meteorlxy
Copy link
Member

If this feature is approved, we can make some modification based on #354 to achieve it

@ycmjason
Copy link
Contributor

👍

I think it makes perfect sense to use an OS temp directory. Is there any reason why we haven't been using it?

Instead of /tmp, perhaps we can use os.tmpdir().

@harryhorton
Copy link
Author

To be clear about my intentions, I'm attempting to build in cloud functions pulling .md content from firestore as a weird sort of compiled CMS experiement. The compiled files can then either be pushed to hosting, or to storage with hosting rules to points to the files.

I was able to get it to work by:

  • copying /srv/node_modules/vuepress to /tmp/alt_modules/vuepress.
  • Creating a symlink for /tmp/node_modules to /srv/node_modules //the real one
  • Running build from node /tmp/alt_modules/vuepress/bin/vuepress.js build /tmp/client

This allowed me to use vuepress in a writable directory while still using the installed node packages (node will walk up directories until it finds a node_modules folder and use packages from there).

None of that would be necessary if we could explicitly control the temp directory for VuePress.

@ulivz ulivz added the version: next Planned to do or already included in the next(1.0.0) version label Aug 20, 2018
0az added a commit to 0az/vuepress that referenced this issue Jun 1, 2020
This ensures that the defaults work under read-only node_modules. This
is the case in certain runtime environments (vuejs#723) as well as under Yarn
v2's Plug'n'Play (aka PNP).
0az added a commit to 0az/vuepress that referenced this issue Jun 1, 2020
This ensures that the defaults work under read-only node_modules. This
is the case in certain runtime environments (vuejs#723) as well as under Yarn
v2's Plug'n'Play (PNP).

This commit also implements best-effort cleanup of any such temporary
directories on process exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Request to add a new feature version: next Planned to do or already included in the next(1.0.0) version
Projects
None yet
Development

No branches or pull requests

4 participants