* feat: Start work on package api * feat: Browser Context Controller * feat: Add packages to cluster metadata feat: Change structure of Package * 🐛 fix: format * 🔨 feat: Add more functions wrapping around Modrinth * 🔨 feat: Start working on browser frontend * feat: BrowserPackage work + markdown support * 🐛 fix: fmt Signed-off-by: Pauline <git@ethanlibs.co> * 🚧 wip: h Signed-off-by: Pauline <git@ethanlibs.co> * feat: Download button for packages for suitable clusters + tweaks * 🚧 wip: markdown and stuff Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: some patches Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: remove react bloat Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore(pkg/infer): try to reduce reused code Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore: bump deps Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: markdown innerhtml Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: h Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: tweak Signed-off-by: Pauline <git@ethanlibs.co> * 🚧 wip: idk Signed-off-by: Pauline <git@ethanlibs.co> * fix: Gamemode compile error chore: Add missing and remove unused libraries feat: usePreventLeave hook feat: ClusterOverview edit mode continues with navigation (assuming there was a navigation attempt) after pressing Yes or No for save * feat: Add reload clusters button on home page * feat: More information provided to BrowserPackage * fix: Minor fixes (Navbar isActive, Markdown click prevention, Markdown list styling) * 🐛 fix: h Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: highlighting Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: forge modern Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore: bump deps Signed-off-by: Pauline <git@ethanlibs.co> * fix: Markdown-it issue + Added promptOpener hook for Markdown links * feat: Made BrowserPackage sidebar sticky * refactor: Package system (not yet in a working state) * 🚧 wip: bump deps temp Signed-off-by: Pauline <git@ethanlibs.co> * feat: Added a package manager * ✨ feature: start prisma work, but it doesnt break anything so we can keep it until its done. also fix some stuff Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: pushing Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: linting Signed-off-by: Pauline <git@ethanlibs.co> * ✨ feature: start ingress integration Signed-off-by: Pauline <git@ethanlibs.co> * feat: Package Manager should work now 👍 * fix: Package manager tracing spam * feat: Added tauri commands for cluster packages format: Auto formatted frontend + backend * 🐛 fix: tmp Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore: format Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: specta extension Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: github actions Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: alias Signed-off-by: Pauline <git@ethanlibs.co> * chore: Some tweaks and fixes * chore: Rebase + gitignore bindings.ts * chore: Remove bindings.ts * 🐛 fix: migrate Signed-off-by: Pauline <git@ethanlibs.co> * 🚧 wip: not sure Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: finalize prisma init schema Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore: format Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: bump deps Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: system deps Signed-off-by: Pauline <git@ethanlibs.co> * fix: solid-router navigation issue * feat: Added new BrowserMain page * feat: Tweaks + new package list view * 🐛 fix: bump + format (todo: tauri2, etc) Signed-off-by: Pauline <git@ethanlibs.co> * 🐛 fix: devx (fixes #126) Signed-off-by: Pauline <git@ethanlibs.co> * 🔨 chore: migrate to consola Signed-off-by: Pauline <git@ethanlibs.co> --------- Signed-off-by: Pauline <git@ethanlibs.co> Co-authored-by: LynithDev <61880709+LynithDev@users.noreply.github.com>
85 lines
2.7 KiB
TypeScript
85 lines
2.7 KiB
TypeScript
import process from 'node:process';
|
|
import fs from 'node:fs/promises';
|
|
import { setTimeout } from 'node:timers/promises';
|
|
import pathe from 'pathe';
|
|
import { execa } from 'execa';
|
|
import consola from 'consola';
|
|
import { awaitLock, checkEnvironment } from './utils';
|
|
import { patchTauri } from './utils/patch';
|
|
|
|
const env = checkEnvironment(import.meta);
|
|
const [_, __, ...args] = process.argv;
|
|
const __desktop = pathe.join(env.__root, 'apps', 'desktop');
|
|
const store = { code: 0, cleanup: new Array<string>() };
|
|
const cleanup = () => Promise.all(store.cleanup.map(f => fs.unlink(f).catch((_) => {})));
|
|
|
|
process.on('SIGINT', cleanup);
|
|
if (args.length === 0)
|
|
args.push('build');
|
|
|
|
function targetFilter(filter: 'b' | 't') {
|
|
const filters = filter === 'b' ? ['-b', '--bundles'] : ['-t', '--target'];
|
|
return (_: string, idx: number, args: string[]) => {
|
|
if (idx === 0)
|
|
return false;
|
|
const prev = args[idx - 1] ?? '';
|
|
return filters.includes(prev);
|
|
};
|
|
}
|
|
|
|
const targets = args.filter(targetFilter('t')).flatMap(t => t.split(','));
|
|
const bundles = args.filter(targetFilter('b')).flatMap(b => b.split(','));
|
|
|
|
try {
|
|
switch (args[0]) {
|
|
case 'dev': {
|
|
store.cleanup.push(...(await patchTauri(env, targets, args)));
|
|
switch (process.platform) {
|
|
case 'linux':
|
|
case 'darwin':
|
|
void awaitLock(pathe.join(env.__root, 'target', 'debug', '.cargo-lock'))
|
|
.then(_ => setTimeout(1000).then(cleanup), (_) => {});
|
|
break;
|
|
}
|
|
|
|
break;
|
|
}
|
|
case 'build': {
|
|
if (!process.env.NODE_OPTIONS || !process.env.NODE_OPTIONS.includes('--max_old_space_size'))
|
|
process.env.NODE_OPTIONS = `--max_old_space_size=4096 ${process.env.NODE_OPTIONS ?? ''}`;
|
|
|
|
process.env.GENERATE_SOURCEMAP = 'false';
|
|
store.cleanup.push(...(await patchTauri(env, targets, args)));
|
|
}
|
|
}
|
|
|
|
await execa('pnpm', ['exec', 'tauri', ...args], { cwd: __desktop });
|
|
|
|
if (args[0] === 'build' && bundles.some(b => b === 'deb' || b === 'all')) {
|
|
const linuxTargets = targets.filter(t => t.includes('-linux-'));
|
|
if (linuxTargets.length > 0)
|
|
linuxTargets.forEach(async (t) => {
|
|
process.env.TARGET = t;
|
|
await execa(pathe.join(env.__dirname, 'fix-deb.sh'), [], { cwd: env.__dirname });
|
|
});
|
|
else if (process.platform === 'linux')
|
|
await execa(pathe.join(env.__dirname, 'fix-deb.sh'), [], { cwd: env.__dirname });
|
|
}
|
|
}
|
|
catch (error: any) {
|
|
consola.error(`tauri ${args[0]} failed with exit code ${typeof error === 'number' ? error : 1}`);
|
|
consola.warn(`to fix some errors, run ${process.platform === 'win32' ? './packages/scripts/setup.ps1' : './packages/scripts/setup.sh'}`);
|
|
|
|
if (typeof error === 'number') {
|
|
store.code = error;
|
|
}
|
|
else {
|
|
if (error instanceof Error)
|
|
consola.error(error);
|
|
store.code = 1;
|
|
}
|
|
}
|
|
finally {
|
|
cleanup();
|
|
env.__exit(store.code);
|
|
}
|