mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 00:28:33 +00:00
19 lines
456 B
TypeScript
19 lines
456 B
TypeScript
import { createHash } from 'node:crypto';
|
|
import type { BuildFlags } from '@affine/cli/config';
|
|
|
|
export function hash(content: string): string {
|
|
const hash = createHash('sha512');
|
|
hash.update(content);
|
|
const pkgHash = hash.digest('hex');
|
|
return pkgHash.substring(0, 8);
|
|
}
|
|
|
|
export function computeCacheKey(buildFlags: BuildFlags) {
|
|
return [
|
|
'1',
|
|
'node' + process.version,
|
|
buildFlags.mode,
|
|
buildFlags.distribution,
|
|
].join('-');
|
|
}
|