-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
22 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,12 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
/** | ||
* Get the version from the package.json file. | ||
* @returns {string} The version. | ||
*/ | ||
export function getVersion() { | ||
const packageJsonPath = path.join(process.cwd(), 'package.json'); | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); | ||
return packageJson.version; | ||
} |
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,16 @@ | ||
import path from 'path'; | ||
import { getCSVInfo } from './csv/csvHandler.js'; | ||
import { parseCSVEntries } from './csv/parseCsvEntriesToJson.js'; | ||
|
||
/** | ||
* @param {string} dataFolder | ||
*/ | ||
export async function readAndParseCSVs(dataFolder) { | ||
const { allCsv, dateString } = await getCSVInfo(dataFolder); | ||
const dictionaryEntries = await parseCSVEntries( | ||
path.join(dataFolder, allCsv) | ||
); | ||
console.log(`Found ${dictionaryEntries.length} entries.`); | ||
|
||
return { dictionaryEntries, dateString }; | ||
} |