@react-native-community/cli-tools
Advanced tools
Comparing version 12.1.1 to 12.2.0
type CacheKey = 'eTag' | 'lastChecked' | 'latestVersion' | 'dependencies'; | ||
/** | ||
* Returns the path string of `$HOME/.react-native-cli`. | ||
* | ||
* In case it doesn't exist, it will be created. | ||
*/ | ||
declare function getCacheRootPath(): string; | ||
declare function removeProjectCache(name: string): void; | ||
declare function get(name: string, key: CacheKey): string | undefined; | ||
@@ -7,4 +14,6 @@ declare function set(name: string, key: CacheKey, value: string): void; | ||
set: typeof set; | ||
removeProjectCache: typeof removeProjectCache; | ||
getCacheRootPath: typeof getCacheRootPath; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=cacheManager.d.ts.map |
@@ -35,2 +35,9 @@ "use strict"; | ||
} | ||
function _chalk() { | ||
const data = _interopRequireDefault(require("chalk")); | ||
_chalk = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _logger = _interopRequireDefault(require("./logger")); | ||
@@ -78,2 +85,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
} | ||
function removeProjectCache(name) { | ||
const cacheRootPath = getCacheRootPath(); | ||
try { | ||
const fullPath = _path().default.resolve(cacheRootPath, name); | ||
if (_fs().default.existsSync(fullPath)) { | ||
_fs().default.rmSync(fullPath, { | ||
recursive: true | ||
}); | ||
} | ||
} catch { | ||
_logger.default.error(`Failed to remove cache for ${name}. If you experience any issues when running freshly initialized project, please remove the "${_chalk().default.underline(_path().default.join(cacheRootPath, name))}" folder manually.`); | ||
} | ||
} | ||
function get(name, key) { | ||
@@ -95,3 +115,5 @@ const cache = loadCache(name); | ||
get, | ||
set | ||
set, | ||
removeProjectCache, | ||
getCacheRootPath | ||
}; | ||
@@ -98,0 +120,0 @@ exports.default = _default; |
{ | ||
"name": "@react-native-community/cli-tools", | ||
"version": "12.1.1", | ||
"version": "12.2.0", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@react-native-community/cli-types": "12.1.1", | ||
"@react-native-community/cli-types": "12.2.0", | ||
"@types/lodash": "^4.14.149", | ||
@@ -41,3 +41,3 @@ "@types/mime": "^2.0.1", | ||
}, | ||
"gitHead": "a45a2d92c3d53dcb0cf7ba8be4860ad75ff06702" | ||
"gitHead": "f30a010c3036b04f2bd5430a27586472466082a8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
195983
2180