Skip to content

Commit eb5dea4

Browse files
committed
Fixes
1 parent ab3f280 commit eb5dea4

5 files changed

Lines changed: 67 additions & 19 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
name: Build and Release
22

33
on:
4-
workflow_run:
5-
workflows: ["Tests"]
6-
types:
7-
- completed
4+
push:
85
branches: ["main", "develop", "feature/*"]
96

107
jobs:
118
build-windows:
12-
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop' || startsWith(github.event.workflow_run.head_branch, 'feature/'))
9+
if: github.event_name == 'push' || (github.ref_name == 'develop' || github.ref_name == 'main' || startsWith(github.ref_name, 'feature/'))
1310
runs-on: windows-latest
1411

1512
outputs:
@@ -42,7 +39,7 @@ jobs:
4239
run: |
4340
$version = (Get-Content package.json | ConvertFrom-Json).version
4441
$shortHash = git rev-parse --short HEAD
45-
$branch = "${{ github.event.workflow_run.head_branch }}"
42+
$branch = "${{ github.ref_name }}"
4643
4744
if ($branch -eq "develop") {
4845
$finalVersion = "v$version-dev-$shortHash"
@@ -70,7 +67,7 @@ jobs:
7067
dist/DevNullifier-win-unpacked.zip
7168
7269
build-linux:
73-
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop' || startsWith(github.event.workflow_run.head_branch, 'feature/'))
70+
if: github.event_name == 'push' || (github.ref_name == 'develop' || github.ref_name == 'main' || startsWith(github.ref_name, 'feature/'))
7471
runs-on: ubuntu-latest
7572

7673
steps:
@@ -112,7 +109,7 @@ jobs:
112109
dist/DevNullifier-linux-unpacked.zip
113110
114111
build-macos:
115-
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop' || startsWith(github.event.workflow_run.head_branch, 'feature/'))
112+
if: github.event_name == 'push' || (github.ref_name == 'develop' || github.ref_name == 'main' || startsWith(github.ref_name, 'feature/'))
116113
runs-on: macos-latest
117114

118115
steps:
@@ -151,7 +148,7 @@ jobs:
151148
dist/DevNullifier-mac-unpacked.zip
152149
153150
create-release:
154-
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop')
151+
if: github.event_name == 'push' || (github.ref_name == 'develop' || github.ref_name == 'main')
155152
runs-on: ubuntu-latest
156153
needs: [build-windows, build-linux, build-macos]
157154

@@ -187,7 +184,7 @@ jobs:
187184
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188185
with:
189186
tag_name: ${{ needs.build-windows.outputs.version }}
190-
release_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier [Pre-release]' || 'DevNullifier' }} ${{ needs.build-windows.outputs.version }}
187+
release_name: ${{ github.ref_name == 'develop' && 'DevNullifier [Pre-release]' || 'DevNullifier' }} ${{ needs.build-windows.outputs.version }}
191188
draft: false
192189
prerelease: ${{ needs.build-windows.outputs.prerelease == 'true' }}
193190

@@ -204,7 +201,7 @@ jobs:
204201
with:
205202
upload_url: ${{ steps.create_release.outputs.upload_url }}
206203
asset_path: ${{ steps.find-windows-installer.outputs.installer_path }}
207-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-Setup-dev.exe' || 'DevNullifier-Setup.exe' }}
204+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-Setup-dev.exe' || 'DevNullifier-Setup.exe' }}
208205
asset_content_type: application/octet-stream
209206

210207
- name: Upload Windows ZIP Archive
@@ -214,7 +211,7 @@ jobs:
214211
with:
215212
upload_url: ${{ steps.create_release.outputs.upload_url }}
216213
asset_path: artifacts/windows/DevNullifier-win-unpacked.zip
217-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-win-unpacked-dev.zip' || 'DevNullifier-win-unpacked.zip' }}
214+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-win-unpacked-dev.zip' || 'DevNullifier-win-unpacked.zip' }}
218215
asset_content_type: application/zip
219216

220217
- name: Find Linux files
@@ -238,7 +235,7 @@ jobs:
238235
with:
239236
upload_url: ${{ steps.create_release.outputs.upload_url }}
240237
asset_path: ${{ steps.find-linux-files.outputs.appimage_path }}
241-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-linux-x64-dev.AppImage' || 'DevNullifier-linux-x64.AppImage' }}
238+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.AppImage' || 'DevNullifier-linux-x64.AppImage' }}
242239
asset_content_type: application/octet-stream
243240

244241
- name: Upload Linux DEB
@@ -248,7 +245,7 @@ jobs:
248245
with:
249246
upload_url: ${{ steps.create_release.outputs.upload_url }}
250247
asset_path: ${{ steps.find-linux-files.outputs.deb_path }}
251-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-linux-x64-dev.deb' || 'DevNullifier-linux-x64.deb' }}
248+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.deb' || 'DevNullifier-linux-x64.deb' }}
252249
asset_content_type: application/octet-stream
253250

254251
- name: Upload Linux ZIP Archive
@@ -258,7 +255,7 @@ jobs:
258255
with:
259256
upload_url: ${{ steps.create_release.outputs.upload_url }}
260257
asset_path: artifacts/linux/DevNullifier-linux-unpacked.zip
261-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-linux-unpacked-dev.zip' || 'DevNullifier-linux-unpacked.zip' }}
258+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-unpacked-dev.zip' || 'DevNullifier-linux-unpacked.zip' }}
262259
asset_content_type: application/zip
263260

264261
- name: Upload macOS DMG
@@ -268,7 +265,7 @@ jobs:
268265
with:
269266
upload_url: ${{ steps.create_release.outputs.upload_url }}
270267
asset_path: ${{ steps.find-macos-files.outputs.dmg_path }}
271-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-mac-x64-dev.dmg' || 'DevNullifier-mac-x64.dmg' }}
268+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-mac-x64-dev.dmg' || 'DevNullifier-mac-x64.dmg' }}
272269
asset_content_type: application/octet-stream
273270

274271
- name: Upload macOS ZIP Archive
@@ -278,5 +275,5 @@ jobs:
278275
with:
279276
upload_url: ${{ steps.create_release.outputs.upload_url }}
280277
asset_path: artifacts/macos/DevNullifier-mac-unpacked.zip
281-
asset_name: ${{ github.event.workflow_run.head_branch == 'develop' && 'DevNullifier-mac-unpacked-dev.zip' || 'DevNullifier-mac-unpacked.zip' }}
278+
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-mac-unpacked-dev.zip' || 'DevNullifier-mac-unpacked.zip' }}
282279
asset_content_type: application/zip

src/main/__tests__/developerScanWorker.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,56 @@ describe("developerScanWorker", () => {
293293
expect(Array.isArray(result)).toBe(true);
294294
});
295295

296+
it("should continue scanning subdirectories when project has no caches", async () => {
297+
// Mock initial directory read
298+
vi
299+
.mocked(fs.readdir)
300+
.mockResolvedValueOnce(
301+
[
302+
mockDirEntry("package.json", false),
303+
mockDirEntry("subproject", true)
304+
] as any
305+
) // Root dir
306+
.mockResolvedValueOnce([mockDirEntry("package.json", false)] as any); // Subproject dir
307+
308+
// Mock calculateCacheSizes to return no caches for root project but some for subproject
309+
const mockCalculateCacheSizes = vi.spyOn(worker, "calculateCacheSizes");
310+
mockCalculateCacheSizes
311+
.mockResolvedValueOnce({ caches: [], totalSize: 0 }) // Root project
312+
.mockResolvedValueOnce({
313+
caches: [
314+
{
315+
pattern: "node_modules",
316+
category: "TestProject",
317+
matches: [],
318+
totalSize: 1000,
319+
selectedSize: 0,
320+
expanded: false
321+
}
322+
],
323+
totalSize: 1000
324+
}); // Subproject
325+
326+
// Mock fs.stat
327+
vi.mocked(fs.stat).mockResolvedValue(
328+
{
329+
isDirectory: () => true,
330+
mtime: new Date(),
331+
size: 1000
332+
} as any
333+
);
334+
335+
const result = await worker.scanDeveloperProjects(
336+
["/test/path"],
337+
[mockCategory]
338+
);
339+
340+
// Should find one project (the subproject)
341+
expect(result).toHaveLength(1);
342+
expect(result[0].path).toContain("/test/path");
343+
expect(result[0].totalCacheSize).toBe(2000);
344+
});
345+
296346
it("should handle scan errors gracefully", async () => {
297347
// Mock fs.readdir to throw error
298348
vi.mocked(fs.readdir).mockRejectedValue(new Error("Test error"));

src/main/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ ipcMain.handle("scan-folders", async (event, { paths, maxDepth }) => {
6767
// If there's an existing scan, terminate it
6868
if (currentAppDataScanWorker) {
6969
currentAppDataScanWorker.terminate();
70+
currentAppDataScanWorker = null;
7071
}
7172

7273
return new Promise((resolve, reject) => {

src/main/preload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface ElectronAPI {
4141
getSavedFoldersCount: () => Promise<number>;
4242
getDirectorySize: (path: string) => Promise<number>;
4343
saveDeveloperProjects: (projects: ProjectInfo[]) => Promise<void>;
44-
loadSavedDeveloperProjects: () => Promise<ProjectInfo>;
44+
loadSavedDeveloperProjects: () => Promise<ProjectInfo[]>;
4545
getSavedDeveloperProjectsCount: () => Promise<number>;
4646
}
4747

src/renderer/components/AppDataCleaner/ControlPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<v-row align="center">
77
<!-- Scan button -->
88
<v-col cols="auto">
9-
<v-btn :color="isScanning ? 'error' : 'primary'" :loading="false" :disabled="isDeleting"
9+
<v-btn :color="isScanning ? 'error' : 'primary'" :disabled="isDeleting"
1010
@click="isScanning ? $emit('stop-scan') : $emit('scan')">
1111
<v-icon left>{{ isScanning ? 'mdi-stop' : 'mdi-magnify' }}</v-icon>
1212
{{ isScanning ? 'Stop' : 'Scan' }}

0 commit comments

Comments
 (0)