feat(performance): speedup startup

This commit is contained in:
cocobo1 2025-10-12 21:32:35 +03:00
parent c4c3e2eabf
commit 4b3802cce9
3 changed files with 17 additions and 27 deletions

View file

@ -2,54 +2,49 @@ name: Node.js CI / CD (Bun + Forgejo)
on:
push:
branches: [ "main" ]
branches: [ "main", "dev" ]
jobs:
buildAndRelease:
runs-on: codeberg-tiny
steps:
- uses: actions/checkout@v3
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
echo "$BUN_INSTALL/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
bun install
- name: Build project
run: |
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
bun run build --release-branch=${GITHUB_REF_NAME:-${CI_COMMIT_REF_NAME}} --build-minify
- name: Push JS files to dist branch
run: |
git config --local user.email "actions@forgejo.local"
git config --local user.name "Forgejo Actions"
mkdir -p temp_dist
find dist -name "*.js" -exec cp {} temp_dist/ \;
git checkout --orphan dist-temp
git rm -rf --cached .
cp -r temp_dist/* .
rm -rf temp_dist
git add *.js
git commit -m "Update build $GITHUB_SHA" || exit 0
git push -f origin HEAD:dist
if [ "${GITHUB_REF_NAME:-${CI_COMMIT_REF_NAME}}" = "dev" ]; then
TARGET_BRANCH="testing-dist"
else
TARGET_BRANCH="dist"
fi
git push -f origin HEAD:$TARGET_BRANCH
git checkout -f ${GITHUB_REF_NAME:-${CI_COMMIT_REF_NAME}}
- name: Merge main into github
if: github.ref == 'refs/heads/main'
run: |

View file

@ -18,6 +18,9 @@ import * as lib from "./lib";
export default async () => {
// Load everything in parallel
updatePlugins();
await Promise.all([
initThemes(),
injectFluxInterceptor(),
@ -30,7 +33,10 @@ export default async () => {
initSettings(),
initFixes(),
// patchErrorBoundary(),
updatePlugins()
updatePlugins(),
updateFonts(),
initPlugins(),
VdPluginManager.initPlugins(),
]).then(
// Push them all to unloader
u => u.forEach(f => f && lib.unload.push(f))
@ -39,17 +45,6 @@ export default async () => {
// Assign window object
window.bunny = lib;
// Once done, load Vendetta plugins
VdPluginManager.initPlugins()
.then(u => lib.unload.push(u))
.catch(() => alert("Failed to initialize Vendetta plugins"));
// And then, load Kettu plugins
initPlugins();
// Update the fonts
updateFonts();
// We good :)
logger.log("Kettu is ready!");
};

View file

@ -109,7 +109,7 @@ export async function removeFont(name: string) {
export async function updateFonts() {
await awaitStorage(fonts);
await Promise.allSettled(
Promise.allSettled(
Object.keys(fonts).map(
name => saveFont(fonts[name], fonts.__selected === name)
)