From e047bf3737f4128a5adbcc387bdb48f953f08e66 Mon Sep 17 00:00:00 2001 From: Michael Yali Date: Fri, 22 Oct 2021 15:19:35 +0300 Subject: [PATCH] fix(build): cache checker --- lib/bin/mrepo.js | 0 lib/helpers/hash-check.helper.js | 3 ++- lib/helpers/hash-check.helper.js.map | 2 +- src/helpers/hash-check.helper.ts | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 lib/bin/mrepo.js diff --git a/lib/bin/mrepo.js b/lib/bin/mrepo.js old mode 100644 new mode 100755 diff --git a/lib/helpers/hash-check.helper.js b/lib/helpers/hash-check.helper.js index d2daf54..29abdad 100644 --- a/lib/helpers/hash-check.helper.js +++ b/lib/helpers/hash-check.helper.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.saveCache = exports.hasCached = void 0; +const util_1 = require("@nestled/util"); const folder_hash_1 = require("folder-hash"); const fs_extra_1 = require("fs-extra"); const path_1 = require("path"); @@ -11,7 +12,7 @@ async function hasCached(workspaceName, packageName) { const savedCache = cacheFile[packageName] || {}; const paths = getPaths(workspaceName, packageName); const hashes = await getHashes(paths); - return savedCache.src === hashes.src && savedCache.lib === hashes.lib; + return savedCache.src === hashes.src && savedCache.lib === hashes.lib && util_1.isString(hashes.lib); } exports.hasCached = hasCached; async function saveCache(workspaceName, packageName) { diff --git a/lib/helpers/hash-check.helper.js.map b/lib/helpers/hash-check.helper.js.map index e8bc8c9..b86d36a 100644 --- a/lib/helpers/hash-check.helper.js.map +++ b/lib/helpers/hash-check.helper.js.map @@ -1 +1 @@ -{"version":3,"file":"hash-check.helper.js","sourceRoot":"","sources":["../../src/helpers/hash-check.helper.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,uCAA2D;AAC3D,+BAA4B;AAC5B,4CAA2E;AAG3E,MAAM,0BAA0B,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,2BAAe,EAAE,sCAA0B,CAAC,CA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AAM,mBAAQ,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtF,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,oBAAS,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO,EAAE,CAAC;KACX;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,yBAAW,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;KACnB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,KAAmC;IAC1D,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC"} \ No newline at end of file +{"version":3,"file":"hash-check.helper.js","sourceRoot":"","sources":["../../src/helpers/hash-check.helper.ts"],"names":[],"mappings":";;;AAAA,wCAAyC;AACzC,6CAA0C;AAC1C,uCAA2D;AAC3D,+BAA4B;AAC5B,4CAA2E;AAG3E,MAAM,0BAA0B,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,2BAAe,EAAE,sCAA0B,CAAC,CAAC;AAE7F,KAAK,UAAU,SAAS,CAAC,aAAqB,EAAE,WAAmB;IACxE,MAAM,SAAS,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAChD,MAAM,UAAU,GAAsB,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACnE,MAAM,KAAK,GAAG,QAAQ,CAAC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AChD,OAAO,EAAE,CAAC;KACX;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,yBAAW,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;KACnB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,KAAmC;IAC1D,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/src/helpers/hash-check.helper.ts b/src/helpers/hash-check.helper.ts index 1376b94..8ce7189 100644 --- a/src/helpers/hash-check.helper.ts +++ b/src/helpers/hash-check.helper.ts @@ -1,3 +1,4 @@ +import { isString } from '@nestled/util'; import { hashElement } from 'folder-hash'; import { ensureFile, readJson, writeJson } from 'fs-extra'; import { join } from 'path'; @@ -12,7 +13,7 @@ export async function hasCached(workspaceName: string, packageName: string): Pro const paths = getPaths(workspaceName, packageName); const hashes = await getHashes(paths); - return savedCache.src === hashes.src && savedCache.lib === hashes.lib; + return savedCache.src === hashes.src && savedCache.lib === hashes.lib && isString(hashes.lib); } export async function saveCache(workspaceName: string, packageName: string) {