fix(js-cli) tauri init broken when not using the local version #… (#136)

This commit is contained in:
Lucas Fernandes Nogueira
2019-12-04 17:49:14 -03:00
committed by GitHub
parent 0d6b8b34a0
commit 38b8da497c
3 changed files with 4 additions and 13 deletions

View File

@@ -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)
}

View File

@@ -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)

View File

@@ -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