Move cache directory to node_modules (#167)

* Move cache directory to node_modules

* Use find-cache-dir to find .cache in node_modules
This commit is contained in:
Nick McCurdy 2019-08-28 19:26:05 -04:00 committed by Eugene Zolenko
parent afaf7140fd
commit ffda2e539b
5 changed files with 334 additions and 234 deletions

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
/node_modules
/npm-debug.log
/typings
/.rpt2_cache
/.vscode
/.idea
/build-self

View File

@ -134,9 +134,9 @@ See [#108](https://github.com/ezolenko/rollup-plugin-typescript2/issues/108)
Set to true for clean build (wipes out cache on every build).
* `cacheRoot`: `./.rts2_cache`
* `cacheRoot`: `node_modules/.cache/rollup-plugin-typescript2`
Path to cache. Defaults to a folder in the current directory. Can be safely moved out with something like `${require('temp-dir')}/.rpt2_cache`, but watch out for multiple concurrent builds of the same repo.
Path to cache. Defaults to a folder in node_modules.
* `include`: `[ "*.ts+(|x)", "**/*.ts+(|x)" ]`

558
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
"lint": "tslint -c ./tslint.json src/*.ts ./*.js"
},
"dependencies": {
"find-cache-dir": "^3.0.0",
"fs-extra": "8.1.0",
"resolve": "1.11.1",
"rollup-pluginutils": "2.8.1",
@ -40,6 +41,7 @@
},
"devDependencies": {
"@types/colors": "1.2.1",
"@types/find-cache-dir": "^2.0.0",
"@types/fs-extra": "8.0.0",
"@types/graphlib": "2.1.5",
"@types/lodash": "4.14.136",

View File

@ -15,6 +15,7 @@ import { blue, red, yellow, green } from "colors/safe";
import { dirname, isAbsolute, join, relative } from "path";
import { normalize } from "./normalize";
import { satisfies } from "semver";
import findCacheDir from 'find-cache-dir';
import { PluginImpl, PluginContext, InputOptions, OutputOptions, TransformSourceDescription, MinimalPluginContext } from "rollup";
import { createFilter } from "./get-options-overrides";
@ -49,7 +50,7 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
check: true,
verbosity: VerbosityLevel.Warning,
clean: false,
cacheRoot: `${process.cwd()}/.rpt2_cache`,
cacheRoot: findCacheDir({ name: "rollup-plugin-typescript2" }),
include: ["*.ts+(|x)", "**/*.ts+(|x)"],
exclude: ["*.d.ts", "**/*.d.ts"],
abortOnError: true,