From fa12b94638b24ebaedde8a9cbac46557e1761473 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Thu, 19 Oct 2023 22:49:03 +0900 Subject: [PATCH] fix: canSkipSeed consider non-zero number as true --- packages/shared-lib-node/src/hash.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/shared-lib-node/src/hash.ts b/packages/shared-lib-node/src/hash.ts index 374fde3d..10cc54eb 100644 --- a/packages/shared-lib-node/src/hash.ts +++ b/packages/shared-lib-node/src/hash.ts @@ -4,14 +4,17 @@ import path from 'node:path'; /** * Check whether seed command can be skipped or not and update hash file if needed. - * Note that process.env.ALLOW_TO_SKIP_SEED should be set to '1' or 'true' to skip seed. + * Note that process.env.ALLOW_TO_SKIP_SEED should be set to non-zero number or 'true' to skip seed. * @param hashFilePath Path to the hash file. * @param paths Paths to the files or directories. * @returns Whether seed command can be skipped. */ export async function canSkipSeed(hashFilePath: string, ...paths: string[]): Promise { - if (process.env.ALLOW_TO_SKIP_SEED !== '1' && process.env.ALLOW_TO_SKIP_SEED !== 'true') return false; - return !(await updateHashFromFiles(hashFilePath, ...paths)); + return ( + !!Number(process.env.ALLOW_TO_SKIP_SEED) || + (process.env.ALLOW_TO_SKIP_SEED || '').toLowerCase() === 'true' || + !(await updateHashFromFiles(hashFilePath, ...paths)) + ); } /**