From 38b8da497c914d75e40b3f4bec0573f915519f79 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 4 Dec 2019 17:49:14 -0300 Subject: [PATCH] =?UTF-8?q?fix(js-cli)=20tauri=20init=20broken=20when=20no?= =?UTF-8?q?t=20using=20the=20local=20version=20#=E2=80=A6=20(#136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/tauri.js/bin/tauri-init.js | 4 ++-- cli/tauri.js/template.js | 11 +---------- cli/tauri.js/templates/src-tauri/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) 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