mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix(js-cli) tauri init broken when not using the local version #… (#136)
This commit is contained in:
committed by
GitHub
parent
0d6b8b34a0
commit
38b8da497c
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user