Skip to content

Commit

Permalink
fix: canSkipSeed consider non-zero number as true
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Oct 19, 2023
1 parent 105af60 commit fa12b94
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/shared-lib-node/src/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> {
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))
);
}

/**
Expand Down

0 comments on commit fa12b94

Please sign in to comment.