mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-23 18:53:33 +03:00
39ce652329
* chore(monorepo): cleanup * fix(tauri-cli): build errors * fix(tauri:build.rs): dont' panic if env missing * fix(finalize): setup for crates * npm publish on release actual publish currently disabled * cargo publish on release actual publish currently disabled * update PR tests for new folder structure * doesn't like the period on job name? * fail on cargo warnings otherwise we would assume green arrow is all good * green on warnings for now
37 lines
701 B
JavaScript
37 lines
701 B
JavaScript
const { existsSync } = require('fs')
|
|
const { resolve, join, normalize, sep } = require('path')
|
|
|
|
/**
|
|
*
|
|
* @returns {{length}|*}
|
|
*/
|
|
function getAppDir () {
|
|
let dir = process.cwd()
|
|
let count = 0
|
|
|
|
// only go up three folders max
|
|
while (dir.length && dir[dir.length - 1] !== sep && count <= 2) {
|
|
if (existsSync(join(dir, 'tauri.conf.js'))) {
|
|
return dir
|
|
}
|
|
count++
|
|
dir = normalize(join(dir, '..'))
|
|
}
|
|
|
|
// just return the current directory
|
|
return process.cwd()
|
|
}
|
|
|
|
const appDir = getAppDir()
|
|
const tauriDir = resolve(appDir, 'src-tauri')
|
|
|
|
module.exports = {
|
|
appDir,
|
|
tauriDir,
|
|
|
|
resolve: {
|
|
app: dir => join(appDir, dir),
|
|
tauri: dir => join(tauriDir, dir)
|
|
}
|
|
}
|