forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(script): add isupcomingchange table to seed script (#380)
- Loading branch information
Showing
5 changed files
with
75 additions
and
13 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,24 @@ | ||
import { readFileSync, readdirSync } from 'fs'; | ||
|
||
let upcomingBlocks = {}; | ||
const metaPath = '../curriculum/challenges/_meta'; | ||
|
||
const filesToIgnore = ['.DS_Store']; | ||
|
||
try { | ||
const metaDir = readdirSync(metaPath); | ||
|
||
metaDir.forEach(file => { | ||
if (!filesToIgnore.includes(file)) { | ||
const metaFile = readFileSync(`${metaPath}/${file}/meta.json`, 'utf8'); | ||
const metaJson = JSON.parse(metaFile); | ||
upcomingBlocks[metaJson.dashedName] = metaJson.isUpcomingChange; | ||
} | ||
}); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
} | ||
|
||
export const getBlockIsUpcoming = dashedName => { | ||
return upcomingBlocks[dashedName]; | ||
}; |
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
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