Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

Auto-fix formatting issues

GitHub Action392c2591225e
diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts
index b11c66c7..f5a1c5ce 100644
--- a/bin/helpers/merge.ts
+++ b/bin/helpers/merge.ts
@@ -3,7 +3,11 @@ import fsExtra from 'fs-extra';
import combineFiles from '@/utils/combine';
import logger from '@/options/logger';
-import { generateSafeFilename, generateIdentifierSafeName, getSafeAppName } from '@/utils/name';
+import {
+ generateSafeFilename,
+ generateIdentifierSafeName,
+ getSafeAppName,
+} from '@/utils/name';
import { PakeAppOptions, PlatformMap } from '@/types';
import { tauriConfigDirectory, npmDirectory } from '@/utils/dir';
diff --git a/bin/utils/name.test.ts b/bin/utils/name.test.ts
index 23ffcb11..74950eb1 100644
--- a/bin/utils/name.test.ts
+++ b/bin/utils/name.test.ts
@@ -1,87 +1,86 @@
-
import { describe, it, expect } from 'vitest';
import { getSafeAppName } from './name';
describe('getSafeAppName', () => {
- it('should handle simple names', () => {
- expect(getSafeAppName('MyApp')).toBe('myapp');
- });
-
- it('should handle names with spaces', () => {
- expect(getSafeAppName('My App')).toBe('my_app');
- });
-
- it('should handle names with hyphens', () => {
- expect(getSafeAppName('my-app')).toBe('my-app');
- });
-
- it('should handle Chinese names', () => {
- expect(getSafeAppName('我的应用')).toBe('我的应用');
- });
-
- it('should handle mixed Chinese and English', () => {
- expect(getSafeAppName('我的 App')).toBe('我的_app');
- });
-
- it('should preserve special characters like @', () => {
- expect(getSafeAppName('App@2024')).toBe('app@2024');
- });
-
- it('should replace forward slashes', () => {
- expect(getSafeAppName('My/App')).toBe('my_app');
- });
-
- it('should replace backslashes', () => {
- expect(getSafeAppName('My\\App')).toBe('my_app');
- });
-
- it('should replace colons', () => {
- expect(getSafeAppName('App:Name')).toBe('app_name');
- });
-
- it('should replace asterisks', () => {
- expect(getSafeAppName('App*Name')).toBe('app_name');
- });
-
- it('should replace question marks', () => {
- expect(getSafeAppName('App?Name')).toBe('app_name');
- });
-
- it('should replace double quotes', () => {
- expect(getSafeAppName('App"Name')).toBe('app_name');
- });
-
- it('should replace angle brackets', () => {
- expect(getSafeAppName('App<Name>')).toBe('app_name_');
- });
-
- it('should replace pipes', () => {
- expect(getSafeAppName('App|Name')).toBe('app_name');
- });
-
- it('should handle all uppercase names', () => {
- expect(getSafeAppName('APP')).toBe('app');
- });
-
- it('should handle single character names', () => {
- expect(getSafeAppName('a')).toBe('a');
- });
-
- it('should handle numeric names', () => {
- expect(getSafeAppName('123')).toBe('123');
- });
-
- it('should handle leading/trailing spaces', () => {
- expect(getSafeAppName(' App ')).toBe('_app_');
- });
-
- it('should handle trailing dots', () => {
- expect(getSafeAppName('App...')).toBe('app');
- });
-
- it('should truncate very long names', () => {
- const longName = 'A'.repeat(300);
- const expected = 'a'.repeat(255);
- expect(getSafeAppName(longName)).toBe(expected);
- });
+ it('should handle simple names', () => {
+ expect(getSafeAppName('MyApp')).toBe('myapp');
+ });
+
+ it('should handle names with spaces', () => {
+ expect(getSafeAppName('My App')).toBe('my_app');
+ });
+
+ it('should handle names with hyphens', () => {
+ expect(getSafeAppName('my-app')).toBe('my-app');
+ });
+
+ it('should handle Chinese names', () => {
+ expect(getSafeAppName('我的应用')).toBe('我的应用');
+ });
+
+ it('should handle mixed Chinese and English', () => {
+ expect(getSafeAppName('我的 App')).toBe('我的_app');
+ });
+
+ it('should preserve special characters like @', () => {
+ expect(getSafeAppName('App@2024')).toBe('app@2024');
+ });
+
+ it('should replace forward slashes', () => {
+ expect(getSafeAppName('My/App')).toBe('my_app');
+ });
+
+ it('should replace backslashes', () => {
+ expect(getSafeAppName('My\\App')).toBe('my_app');
+ });
+
+ it('should replace colons', () => {
+ expect(getSafeAppName('App:Name')).toBe('app_name');
+ });
+
+ it('should replace asterisks', () => {
+ expect(getSafeAppName('App*Name')).toBe('app_name');
+ });
+
+ it('should replace question marks', () => {
+ expect(getSafeAppName('App?Name')).toBe('app_name');
+ });
+
+ it('should replace double quotes', () => {
+ expect(getSafeAppName('App"Name')).toBe('app_name');
+ });
+
+ it('should replace angle brackets', () => {
+ expect(getSafeAppName('App<Name>')).toBe('app_name_');
+ });
+
+ it('should replace pipes', () => {
+ expect(getSafeAppName('App|Name')).toBe('app_name');
+ });
+
+ it('should handle all uppercase names', () => {
+ expect(getSafeAppName('APP')).toBe('app');
+ });
+
+ it('should handle single character names', () => {
+ expect(getSafeAppName('a')).toBe('a');
+ });
+
+ it('should handle numeric names', () => {
+ expect(getSafeAppName('123')).toBe('123');
+ });
+
+ it('should handle leading/trailing spaces', () => {
+ expect(getSafeAppName(' App ')).toBe('_app_');
+ });
+
+ it('should handle trailing dots', () => {
+ expect(getSafeAppName('App...')).toBe('app');
+ });
+
+ it('should truncate very long names', () => {
+ const longName = 'A'.repeat(300);
+ const expected = 'a'.repeat(255);
+ expect(getSafeAppName(longName)).toBe(expected);
+ });
});
diff --git a/tests/index.js b/tests/index.js
index 1f6f3b5d..6c0611fc 100644
--- a/tests/index.js
+++ b/tests/index.js
@@ -46,14 +46,18 @@ class PakeTestRunner {
console.log("\n🧪 Running Project Unit Tests (Vitest)...");
try {
execSync("npm run test:unit", {
- stdio: "inherit",
- cwd: config.PROJECT_ROOT
+ stdio: "inherit",
+ cwd: config.PROJECT_ROOT,
});
this.results.push({ name: "Vitest Unit Tests", passed: true });
testCount++;
} catch (e) {
console.log("❌ Vitest unit tests failed");
- this.results.push({ name: "Vitest Unit Tests", passed: false, error: e.message });
+ this.results.push({
+ name: "Vitest Unit Tests",
+ passed: false,
+ error: e.message,
+ });
}
}
diff --git a/vitest.config.ts b/vitest.config.ts
index e8e1a11e..63cd8c55 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -1,4 +1,3 @@
-
import { defineConfig } from 'vitest/config';
import path from 'path';