Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
Auto-fix formatting issues
GitHub Action65bfb8fbd852
diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.tsindex 653895da..6a8c0559 100644--- a/bin/builders/LinuxBuilder.ts+++ b/bin/builders/LinuxBuilder.ts@@ -52,7 +52,9 @@ export default class LinuxBuilder extends BaseBuilder {async build(url: string) {const targetTypes = ['deb', 'appimage', 'rpm'];- const requestedTargets = this.options.targets.split(',').map((t: string) => t.trim());+ const requestedTargets = this.options.targets+ .split(',')+ .map((t: string) => t.trim());for (const target of targetTypes) {if (requestedTargets.includes(target)) {diff --git a/tests/integration/workflow-paths.test.js b/tests/integration/workflow-paths.test.jsindex f42a1632..4d6603e6 100644--- a/tests/integration/workflow-paths.test.js+++ b/tests/integration/workflow-paths.test.js@@ -5,28 +5,28 @@* match the actual output paths from the CLI builders.*/-import { describe, it, expect } from 'vitest';-import path from 'path';+import { describe, it, expect } from "vitest";+import path from "path";-describe('Workflow path integration', () => {- describe('Platform-specific output paths', () => {- it('should match Linux output paths', () => {+describe("Workflow path integration", () => {+ describe("Platform-specific output paths", () => {+ it("should match Linux output paths", () => {// Expected paths based on LinuxBuilder behaviorconst linuxPaths = {deb: {// CLI copies to project root- primary: 'appname.deb',+ primary: "appname.deb",// Fallback location in bundle directory- fallback: 'src-tauri/target/release/bundle/deb',+ fallback: "src-tauri/target/release/bundle/deb",},appimage: {- primary: 'appname.AppImage',- fallback: 'src-tauri/target/release/bundle/appimage',+ primary: "appname.AppImage",+ fallback: "src-tauri/target/release/bundle/appimage",},rpm: {- primary: 'appname.rpm',- fallback: 'src-tauri/target/release/bundle/rpm',- }+ primary: "appname.rpm",+ fallback: "src-tauri/target/release/bundle/rpm",+ },};// Verify paths are defined@@ -36,37 +36,40 @@ describe('Workflow path integration', () => {expect(linuxPaths.appimage.fallback).toBeTruthy();});- it('should match Windows output paths', () => {+ it("should match Windows output paths", () => {// Expected paths based on WinBuilder behaviorconst windowsPaths = {msi: {// For x64 builds, files are in architecture-specific directory- architectureSpecific: 'src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi',+ architectureSpecific:+ "src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi",// Fallback to generic path- generic: 'src-tauri/target/release/bundle/msi',- }+ generic: "src-tauri/target/release/bundle/msi",+ },};expect(windowsPaths.msi.architectureSpecific).toBeTruthy();expect(windowsPaths.msi.generic).toBeTruthy();});- it('should match macOS output paths', () => {+ it("should match macOS output paths", () => {// Expected paths based on MacBuilder behaviorconst macosPaths = {dmg: {// CLI copies to project root- primary: 'appname.dmg',+ primary: "appname.dmg",// Universal builds use universal-apple-darwin target- universalBundle: 'src-tauri/target/universal-apple-darwin/release/bundle/dmg',+ universalBundle:+ "src-tauri/target/universal-apple-darwin/release/bundle/dmg",// Regular builds- genericBundle: 'src-tauri/target/release/bundle/dmg',+ genericBundle: "src-tauri/target/release/bundle/dmg",},app: {- primary: 'appname.app',- universalBundle: 'src-tauri/target/universal-apple-darwin/release/bundle/macos',- genericBundle: 'src-tauri/target/release/bundle/macos',- }+ primary: "appname.app",+ universalBundle:+ "src-tauri/target/universal-apple-darwin/release/bundle/macos",+ genericBundle: "src-tauri/target/release/bundle/macos",+ },};expect(macosPaths.dmg.primary).toBeTruthy();@@ -76,145 +79,145 @@ describe('Workflow path integration', () => {});});- describe('Multi-target scenarios', () => {- it('should handle Linux multi-target builds', () => {- const targets = 'deb,appimage';- const parsedTargets = targets.split(',').map(t => t.trim());+ describe("Multi-target scenarios", () => {+ it("should handle Linux multi-target builds", () => {+ const targets = "deb,appimage";+ const parsedTargets = targets.split(",").map((t) => t.trim());- expect(parsedTargets).toEqual(['deb', 'appimage']);+ expect(parsedTargets).toEqual(["deb", "appimage"]);expect(parsedTargets).toHaveLength(2);});- it('should handle targets with spaces', () => {- const targets = 'deb, appimage, rpm';- const parsedTargets = targets.split(',').map(t => t.trim());+ it("should handle targets with spaces", () => {+ const targets = "deb, appimage, rpm";+ const parsedTargets = targets.split(",").map((t) => t.trim());- expect(parsedTargets).toEqual(['deb', 'appimage', 'rpm']);+ expect(parsedTargets).toEqual(["deb", "appimage", "rpm"]);expect(parsedTargets).toHaveLength(3);});- it('should filter valid targets', () => {- const targets = 'deb,invalid,appimage';- const parsedTargets = targets.split(',').map(t => t.trim());- const validTargets = ['deb', 'appimage', 'rpm'];- const filtered = parsedTargets.filter(t => validTargets.includes(t));+ it("should filter valid targets", () => {+ const targets = "deb,invalid,appimage";+ const parsedTargets = targets.split(",").map((t) => t.trim());+ const validTargets = ["deb", "appimage", "rpm"];+ const filtered = parsedTargets.filter((t) => validTargets.includes(t));- expect(filtered).toEqual(['deb', 'appimage']);- expect(filtered).not.toContain('invalid');+ expect(filtered).toEqual(["deb", "appimage"]);+ expect(filtered).not.toContain("invalid");});});- describe('Architecture-specific paths', () => {- it('should construct correct Windows x64 path', () => {- const basePath = 'src-tauri/target';- const arch = 'x86_64-pc-windows-msvc';- const mode = 'release';- const bundleType = 'msi';+ describe("Architecture-specific paths", () => {+ it("should construct correct Windows x64 path", () => {+ const basePath = "src-tauri/target";+ const arch = "x86_64-pc-windows-msvc";+ const mode = "release";+ const bundleType = "msi";- const fullPath = path.join(basePath, arch, mode, 'bundle', bundleType);+ const fullPath = path.join(basePath, arch, mode, "bundle", bundleType);- expect(fullPath).toContain('x86_64-pc-windows-msvc');- expect(fullPath).toContain('release');- expect(fullPath).toContain('msi');+ expect(fullPath).toContain("x86_64-pc-windows-msvc");+ expect(fullPath).toContain("release");+ expect(fullPath).toContain("msi");});- it('should construct correct macOS universal path', () => {- const basePath = 'src-tauri/target';- const arch = 'universal-apple-darwin';- const mode = 'release';- const bundleType = 'dmg';+ it("should construct correct macOS universal path", () => {+ const basePath = "src-tauri/target";+ const arch = "universal-apple-darwin";+ const mode = "release";+ const bundleType = "dmg";- const fullPath = path.join(basePath, arch, mode, 'bundle', bundleType);+ const fullPath = path.join(basePath, arch, mode, "bundle", bundleType);- expect(fullPath).toContain('universal-apple-darwin');- expect(fullPath).toContain('release');- expect(fullPath).toContain('dmg');+ expect(fullPath).toContain("universal-apple-darwin");+ expect(fullPath).toContain("release");+ expect(fullPath).toContain("dmg");});- it('should construct correct Linux arm64 path', () => {- const basePath = 'src-tauri/target';- const arch = 'aarch64-unknown-linux-gnu';- const mode = 'release';- const bundleType = 'deb';+ it("should construct correct Linux arm64 path", () => {+ const basePath = "src-tauri/target";+ const arch = "aarch64-unknown-linux-gnu";+ const mode = "release";+ const bundleType = "deb";- const fullPath = path.join(basePath, arch, mode, 'bundle', bundleType);+ const fullPath = path.join(basePath, arch, mode, "bundle", bundleType);- expect(fullPath).toContain('aarch64-unknown-linux-gnu');- expect(fullPath).toContain('release');- expect(fullPath).toContain('deb');+ expect(fullPath).toContain("aarch64-unknown-linux-gnu");+ expect(fullPath).toContain("release");+ expect(fullPath).toContain("deb");});});- describe('File naming patterns', () => {- it('should match Linux DEB naming pattern', () => {+ describe("File naming patterns", () => {+ it("should match Linux DEB naming pattern", () => {// Format: {name}_{version}_{arch}.debconst pattern = /^[\w-]+_\d+\.\d+\.\d+_(amd64|arm64)\.deb$/;- expect('myapp_1.0.0_amd64.deb').toMatch(pattern);- expect('my-app_2.5.1_arm64.deb').toMatch(pattern);- expect('invalid.deb').not.toMatch(pattern);+ expect("myapp_1.0.0_amd64.deb").toMatch(pattern);+ expect("my-app_2.5.1_arm64.deb").toMatch(pattern);+ expect("invalid.deb").not.toMatch(pattern);});- it('should match Windows MSI naming pattern', () => {+ it("should match Windows MSI naming pattern", () => {// Format: {name}_{version}_{arch}_{language}.msiconst pattern = /^[\w-]+_\d+\.\d+\.\d+_(x64|arm64)_[\w-]+\.msi$/;- expect('myapp_1.0.0_x64_en-US.msi').toMatch(pattern);- expect('my-app_2.5.1_arm64_zh-CN.msi').toMatch(pattern);- expect('invalid.msi').not.toMatch(pattern);+ expect("myapp_1.0.0_x64_en-US.msi").toMatch(pattern);+ expect("my-app_2.5.1_arm64_zh-CN.msi").toMatch(pattern);+ expect("invalid.msi").not.toMatch(pattern);});- it('should match macOS DMG naming pattern', () => {+ it("should match macOS DMG naming pattern", () => {// Format: {name}_{version}_{arch}.dmgconst pattern = /^[\w-]+_\d+\.\d+\.\d+_(universal|x64|aarch64)\.dmg$/;- expect('myapp_1.0.0_universal.dmg').toMatch(pattern);- expect('my-app_2.5.1_x64.dmg').toMatch(pattern);- expect('my-app_3.0.0_aarch64.dmg').toMatch(pattern);- expect('invalid.dmg').not.toMatch(pattern);+ expect("myapp_1.0.0_universal.dmg").toMatch(pattern);+ expect("my-app_2.5.1_x64.dmg").toMatch(pattern);+ expect("my-app_3.0.0_aarch64.dmg").toMatch(pattern);+ expect("invalid.dmg").not.toMatch(pattern);});});- describe('Path traversal safety', () => {- it('should handle paths without directory traversal', () => {+ describe("Path traversal safety", () => {+ it("should handle paths without directory traversal", () => {const safePaths = [- 'src-tauri/target/release/bundle/msi',- 'output/windows',- 'dist/cli.js'+ "src-tauri/target/release/bundle/msi",+ "output/windows",+ "dist/cli.js",];- safePaths.forEach(p => {- expect(p).not.toContain('..');+ safePaths.forEach((p) => {+ expect(p).not.toContain("..");expect(p).not.toMatch(/\.\.[/\\]/);});});- it('should normalize paths correctly', () => {- const inputPath = 'src-tauri/target/../target/release/bundle';+ it("should normalize paths correctly", () => {+ const inputPath = "src-tauri/target/../target/release/bundle";const normalized = path.normalize(inputPath);// path.normalize should resolve the .. reference- expect(normalized).not.toContain('..');- expect(normalized).toContain('target');- expect(normalized).toContain('release');+ expect(normalized).not.toContain("..");+ expect(normalized).toContain("target");+ expect(normalized).toContain("release");});});- describe('Cross-platform path handling', () => {- it('should use correct path separator', () => {- const joined = path.join('src-tauri', 'target', 'release');+ describe("Cross-platform path handling", () => {+ it("should use correct path separator", () => {+ const joined = path.join("src-tauri", "target", "release");// Should not contain wrong separators- if (path.sep === '/') {- expect(joined).not.toContain('\\');+ if (path.sep === "/") {+ expect(joined).not.toContain("\\");} else {- expect(joined).not.toContain('/');+ expect(joined).not.toContain("/");}});- it('should handle paths with both separators', () => {+ it("should handle paths with both separators", () => {// This can happen when paths come from different sources- const mixedPath = 'src-tauri\\target/release';+ const mixedPath = "src-tauri\\target/release";const normalized = path.normalize(mixedPath);// After normalization, should use consistent separatordiff --git a/tests/unit/file-finding.test.js b/tests/unit/file-finding.test.jsindex db9c47bd..9d8c3fde 100644--- a/tests/unit/file-finding.test.js+++ b/tests/unit/file-finding.test.js@@ -5,17 +5,17 @@* across different platforms (Windows, macOS, Linux).*/-import { describe, it, expect, beforeEach, afterEach } from 'vitest';-import fs from 'fs';-import path from 'path';-import os from 'os';+import { describe, it, expect, beforeEach, afterEach } from "vitest";+import fs from "fs";+import path from "path";+import os from "os";-describe('Cross-platform file finding', () => {+describe("Cross-platform file finding", () => {let tempDir;beforeEach(() => {// Create a temporary directory for testing- tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pake-test-'));+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "pake-test-"));});afterEach(() => {@@ -25,7 +25,7 @@ describe('Cross-platform file finding', () => {}});- describe('findFilesByPattern', () => {+ describe("findFilesByPattern", () => {/*** Simulates the fixed findOutputFiles logic from tests/release.js*/@@ -40,16 +40,16 @@ describe('Cross-platform file finding', () => {// Convert glob pattern to regexconst regex = new RegExp(- '^' + pattern.replace(/\*/g, '.*').replace(/\?/g, '.') + '$'+ "^" + pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$",);- const matching = items.filter(item => regex.test(item));+ const matching = items.filter((item) => regex.test(item));- matching.forEach(item => {+ matching.forEach((item) => {const fullPath = path.join(dir, item);try {const stat = fs.statSync(fullPath);- if (stat.isFile() || item.endsWith('.app')) {+ if (stat.isFile() || item.endsWith(".app")) {files.push(fullPath);}} catch (error) {@@ -60,88 +60,88 @@ describe('Cross-platform file finding', () => {return files;}- it('should find exact filename matches', () => {- const testFile = path.join(tempDir, 'test.deb');- fs.writeFileSync(testFile, 'test content');+ it("should find exact filename matches", () => {+ const testFile = path.join(tempDir, "test.deb");+ fs.writeFileSync(testFile, "test content");- const found = findFilesByPattern(tempDir, 'test.deb');+ const found = findFilesByPattern(tempDir, "test.deb");expect(found).toHaveLength(1);expect(found[0]).toBe(testFile);});- it('should find files with wildcard patterns', () => {+ it("should find files with wildcard patterns", () => {const files = [- 'myapp_1.0.0_amd64.deb',- 'myapp_1.0.0_arm64.deb',- 'other.txt'+ "myapp_1.0.0_amd64.deb",+ "myapp_1.0.0_arm64.deb",+ "other.txt",];- files.forEach(file => {- fs.writeFileSync(path.join(tempDir, file), 'test');+ files.forEach((file) => {+ fs.writeFileSync(path.join(tempDir, file), "test");});- const found = findFilesByPattern(tempDir, 'myapp_*.deb');+ const found = findFilesByPattern(tempDir, "myapp_*.deb");expect(found).toHaveLength(2);- expect(found.map(f => path.basename(f)).sort()).toEqual([- 'myapp_1.0.0_amd64.deb',- 'myapp_1.0.0_arm64.deb'+ expect(found.map((f) => path.basename(f)).sort()).toEqual([+ "myapp_1.0.0_amd64.deb",+ "myapp_1.0.0_arm64.deb",]);});- it('should handle question mark wildcards', () => {- const files = ['app1.msi', 'app2.msi', 'app10.msi'];+ it("should handle question mark wildcards", () => {+ const files = ["app1.msi", "app2.msi", "app10.msi"];- files.forEach(file => {- fs.writeFileSync(path.join(tempDir, file), 'test');+ files.forEach((file) => {+ fs.writeFileSync(path.join(tempDir, file), "test");});- const found = findFilesByPattern(tempDir, 'app?.msi');+ const found = findFilesByPattern(tempDir, "app?.msi");expect(found).toHaveLength(2);- expect(found.map(f => path.basename(f)).sort()).toEqual([- 'app1.msi',- 'app2.msi'+ expect(found.map((f) => path.basename(f)).sort()).toEqual([+ "app1.msi",+ "app2.msi",]);});- it('should return empty array for non-existent directory', () => {- const nonExistent = path.join(tempDir, 'does-not-exist');- const found = findFilesByPattern(nonExistent, '*.deb');+ it("should return empty array for non-existent directory", () => {+ const nonExistent = path.join(tempDir, "does-not-exist");+ const found = findFilesByPattern(nonExistent, "*.deb");expect(found).toHaveLength(0);});- it('should work on Windows paths', () => {+ it("should work on Windows paths", () => {// Test with backslashes (Windows-style paths)- const testFile = path.join(tempDir, 'windows-test.msi');- fs.writeFileSync(testFile, 'test content');+ const testFile = path.join(tempDir, "windows-test.msi");+ fs.writeFileSync(testFile, "test content");- const found = findFilesByPattern(tempDir, '*.msi');+ const found = findFilesByPattern(tempDir, "*.msi");expect(found).toHaveLength(1);- expect(path.basename(found[0])).toBe('windows-test.msi');+ expect(path.basename(found[0])).toBe("windows-test.msi");});- it('should handle .app bundles on macOS', () => {- const appBundle = path.join(tempDir, 'MyApp.app');+ it("should handle .app bundles on macOS", () => {+ const appBundle = path.join(tempDir, "MyApp.app");fs.mkdirSync(appBundle, { recursive: true });- const found = findFilesByPattern(tempDir, 'MyApp.app');+ const found = findFilesByPattern(tempDir, "MyApp.app");expect(found).toHaveLength(1);expect(found[0]).toBe(appBundle);});- it('should ignore subdirectories when matching files', () => {- const subdir = path.join(tempDir, 'subdir.deb');+ it("should ignore subdirectories when matching files", () => {+ const subdir = path.join(tempDir, "subdir.deb");fs.mkdirSync(subdir);- const file = path.join(tempDir, 'app.deb');- fs.writeFileSync(file, 'test');+ const file = path.join(tempDir, "app.deb");+ fs.writeFileSync(file, "test");- const found = findFilesByPattern(tempDir, '*.deb');+ const found = findFilesByPattern(tempDir, "*.deb");// Should only find the file, not the directoryexpect(found).toHaveLength(1);@@ -149,7 +149,7 @@ describe('Cross-platform file finding', () => {});});- describe('findInMultipleLocations', () => {+ describe("findInMultipleLocations", () => {/*** Simulates the pattern used in workflow files:* Check project root first, then fallback to bundle directory@@ -164,76 +164,93 @@ describe('Cross-platform file finding', () => {return null;}- it('should find file in first location', () => {- const file1 = path.join(tempDir, 'test.dmg');- fs.writeFileSync(file1, 'test');+ it("should find file in first location", () => {+ const file1 = path.join(tempDir, "test.dmg");+ fs.writeFileSync(file1, "test");const found = findInMultipleLocations([- 'test.dmg',- 'src-tauri/target/release/bundle/dmg/test.dmg'+ "test.dmg",+ "src-tauri/target/release/bundle/dmg/test.dmg",]);expect(found).toBe(file1);});- it('should fallback to second location', () => {- const bundleDir = path.join(tempDir, 'src-tauri/target/release/bundle/dmg');+ it("should fallback to second location", () => {+ const bundleDir = path.join(+ tempDir,+ "src-tauri/target/release/bundle/dmg",+ );fs.mkdirSync(bundleDir, { recursive: true });- const file2 = path.join(bundleDir, 'test.dmg');- fs.writeFileSync(file2, 'test');+ const file2 = path.join(bundleDir, "test.dmg");+ fs.writeFileSync(file2, "test");const found = findInMultipleLocations([- 'test.dmg',- 'src-tauri/target/release/bundle/dmg/test.dmg'+ "test.dmg",+ "src-tauri/target/release/bundle/dmg/test.dmg",]);expect(found).toBe(file2);});- it('should return null when file not found', () => {+ it("should return null when file not found", () => {const found = findInMultipleLocations([- 'test.dmg',- 'other/path/test.dmg'+ "test.dmg",+ "other/path/test.dmg",]);expect(found).toBeNull();});- it('should work with Windows paths', () => {- const msiDir = path.join(tempDir, 'src-tauri', 'target', 'x86_64-pc-windows-msvc', 'release', 'bundle', 'msi');+ it("should work with Windows paths", () => {+ const msiDir = path.join(+ tempDir,+ "src-tauri",+ "target",+ "x86_64-pc-windows-msvc",+ "release",+ "bundle",+ "msi",+ );fs.mkdirSync(msiDir, { recursive: true });- const msiFile = path.join(msiDir, 'test.msi');- fs.writeFileSync(msiFile, 'test');+ const msiFile = path.join(msiDir, "test.msi");+ fs.writeFileSync(msiFile, "test");const found = findInMultipleLocations([- 'test.msi',- 'src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/test.msi'+ "test.msi",+ "src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/test.msi",]);expect(found).toBe(msiFile);});});- describe('Path normalization', () => {- it('should handle mixed slashes', () => {+ describe("Path normalization", () => {+ it("should handle mixed slashes", () => {// This is important for cross-platform compatibility- const mixedPath = 'src-tauri\\target/release\\bundle/msi';+ const mixedPath = "src-tauri\\target/release\\bundle/msi";const normalized = path.normalize(mixedPath);expect(normalized).toBeTruthy();// Should work regardless of platform});- it('should handle path.join correctly on all platforms', () => {- const joined = path.join('src-tauri', 'target', 'release', 'bundle', 'msi');+ it("should handle path.join correctly on all platforms", () => {+ const joined = path.join(+ "src-tauri",+ "target",+ "release",+ "bundle",+ "msi",+ );// Should use platform-specific separatorconst parts = joined.split(path.sep);expect(parts).toHaveLength(5);- expect(parts[0]).toBe('src-tauri');- expect(parts[4]).toBe('msi');+ expect(parts[0]).toBe("src-tauri");+ expect(parts[4]).toBe("msi");});});});