mirror of
https://github.com/ruikurenaii/performium.git
synced 2026-07-22 05:49:42 +00:00
make use of other files + add quick bash script
This commit is contained in:
parent
92465b921e
commit
126e9c8c3e
3 changed files with 46 additions and 1 deletions
18
bashQuickBuild.sh
Normal file
18
bashQuickBuild.sh
Normal 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'
|
||||
16
src/functions/getFileExtensionCount.ts
Normal file
16
src/functions/getFileExtensionCount.ts
Normal 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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue