appclean 2.0.0 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.github/workflows/npm-publish.yml +104 -0
  2. package/DEVELOPMENT.md +84 -0
  3. package/RELEASE_GUIDE.md +257 -0
  4. package/RELEASE_QUICK_START.md +176 -0
  5. package/assets/logo.svg +48 -32
  6. package/dist/index.js +1 -1
  7. package/dist/ui/client/api/client.d.ts.map +1 -1
  8. package/dist/ui/client/api/client.js +5 -1
  9. package/dist/ui/client/api/client.js.map +1 -1
  10. package/dist/ui/client/app.d.ts +1 -1
  11. package/dist/ui/client/app.d.ts.map +1 -1
  12. package/dist/ui/client/app.js +10 -6
  13. package/dist/ui/client/app.js.map +1 -1
  14. package/dist/ui/client/index.html +103 -46
  15. package/dist/ui/client/pages/appSearch.js +12 -1
  16. package/dist/ui/client/pages/appSearch.js.map +1 -1
  17. package/dist/ui/client/pages/dashboard.d.ts.map +1 -1
  18. package/dist/ui/client/pages/dashboard.js +26 -5
  19. package/dist/ui/client/pages/dashboard.js.map +1 -1
  20. package/dist/ui/client/state/appStore.d.ts.map +1 -1
  21. package/dist/ui/client/state/appStore.js +21 -12
  22. package/dist/ui/client/state/appStore.js.map +1 -1
  23. package/dist/ui/client/state/dashboardStore.d.ts.map +1 -1
  24. package/dist/ui/client/state/dashboardStore.js +9 -3
  25. package/dist/ui/client/state/dashboardStore.js.map +1 -1
  26. package/dist/ui/client/styles/animations.css +384 -2
  27. package/dist/ui/client/styles/base.css +347 -73
  28. package/dist/ui/client/styles/components.css +566 -189
  29. package/dist/ui/client/styles/layout.css +618 -1
  30. package/dist/ui/client/styles/responsive.css +388 -0
  31. package/dist/ui/client/styles/variables.css +163 -69
  32. package/dist/ui/guiServer.d.ts +3 -0
  33. package/dist/ui/guiServer.d.ts.map +1 -1
  34. package/dist/ui/guiServer.js +48 -1
  35. package/dist/ui/guiServer.js.map +1 -1
  36. package/dist/utils/upgrade.d.ts +2 -1
  37. package/dist/utils/upgrade.d.ts.map +1 -1
  38. package/dist/utils/upgrade.js +14 -1
  39. package/dist/utils/upgrade.js.map +1 -1
  40. package/package.json +1 -1
  41. package/scripts/publish-npm.sh +64 -0
  42. package/src/index.ts +1 -1
  43. package/src/ui/client/api/client.ts +6 -1
  44. package/src/ui/client/app.ts +15 -11
  45. package/src/ui/client/index.html +103 -46
  46. package/src/ui/client/pages/appSearch.ts +14 -1
  47. package/src/ui/client/pages/dashboard.ts +27 -5
  48. package/src/ui/client/state/appStore.ts +24 -12
  49. package/src/ui/client/state/dashboardStore.ts +13 -3
  50. package/src/ui/client/styles/animations.css +384 -2
  51. package/src/ui/client/styles/base.css +347 -73
  52. package/src/ui/client/styles/components.css +566 -189
  53. package/src/ui/client/styles/layout.css +618 -1
  54. package/src/ui/client/styles/responsive.css +388 -0
  55. package/src/ui/client/styles/variables.css +163 -69
  56. package/src/ui/guiServer.ts +67 -1
  57. package/src/utils/upgrade.ts +18 -1
@@ -8,6 +8,7 @@ import { readFileSync, existsSync } from 'fs';
8
8
  import { join } from 'path';
9
9
  import { fileURLToPath } from 'url';
10
10
  import { dirname } from 'path';
11
+ import { execFile, spawn, type ChildProcess } from 'child_process';
11
12
  import { Logger } from '../utils/logger.js';
12
13
  import { sendJson, sendError, parseQueryParams } from './server/middleware/errorHandler.js';
13
14
  import { handleAppRoutes } from './server/routes/apps.js';
