Skip to content

Commit

Permalink
Adjust the build csv
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Oct 5, 2024
1 parent 643aa3d commit 6e1b680
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const files = fs.readdirSync('./files-v1')

console.log(`Detect ${files.length} files`)
const mapping = {}
const domainMapping = {}
const start = Date.now()
for (const fileName of files) {
if (!fileName.endsWith('.json')) continue
Expand All @@ -37,6 +38,7 @@ for (const fileName of files) {

if (content.curseforge) {
mapping[modrinth.projectId] = content.curseforge[0].projectId
domainMapping[modrinth.projectId] = content.domain
}
}
for (const curseforge of content.curseforge || []) {
Expand Down Expand Up @@ -76,7 +78,7 @@ const entries = Object.entries(mapping)
let result = ''
for (let i = 0; i < entries.length; ++i) {
const [modrinth, curseforge] = entries[i]
result += modrinth + ',' + curseforge + '\n'
result += modrinth + ',' + curseforge + ',' + domainMapping[modrinth] + '\n'
}

fs.writeFileSync('./build/project_mapping.csv', result)
Expand Down

0 comments on commit 6e1b680

Please sign in to comment.