mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
Merge branch 'main' of https://github.com/discordeno/discordeno into main
This commit is contained in:
12
scripts/checkCpuModel.js
Normal file
12
scripts/checkCpuModel.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
|
||||
const hostCpu = os.cpus()[0].model.trim()
|
||||
const targetCpu = await fetch('https://raw.githubusercontent.com/discordeno/discordeno/benchies/cpu')
|
||||
.then((res) => res.text())
|
||||
.then((text) => text.slice(0, -1))
|
||||
console.dir(`host cpu: ${hostCpu} target cpu: ${targetCpu}`)
|
||||
|
||||
let outputFile = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8')
|
||||
outputFile += `\nmatch=${hostCpu === targetCpu}`
|
||||
fs.writeFileSync(process.env.GITHUB_OUTPUT, outputFile, 'utf8')
|
||||
@@ -40,13 +40,11 @@ for await (let filepath of walk(typedocOutPath)) {
|
||||
// Converts ugly names to clean names for example discordeno_types.ActionRow becomes ActionRow
|
||||
const cleanForms = [
|
||||
{ ugly: 'discordeno_bot.md', clean: 'Bot.md'},
|
||||
{ ugly: 'discordeno_client.md', clean: 'Client.md'},
|
||||
{ ugly: 'discordeno_gateway.md', clean: 'Gateway.md'},
|
||||
{ ugly: 'discordeno_rest.md', clean: 'Rest.md'},
|
||||
{ ugly: 'discordeno_types.md', clean: 'Types.md'},
|
||||
{ ugly: 'discordeno_utils.md', clean: 'Utils.md'},
|
||||
{ ugly: 'discordeno_bot.' },
|
||||
{ ugly: 'discordeno_client.' },
|
||||
{ ugly: 'discordeno_gateway.' },
|
||||
{ ugly: 'discordeno_rest.' },
|
||||
{ ugly: 'discordeno_types.' },
|
||||
|
||||
@@ -3,19 +3,13 @@ import fs from 'node:fs'
|
||||
const dirs = ['']
|
||||
for await (const dir of dirs) {
|
||||
await Promise.all(
|
||||
fs.readdirSync(`benchDist${dir}`).map(async (file) => {
|
||||
if (!file.endsWith('.js')) {
|
||||
fs.readdirSync(`dist${dir}`).map(async (file) => {
|
||||
if (!file.endsWith('.js') && !file.endsWith('.map') && !file.endsWith('.ts')) {
|
||||
dirs.push(`${dir}/${file}`)
|
||||
return
|
||||
}
|
||||
const content = await fs.promises.readFile(
|
||||
`benchDist${dir}/${file}`,
|
||||
'utf-8'
|
||||
)
|
||||
fs.promises.writeFile(
|
||||
`benchDist${dir}/${file}`,
|
||||
content.replace(/src\//g, 'dist/').replace(/\.ts/g, '.js')
|
||||
)
|
||||
})
|
||||
const content = await fs.promises.readFile(`dist${dir}/${file}`, 'utf-8')
|
||||
fs.promises.writeFile(`dist${dir}/${file}`, content.replace(/src\//g, 'dist/').replace(/\.ts/g, '.js'))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user