Decouple core Yaak logic from Tauri (#354)

This commit is contained in:
Gregory Schier
2026-01-08 20:44:25 -08:00
committed by GitHub
parent 3bcc0b8356
commit ef80216ca1
465 changed files with 3052 additions and 6234 deletions

View File

@@ -27,7 +27,7 @@ async function createMigration() {
const timestamp = generateTimestamp();
const fileName = `${timestamp}_${slugify(String(migrationName), { lower: true })}.sql`;
const migrationsDir = path.join(__dirname, '../src-tauri/yaak-models/migrations');
const migrationsDir = path.join(__dirname, '../crates/yaak-models/migrations');
const filePath = path.join(migrationsDir, fileName);
if (!fs.existsSync(migrationsDir)) {

View File

@@ -110,7 +110,7 @@ const tauriWorktreeConfig = {
productName: `Daak (${worktreeName})`
};
const tauriConfigPath = path.join(process.cwd(), 'src-tauri', 'tauri.worktree.conf.json');
const tauriConfigPath = path.join(process.cwd(), 'crates-tauri', 'yaak-app', 'tauri.worktree.conf.json');
fs.writeFileSync(tauriConfigPath, JSON.stringify(tauriWorktreeConfig, null, 2) + '\n', 'utf8');
console.log(`Created tauri.worktree.conf.json with identifier: ${tauriWorktreeConfig.identifier}`);

View File

@@ -6,7 +6,7 @@ if (!version) {
throw new Error('YAAK_VERSION environment variable not set')
}
const tauriConfigPath = path.join(__dirname, '../src-tauri/tauri.conf.json');
const tauriConfigPath = path.join(__dirname, '../crates-tauri/yaak-app/tauri.conf.json');
const tauriConfig = JSON.parse(fs.readFileSync(tauriConfigPath, 'utf8'));
tauriConfig.version = version;

View File

@@ -11,9 +11,10 @@ import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.join(__dirname, '..');
// Load .env.local if it exists
const envLocalPath = path.join(__dirname, '..', '.env.local');
const envLocalPath = path.join(rootDir, '.env.local');
if (fs.existsSync(envLocalPath)) {
const envContent = fs.readFileSync(envLocalPath, 'utf8');
const envVars = envContent
@@ -39,7 +40,7 @@ const additionalArgs = process.argv.slice(2);
const args = [
'dev',
'--no-watch',
'--config', './src-tauri/tauri.development.conf.json',
'--config', 'crates-tauri/yaak-app/tauri.development.conf.json',
'--config', config,
...additionalArgs
];

View File

@@ -33,17 +33,17 @@ const SRC_BIN_MAP = {
};
const DST_BIN_MAP = {
[MAC_ARM]: 'yaaknode-aarch64-apple-darwin',
[MAC_X64]: 'yaaknode-x86_64-apple-darwin',
[LNX_ARM]: 'yaaknode-aarch64-unknown-linux-gnu',
[LNX_X64]: 'yaaknode-x86_64-unknown-linux-gnu',
[WIN_X64]: 'yaaknode-x86_64-pc-windows-msvc.exe',
[WIN_ARM]: 'yaaknode-aarch64-pc-windows-msvc.exe',
[MAC_ARM]: 'yaaknode',
[MAC_X64]: 'yaaknode',
[LNX_ARM]: 'yaaknode',
[LNX_X64]: 'yaaknode',
[WIN_X64]: 'yaaknode.exe',
[WIN_ARM]: 'yaaknode.exe',
};
const key = `${process.platform}_${process.env.YAAK_TARGET_ARCH ?? process.arch}`;
const destDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'node');
const destDir = path.join(__dirname, `..`, 'crates-tauri', 'yaak-app', 'vendored', 'node');
const binDest = path.join(destDir, DST_BIN_MAP[key]);
console.log(`Vendoring NodeJS ${NODE_VERSION} for ${key}`);

View File

@@ -23,7 +23,7 @@ for (const name of readdirSync(pluginsDir)) {
console.log(`Skipping ${name} (external plugin)`);
continue;
}
const destDir = path.join(__dirname, '../src-tauri/vendored/plugins/', name);
const destDir = path.join(__dirname, '../crates-tauri/yaak-app/vendored/plugins/', name);
console.log(`Copying ${name} to ${destDir}`);
cpSync(path.join(dir, 'package.json'), path.join(destDir, 'package.json'));
cpSync(path.join(dir, 'build'), path.join(destDir, 'build'), { recursive: true });

View File

@@ -33,15 +33,15 @@ const SRC_BIN_MAP = {
};
const DST_BIN_MAP = {
[MAC_ARM]: 'yaakprotoc-aarch64-apple-darwin',
[MAC_X64]: 'yaakprotoc-x86_64-apple-darwin',
[LNX_ARM]: 'yaakprotoc-aarch64-unknown-linux-gnu',
[LNX_X64]: 'yaakprotoc-x86_64-unknown-linux-gnu',
[WIN_X64]: 'yaakprotoc-x86_64-pc-windows-msvc.exe',
[WIN_ARM]: 'yaakprotoc-aarch64-pc-windows-msvc.exe',
[MAC_ARM]: 'yaakprotoc',
[MAC_X64]: 'yaakprotoc',
[LNX_ARM]: 'yaakprotoc',
[LNX_X64]: 'yaakprotoc',
[WIN_X64]: 'yaakprotoc.exe',
[WIN_ARM]: 'yaakprotoc.exe',
};
const dstDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'protoc');
const dstDir = path.join(__dirname, `..`, 'crates-tauri', 'yaak-app', 'vendored', 'protoc');
const key = `${process.platform}_${process.env.YAAK_TARGET_ARCH ?? process.arch}`;
console.log(`Vendoring protoc ${VERSION} for ${key}`);