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

Make cache directory configurable #717

Merged
merged 2 commits into from
Mar 18, 2022
Merged

Make cache directory configurable #717

merged 2 commits into from
Mar 18, 2022

Conversation

UiP9AV6Y
Copy link
Contributor

Pull Request

Read the cache directory from the environment, falling back to
a location under N_PREFIX

Problem

fixes #715

Solution

Initialize the cache directory variable in a similar fashion
as N_PREFIX

npm.taobao.org is now redirect to npmmirror.com, use the new URL instead.
@shadowspawn
Copy link
Collaborator

Nice work adding a test to go with the feature.

I think this would be tidier with N_CACHE_PREFIX matching N_PREFIX, and the n/versions getting added onto that as before. Exposing the internal CACHE_DIR directly has exported a directory from deeper in the n controlled folder, so for example can't add another folder beside "versions" in future. The internal CACHE_DIR can then be constructed much as before.

Simple story:

  • N_PREFIX defaults to /usr/local
  • N_CACHE_PREFIX defaults to $N_PREFIX

@UiP9AV6Y
Copy link
Contributor Author

i agree with the point about the lack of extendability in the future. i have implemented the changes based on your
suggestion.

Read the cache directory from the environment, falling back to
a location under `N_PREFIX`

fixes #715
@shadowspawn
Copy link
Collaborator

Looks good. I'll read again carefully and do some local testing before merging.

@shadowspawn shadowspawn changed the base branch from master to develop March 18, 2022 04:51
@shadowspawn shadowspawn merged commit e1b5795 into tj:develop Mar 18, 2022
@shadowspawn shadowspawn added pending release Merged into a branch for a future release, but not released yet and removed pending release Merged into a branch for a future release, but not released yet labels Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make cache dir configurable
2 participants