Skip to content

Commit

Permalink
fix(core): product name on Linux is converted to kebab-case (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Apr 29, 2021
1 parent ba914f5 commit e6aa180
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changes/linux-package-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tauri-apps/action-core": patch
"action": patch
---

Fixes `Artifacts not found` error on Linux when the `productName` is converted to `kebab-case`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"package": {
"productName": "TauriExample App"
},
"tauri": {
"bundle": {
"active": true,
Expand Down Expand Up @@ -50,4 +53,4 @@
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"
}
}
}
}
7 changes: 4 additions & 3 deletions packages/action/dist/index.js

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export async function buildProject(
name = config.package.productName
version = config.package.version
}
if (!(name || version)) {
if (!(name && version)) {
const manifestPath = join(root, 'src-tauri/Cargo.toml')
const cargoManifest = (toml.parse(
readFileSync(manifestPath).toString()
Expand All @@ -112,7 +112,7 @@ export async function buildProject(
version = version || cargoManifest.package.version
}

if (!(name || version)) {
if (!(name && version)) {
console.error('Could not determine package name and version')
process.exit(1)
}
Expand Down Expand Up @@ -187,7 +187,14 @@ export async function buildProject(
{ cwd: root }
)
.then(() => {
const appName = app.name
let appName = app.name
// on Linux, the app product name is converted to kebab-case
if (!['darwin', 'win32'].includes(platform())) {
appName = appName.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
.replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2')
.replace(/ /g, '-')
.toLowerCase()
}
const artifactsPath = join(
root,
`src-tauri/target/${debug ? 'debug' : 'release'}`
Expand Down

0 comments on commit e6aa180

Please sign in to comment.