UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

22 lines (20 loc) 715 B
import path from 'path'; import fs from 'fs'; export function findPathToScopeHash(filePath) { const parts = filePath.split(path.sep); parts.pop(); const isAbsolute = filePath.startsWith(path.sep); let currentPath = isAbsolute ? path.sep : parts[0]; for (let i = isAbsolute ? 1 : 1; i < parts.length; i++) { currentPath = path.join(currentPath, parts[i]); const scopeHashPath = path.join(currentPath, 'scope-hash.txt'); if (fs.existsSync(scopeHashPath)) { return currentPath; } } return null; } export function getScopeHashFromFile(scopeHashFromFile) { return fs.readFileSync(path.join(scopeHashFromFile, 'scope-hash.txt'), 'utf-8'); } //# sourceMappingURL=plugin-utils.js.map