generated from PaleBluDot/e11ty
-
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.
fix(data): combine data into a file that does it automagically
- Loading branch information
1 parent
b44c56a
commit 3bd49b1
Showing
2 changed files
with
32 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
const affiliationsDir = path.join(__dirname, "affiliations"); | ||
const files = fs.readdirSync(affiliationsDir); | ||
|
||
let combinedData = {}; | ||
|
||
files.forEach((file) => { | ||
const filePath = path.join(affiliationsDir, file); | ||
const data = require(filePath); | ||
const affiliation = path.basename(file, path.extname(file)); // get filename without extension | ||
combinedData[affiliation] = data; | ||
}); | ||
|
||
module.exports = combinedData; |
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