()
| 1959 | * Get app current version |
| 1960 | */ |
| 1961 | export const getAppVersion = async () => { |
| 1962 | const getPackageJsonPath = (): string => { |
| 1963 | const checkPaths = [ |
| 1964 | path.join(__dirname, '..', 'package.json'), |
| 1965 | path.join(__dirname, '..', '..', 'package.json'), |
| 1966 | path.join(__dirname, '..', '..', '..', 'package.json'), |
| 1967 | path.join(__dirname, '..', '..', '..', '..', 'package.json'), |
| 1968 | path.join(__dirname, '..', '..', '..', '..', '..', 'package.json') |
| 1969 | ] |
| 1970 | for (const checkPath of checkPaths) { |
| 1971 | if (fs.existsSync(checkPath)) { |
| 1972 | return checkPath |
| 1973 | } |
| 1974 | } |
| 1975 | return '' |
| 1976 | } |
| 1977 | |
| 1978 | const packagejsonPath = getPackageJsonPath() |
| 1979 | if (!packagejsonPath) return '' |
| 1980 | try { |
| 1981 | const content = await fs.promises.readFile(packagejsonPath, 'utf8') |
| 1982 | const parsedContent = JSON.parse(content) |
| 1983 | return parsedContent.version |
| 1984 | } catch (error) { |
| 1985 | return '' |
| 1986 | } |
| 1987 | } |
| 1988 | |
| 1989 | export const convertToValidFilename = (word: string) => { |
| 1990 | return word |
no test coverage detected