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

[7.0] Default babel-register cache location to node_modules #5198

Closed
6 tasks
hzoo opened this issue Jan 24, 2017 · 10 comments
Closed
6 tasks

[7.0] Default babel-register cache location to node_modules #5198

hzoo opened this issue Jan 24, 2017 · 10 comments
Labels
claimed good first issue Has PR outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: register
Milestone

Comments

@hzoo
Copy link
Member

hzoo commented Jan 24, 2017

why: easier to find since it's in node_modules, easy to clear all cache for all the tools that use it.

Move register cache file location to ./node_modules/.cache/babel-register via

https://github.com/avajs/find-cache-dir

Ref previous babel-loader PR: https://github.com/babel/babel-loader/pull/301/files as well as the current file (https://github.com/babel/babel-loader/blob/e9e37029e0c5905d8846f69d9a0c348f3d49fe50/src/fs-cache.js#L170), https://github.com/babel/babel-loader/pull/318/files


  • Comment below you are going to do this (for others to know)
  • Read CONTRIBUTING.md (make sure you have yarn, and are on at least node 4)
  • Check you are on 7.0 branch with git checkout 7.0 and then make a branch off of that to PR
  • remember to run make build after a source code change or better just run make watch in another terminal window to auto run babel while you are developing
  • Default to findCacheDir({ name: "babel-register" }) and fallback to os/home/tmp dir.
  • if there are already tests setup for that package, write another test (otherwise we'll do it or help)
@shubheksha
Copy link
Contributor

I'll take this one!

@shubheksha
Copy link
Contributor

What about the BABEL_CACHE_PATH variable? Currently the default with the fall back being implemented as a JSON file. Will that logic be removed completely?
https://github.com/babel/babel/blob/master/packages/babel-register/src/cache.js#L6

@shubheksha
Copy link
Contributor

Also, I guess I'll have to write a couple of tests for this package? I couldn't find any in it's folder. I'd appreciate any guidelines to get started.

@xtuc
Copy link
Member

xtuc commented Feb 5, 2017

I think the cache location should still be overridable (BABEL_CACHE_PATH).

I tried to add some tests (there).

@shubheksha
Copy link
Contributor

@xtuc & @hzoo, does this look right?
var FILENAME = process.env.BABEL_CACHE_PATH || findCacheDir({ name: 'babel-register' }) || os.tmpdir();

I'll wait for #5260 to land before writing tests for this patch.

@hzoo
Copy link
Member Author

hzoo commented Feb 6, 2017

Yeah 👍 (dono if we really want to support BABEL_CACHE_PATH anymore but just so it's one less thing to break we could keept it).

@xtuc
Copy link
Member

xtuc commented Feb 8, 2017

@shubheksha The PR has been merged. Don't hesitate to tell me if anything is wrong with the tests.

@aaronang
Copy link
Member

What is the current status of this issue?

@pwmckenna
Copy link
Contributor

@shubheksha don't mean to step on your toes if you're still working on this. feel free to just close this pr, but its been a while and seemed simple enough that I thought I'd just make the PR. Not sure how this fits in with the long term cache plans, but would be a nice intermediate change.

@xtuc
Copy link
Member

xtuc commented Apr 27, 2017

The config caching has a bit changed. @loganfsmyth worked on it.

See #5608 for ex.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
claimed good first issue Has PR outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: register
Projects
None yet
Development

No branches or pull requests

7 participants