mirror of
https://github.com/seigler/awesome-dash-platform
synced 2025-07-27 06:36:08 +00:00
feat: awesome ipfs website
This commit is contained in:
parent
b26e566cb0
commit
5304c279f5
43 changed files with 1068 additions and 161 deletions
23
scripts/data.js
Normal file
23
scripts/data.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const yaml = require('node-yaml')
|
||||
const { sortAbc } = require('./utils')
|
||||
const dataDir = path.join(__dirname, '../data')
|
||||
|
||||
const trimIfExists = (str) => str ? str.trim() : undefined
|
||||
|
||||
const files = fs.readdirSync(dataDir)
|
||||
.map(file => path.join(dataDir, file))
|
||||
.map(file => yaml.readSync(file))
|
||||
.map(file => {
|
||||
file.content = file.content.map(({ title, description, ...file }) => ({
|
||||
title: trimIfExists(title),
|
||||
description: trimIfExists(description),
|
||||
...file
|
||||
}))
|
||||
|
||||
return file
|
||||
})
|
||||
.sort((a, b) => sortAbc(a.title, b.title))
|
||||
|
||||
module.exports = files
|
Loading…
Add table
Add a link
Reference in a new issue