make use of other files + add quick bash script

This commit is contained in:
Louie Sebastian Kurenai 2026-03-14 21:22:25 +08:00
parent 92465b921e
commit 126e9c8c3e
3 changed files with 46 additions and 1 deletions

18
bashQuickBuild.sh Normal file
View file

@ -0,0 +1,18 @@
#!/bin/bash
npm run build
if [ ! -d 'performium' ]; then
mkdir 'performium'
echo 'Directory created: performium'
fi
mv build/main.js performium/main.js
cp styles.css performium/styles.css
cp manifest.json performium/manifest.json
echo 'Moved files to directory: performium'
rmdir 'build'
echo 'Directory removed: build'
echo 'Build Successful'

View file

@ -0,0 +1,16 @@
import { App } from 'obsidian';
export async function getFileExtensionCount(app: App): Promise<any> {
const counts: Record<string, number> = {};
this.app.vault.getFiles().forEach((file: { extension: any; }) => {
const ext = file.extension;
if (!counts[ext]) counts[ext] = 0;
counts[ext]++;
});
// console.log(counts);
return counts;
}

View file

@ -14,7 +14,8 @@ import { calculateVaultStats } from "src/functions/vaultStats";
import { getOrphanCount } from "../values/newerEvaluators/orphanCount";
import { calculateVaultCleanliness } from "../values/newerEvaluators/vaultCleanliness";
import { getAllFiles, getAllFolders } from "../values/newerEvaluators/itemCount";
// simport { countAllLinks, countAllWikiLinks } from "../values/newerEvaluators/linkCount";
// import { countAllLinks, countAllWikiLinks } from "../values/newerEvaluators/linkCount";
import { getFileExtensionCount } from "src/functions/getFileExtensionCount";
import { getTotalWordCount } from "../values/newerEvaluators/newVaultStats";
// the function to calculate the pp values from the entire vault (confusion, my bad)
@ -154,6 +155,16 @@ export async function calculatePerformance(plugin: PerformiumPlugin): Promise<nu
// add a small multiplier to the full value
value += (Math.log(value) + (1 + (value * 0.025))) / 125;
// make use of bases (for now)
const fileExtensionArray = await getFileExtensionCount(this.app);
// debug
console.log(fileExtensionArray);
let baseCount = fileExtensionArray.base;
value += Math.log(baseCount) ** (1 + (0.001 * baseCount));
return value;
}