Skip to content

Commit

Permalink
refacto cache path fetching using scarb cache path
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Aug 13, 2023
1 parent 67ef98b commit 28177b7
Show file tree
Hide file tree
Showing 5 changed files with 1,947 additions and 1,990 deletions.
51 changes: 8 additions & 43 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59286,35 +59286,6 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __nccwpck_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __nccwpck_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __nccwpck_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
Expand Down Expand Up @@ -59348,10 +59319,8 @@ var lib_exec = __nccwpck_require__(1514);
var lib_glob = __nccwpck_require__(8090);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
var external_os_default = /*#__PURE__*/__nccwpck_require__.n(external_os_);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(1017);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
;// CONCATENATED MODULE: ./lib/cache-utils.js


Expand All @@ -59364,20 +59333,16 @@ const State = {
CacheMatchedKey: "matched_key",
};

function getCacheDirectory() {
const platform = external_os_default().platform();
const home = process.env.HOME;
async function getCacheDirectory() {
const { stdout, exitCode } = await lib_exec.getExecOutput("scarb cache path");

switch (platform) {
case "linux":
return external_path_default().join(home, ".cache/scarb");
case "darwin":
return external_path_default().join(home, `Library/Caches/com.swmansion.scarb`);
case "win32":
return external_path_default().join(process.env.APPDATA, "swmansion/scarb/config");
default:
throw new Error(`caching is not available on this platform: ${platform}`);
if (exitCode > 0) {
throw new Error(
"failed to find cache path: command `scarb cache path` failed",
);
}

return stdout.trim();
}

async function getCacheKey() {
Expand Down
2 changes: 1 addition & 1 deletion dist/cache-save/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 28177b7

Please sign in to comment.