mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-02-06 13:06:48 +00:00
fix(tauri.js): init command properly building with manifests (#1374)
* fix(tauri.js): init command properly building with manifests * fix: tests
This commit is contained in:
parent
af24034405
commit
2afb3f8ad5
@ -41,6 +41,7 @@ module.exports = {
|
||||
},
|
||||
transform: {
|
||||
'templates[\\\\/]tauri.js': './test/jest/raw-loader-transformer.js',
|
||||
'\\.toml$': 'jest-transform-toml',
|
||||
'\\.(js|ts)$': 'babel-jest'
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,6 +93,7 @@
|
||||
"eslint-plugin-security": "1.4.0",
|
||||
"is-running": "2.1.0",
|
||||
"jest": "26.6.3",
|
||||
"jest-transform-toml": "^1.0.0",
|
||||
"lint-staged": "10.5.4",
|
||||
"lockfile-lint": "4.6.2",
|
||||
"prettier": "2.2.1",
|
||||
|
||||
@ -84,20 +84,21 @@ Run \`tauri init --force template\` to overwrite.`)
|
||||
return resolvedPath.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
const resolveCurrentTauriVersion = (crate: string): string => {
|
||||
const manifestPath = `../../../../${crate}/Cargo.toml`
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-require
|
||||
const tauriManifest = require(manifestPath) as CargoManifest
|
||||
const version = tauriManifest.package.version
|
||||
const resolveCurrentTauriVersion = (manifest: CargoManifest): string => {
|
||||
const version = manifest.package.version
|
||||
return version.substring(0, version.lastIndexOf('.'))
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const tauriManifest = require('../../../../tauri/Cargo.toml') as CargoManifest
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const tauriBuildManifest = require('../../../../core/tauri-build/Cargo.toml') as CargoManifest
|
||||
|
||||
const tauriDep = tauriPath
|
||||
? `{ path = "${resolveTauriPath(tauriPath, 'tauri')}" }`
|
||||
: `{ version = "${resolveCurrentTauriVersion('tauri')}" }`
|
||||
: `{ version = "${resolveCurrentTauriVersion(tauriManifest)}" }`
|
||||
const tauriBuildDep = tauriPath
|
||||
? `{ path = "${resolveTauriPath(tauriPath, 'core/tauri-build')}" }`
|
||||
: `{ version = "${resolveCurrentTauriVersion('core/tauri-build')}" }`
|
||||
: `{ version = "${resolveCurrentTauriVersion(tauriBuildManifest)}" }`
|
||||
|
||||
removeSync(dir)
|
||||
copyTemplates({
|
||||
|
||||
@ -4891,6 +4891,13 @@ jest-snapshot@^26.6.2:
|
||||
pretty-format "^26.6.2"
|
||||
semver "^7.3.2"
|
||||
|
||||
jest-transform-toml@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-transform-toml/-/jest-transform-toml-1.0.0.tgz#0a255066d4e59620ec3c3cc5a555321bb05f153d"
|
||||
integrity sha1-CiVQZtTlliDsPDzFpVUyG7BfFT0=
|
||||
dependencies:
|
||||
toml-loader "^1.0.0"
|
||||
|
||||
jest-util@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"
|
||||
@ -7392,7 +7399,7 @@ to-regex@^3.0.1, to-regex@^3.0.2:
|
||||
regex-not "^1.0.2"
|
||||
safe-regex "^1.1.0"
|
||||
|
||||
toml-loader@1.0.0:
|
||||
toml-loader@1.0.0, toml-loader@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/toml-loader/-/toml-loader-1.0.0.tgz#05249b9294b623601148260caa480b22a653a19a"
|
||||
integrity sha1-BSSbkpS2I2ARSCYMqkgLIqZToZo=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user