-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add hasher implementation info in
nx report
(#16261)
- Loading branch information
Showing
3 changed files
with
59 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { NativeFileHasher } from '../hasher/native-file-hasher'; | ||
import { workspaceRoot } from './workspace-root'; | ||
|
||
import { execSync } from 'child_process'; | ||
import { existsSync } from 'fs'; | ||
import { join } from 'path'; | ||
|
||
export enum HasherImplementation { | ||
Native = 'Native', | ||
Git = 'Git', | ||
Node = 'Node', | ||
} | ||
|
||
export function getHashingImplementation() { | ||
try { | ||
if ( | ||
(!process.env.NX_NON_NATIVE_HASHER || | ||
process.env.NX_NON_NATIVE_HASHER != 'true') && | ||
NativeFileHasher.available() | ||
) { | ||
return HasherImplementation.Native; | ||
} | ||
|
||
execSync('git rev-parse --is-inside-work-tree', { | ||
stdio: 'ignore', | ||
windowsHide: true, | ||
}); | ||
|
||
// we don't use git based hasher when the repo uses git submodules | ||
if (!existsSync(join(workspaceRoot, '.git', 'modules'))) { | ||
return HasherImplementation.Git; | ||
} else { | ||
return HasherImplementation.Node; | ||
} | ||
} catch { | ||
return HasherImplementation.Node; | ||
} | ||
} |
cfaf649
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev
nx-five.vercel.app