mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 07:53:54 +01:00
Decouple core Yaak logic from Tauri (#354)
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
];
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user