mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-27 21:16:22 +03:00
6dcccf5a8e
* fix(js-cli) resolve correct paths on `tauri init` * feat(js-cli) inject src-tauri/ as lodash template * fix(js-cli) entry paths * feat(js-cli) rename APP_URL to devPath and allow .html values * feat(js-cli) reload config when `tauri.conf.js` change detected * feat(node): update to testing * feat(template): fix phf, remove updater * feat(samples): add vanillajs * fix(templates): objectify tauri Closes #99. * fix(examples): update cargo.toml - to match signature * chore(tauri): version update * feat(workflows): fix dirs, add tokens * fix(config): more robust env checking * feat(fixture): start a testing fixture for tauri * fix(workflow): use fixture for ENV * fix(examples:vanilla): remove updater * addition to previous commit re. fixture * fix(config.rs): fix the unfix * feat(js-cli) use the new cargo-tauri-cli * chore(template) cleanup src-tauri/Cargo.toml * chore(js-cli) toml features cleanup * chore(js-cli) move edge to config > tauri * fix(js-cli) appPaths resolve() instead of join()
37 lines
707 B
JavaScript
37 lines
707 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 => resolve(appDir, dir),
|
|
tauri: dir => resolve(tauriDir, dir)
|
|
}
|
|
}
|