@@ -22,6 +23,7 @@ export class GUIServer {
22
23
  private port: number = 3000;
23
24
  private server: any;
24
25
  private spaHtml: string | null = null;
26
+ private browserProcess: ChildProcess | null = null;
25
27
 
26
28
  constructor(port: number = 3000) {
27
29
  this.port = port;
@@ -41,9 +43,13 @@ export class GUIServer {
41
43
  });
42
44
 
43
45
  return new Promise((resolve) => {
44
- this.server.listen(this.port, () => {
46
+ this.server.listen(this.port, async () => {
45
47
  Logger.success(`✨ AppClean GUI running at http://localhost:${this.port}`);
46
48
  Logger.info('Press Ctrl+C to stop the server');
49
+
50
+ // Open the default browser
51
+ await this.openBrowser();
52
+
47
53
  resolve();
48
54
  });
49
55
  });
@@ -53,12 +59,72 @@ export class GUIServer {
53
59
  * Stop GUI server
54
60
  */
55
61
  async stop(): Promise<void> {
62
+ // Close the browser
63
+ await this.closeBrowser();
64
+
56
65
  if (this.server) {
57
66
  this.server.close();
58
67
  Logger.info('GUI server stopped');
59
68
  }
60
69
  }
61
70
 
71
+ /**
72
+ * Open the default browser
73
+ */
74
+ private async openBrowser(): Promise<void> {
75
+ const url = `http://localhost:${this.port}`;
76
+
77
+ try {
78
+ const platform = process.platform;
79
+
80
+ if (platform === 'darwin') {
81
+ // macOS
82
+ this.browserProcess = execFile('open', [url]);
83
+ } else if (platform === 'win32') {
84
+ // Windows
85
+ this.browserProcess = execFile('cmd', ['/c', 'start', url]);
86
+ } else {
87
+ // Linux and other Unix-like systems
88
+ this.browserProcess = execFile('xdg-open', [url]);
89
+ }
90
+
91
+ this.browserProcess.on('error', (error) => {
92
+ Logger.warn(`Could not open browser: ${error.message}`);
93
+ });
94
+ } catch (error) {
95
+ Logger.warn(`Failed to open browser: ${(error as Error).message}`);
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Close the browser
101
+ */
102
+ private async closeBrowser(): Promise<void> {
103
+ if (!this.browserProcess) {
104
+ return;
105
+ }
106
+
107
+ try {
108
+ const platform = process.platform;
109
+
110
+ if (platform === 'win32') {
111
+ // Windows: kill the process
112
+ if (this.browserProcess.pid) {
113
+ process.kill(this.browserProcess.pid, 'SIGTERM');
114
+ }
115
+ } else {
116
+ // macOS and Linux: kill the process
117
+ if (this.browserProcess.pid) {
118
+ process.kill(this.browserProcess.pid);
119
+ }
120
+ }
121
+
122
+ this.browserProcess = null;
123
+ } catch (error) {
124
+ Logger.debug(`Note: Could not close browser process: ${(error as Error).message}`);
125
+ }
126
+ }
127
+
62
128
  /**
63
129
  * Main request handler
64
130
  */
@@ -1,5 +1,8 @@
1
1
  import { execSync } from 'child_process';
2
2
  import { Logger } from './logger.js';
3
+ import { readFileSync } from 'fs';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
3
6
 
4
7
  export interface VersionInfo {
5
8
  current: string;
@@ -9,7 +12,21 @@ export interface VersionInfo {
9
12
 
10
13
  export class UpgradeManager {
11
14
  private readonly packageName = 'appclean';
12
- private readonly currentVersion = '1.9.0';
15
+ private currentVersion: string;
16
+
17
+ constructor() {
18
+ // Dynamically read version from package.json
19
+ try {
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = dirname(__filename);
22
+ const packagePath = join(__dirname, '../../package.json');
23
+ const packageData = JSON.parse(readFileSync(packagePath, 'utf-8'));
24
+ this.currentVersion = packageData.version || '2.0.0';
25
+ } catch (error) {
26
+ Logger.debug('Failed to read version from package.json, using fallback');
27
+ this.currentVersion = '2.0.0';
28
+ }
29
+ }
13
30
 
14
31
  /**
15
32
  * Get version information from npm registry