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