diff --git a/cli/tauri.js/bin/tauri-init.js b/cli/tauri.js/bin/tauri-init.js index 692b47071..8666b69b1 100644 --- a/cli/tauri.js/bin/tauri-init.js +++ b/cli/tauri.js/bin/tauri-init.js @@ -21,7 +21,7 @@ const argv = parseArgs(process.argv.slice(2), { f: 'force', l: 'log', d: 'directory', - t: 'tauriPath' + t: 'tauri-path' }, boolean: ['h', 'l'] }) @@ -38,7 +38,7 @@ if (argv.help) { --force, -f Force init to overwrite [conf|template|all] --log, -l Logging [boolean] --directory, -d Set target directory for init - --tauriPath, -t Path of the Tauri project to use (relative to the cwd) + --tauri-path, -t Path of the Tauri project to use (relative to the cwd) `) process.exit(0) } diff --git a/cli/tauri.js/template.js b/cli/tauri.js/template.js index 3f6b7d747..d238dbfc2 100644 --- a/cli/tauri.js/template.js +++ b/cli/tauri.js/template.js @@ -33,16 +33,7 @@ Run \`tauri init --force template\` to overwrite.`) if (!force) return false } - let tauriDep - if (tauriPath) { - tauriDep = `{ path = "${resolve(process.cwd(), tauriPath, 'tauri')}" }` - } else { - const toml = require('@tauri-apps/toml') - const tomlPath = join(__dirname, '../../tauri/Cargo.toml') - const tomlFile = readFileSync(tomlPath) - const tomlContents = toml.parse(tomlFile) - tauriDep = `{ version = "${tomlContents.package.version}" }` - } + let tauriDep = tauriPath ? `{ path = "${join('..', tauriPath, 'tauri')}" }` : null try { removeSync(dir) diff --git a/cli/tauri.js/templates/src-tauri/Cargo.toml b/cli/tauri.js/templates/src-tauri/Cargo.toml index 349932aeb..ee1012c4a 100755 --- a/cli/tauri.js/templates/src-tauri/Cargo.toml +++ b/cli/tauri.js/templates/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ serde_derive = "1.0" tiny_http = "0.6" phf = "0.7.24" includedir = "0.5.0" -tauri = <%= tauriDep %> +tauri = <%= tauriDep || `"0.1.0"` %> [features] dev = ["tauri/dev"] # has no explicit dependencies