-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
1 parent
14d364b
commit 746aa1a
Showing
15 changed files
with
280 additions
and
48 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
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 |
---|---|---|
|
@@ -10,13 +10,15 @@ | |
}, | ||
"license": "MIT", | ||
"author": "LobeHub <[email protected]>", | ||
"type": "module", | ||
"scripts": { | ||
"build": "node scripts/build.mjs", | ||
"format": "node scripts/format.mjs", | ||
"lint": "eslint \"scripts/**/*.mjs\" --fix", | ||
"lint:md": "remark . --quiet --frail --output", | ||
"prettier": "prettier -c --write \"**/*.{json,mjs,md}\"", | ||
"test": "node scripts/test.mjs" | ||
"awesome": "bun scripts/build.ts && bun scripts/updateAwesome.ts", | ||
"build": "bun scripts/build.ts", | ||
"format": "bun scripts/format.ts", | ||
"lint": "eslint \"scripts/**/*.ts\" --fix", | ||
"lint:md": "remark . --quiet --output", | ||
"prettier": "prettier -c --write \"**/*.{json,ts,md}\"", | ||
"test": "bun scripts/test.ts" | ||
}, | ||
"devDependencies": { | ||
"@lobehub/chat-plugin-sdk": "latest", | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { readFileSync, writeFileSync } from 'node:fs'; | ||
import { resolve } from 'node:path'; | ||
|
||
import { indexCnPath, indexPath, publicDir, readmeCnPath, readmePath } from './const'; | ||
import { updateAwesomeReadme, readJSON } from './utils'; | ||
|
||
const updateAwesome = (filePath: string, md: string, plugins, locale?: string) => { | ||
const data:string[] = []; | ||
|
||
plugins.forEach(({ identifier, author, createAt, homepage, meta }, i) => { | ||
const pluginConfigPath = resolve( | ||
publicDir, | ||
[identifier, locale, 'json'].filter(Boolean).join('.'), | ||
); | ||
const header = `### ${meta.title}`; | ||
const subHeader = `<sup>By **[@${author}](${homepage})** on **${createAt}**</sup>`; | ||
const desc = [ | ||
`${meta.description}`, | ||
`${meta.tags | ||
.filter(Boolean) | ||
.map((tag) => `\`${tag}\``) | ||
.join(' ')}`, | ||
].join('\n\n'); | ||
|
||
const body:string = [ | ||
i !== 0 ? '---' : false, | ||
header, | ||
subHeader, | ||
desc, | ||
`<div align="right">\n\n[![][back-to-top]](#readme-top)\n\n</div>`, | ||
] | ||
.filter(Boolean) | ||
.join('\n\n'); | ||
data.push(body); | ||
}); | ||
|
||
const newMd = updateAwesomeReadme(md, data.join('\n\n')); | ||
|
||
writeFileSync(filePath, newMd, 'utf-8'); | ||
}; | ||
|
||
const runUpdateAwesome = () => { | ||
const readmeCn = readFileSync(readmeCnPath, 'utf-8'); | ||
const readme = readFileSync(readmePath, 'utf-8'); | ||
const index = readJSON(indexPath); | ||
const indexCn = readJSON(indexCnPath); | ||
updateAwesome(readmePath, readme, index.plugins); | ||
updateAwesome(readmeCnPath, readmeCn, indexCn.plugins, 'zh-CN'); | ||
}; | ||
|
||
runUpdateAwesome(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.