Skip to content

Commit 4c75653

Browse files
author
ozelot379
committed
WIP
1 parent a990947 commit 4c75653

4 files changed

Lines changed: 15 additions & 19 deletions

File tree

‎src/input/entry/FileInputEntry.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FileInputEntry extends BufferInputEntry {
2222
await writeFile(destPath, this.buffer);
2323
} else {
2424
// File is a normal Buffer
25-
return super.applyToFolder(folder);
25+
await super.applyToFolder(folder);
2626
}
2727
}
2828

@@ -41,7 +41,7 @@ class FileInputEntry extends BufferInputEntry {
4141
zip.file(destPath, this.buffer);
4242
} else {
4343
// File is a normal Blob
44-
return super.applyToZip(zip);
44+
await super.applyToZip(zip);
4545
}
4646
}
4747

‎src/input/entry/LocalFileInputEntry.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class LocalFileInputEntry extends BufferInputEntry {
2828
async applyToFolder(folder) {
2929
await this.read();
3030

31-
return super.applyToFolder(folder);
31+
await super.applyToFolder(folder);
3232
}
3333

3434
/**
@@ -37,7 +37,7 @@ class LocalFileInputEntry extends BufferInputEntry {
3737
async applyToZip(zip) {
3838
await this.read();
3939

40-
return super.applyToZip(zip);
40+
await super.applyToZip(zip);
4141
}
4242

4343
/**

‎src/output/BufferOutput.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BufferOutput extends AbstractOutput {
2323
* @inheritDoc
2424
*/
2525
async applyInputEntry(entry) {
26-
return entry.applyToZip(this.zip);
26+
await entry.applyToZip(this.zip);
2727
}
2828

2929
/**
@@ -73,7 +73,7 @@ class BufferOutput extends AbstractOutput {
7373
* @inheritDoc
7474
*/
7575
async read(file) {
76-
return this.zip.file(file).async("nodebuffer");
76+
await this.zip.file(file).async("nodebuffer");
7777
}
7878

7979
/**

‎src/output/LocalFolderOutput.mjs‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {AbstractOutput} from "./AbstractOutput.mjs";
2-
import {copyFile, mkdir, readdir, readFile, rmdir, stat, writeFile} from "fs/promises";
2+
import {copyFile, mkdir, readdir, readFile, rename, rmdir, stat, writeFile} from "fs/promises";
33
import {dirname, join} from "path";
44
import {existsSync} from "fs";
5-
import fs_extra from "fs-extra";
65

76
/**
87
* Class LocalFolderOutput
@@ -33,20 +32,15 @@ class LocalFolderOutput extends AbstractOutput {
3332
if (await this.exists(".")) {
3433
this.log.log(`Remove exists output`);
3534

36-
try {
37-
return this.delete(".");
38-
} catch (err) {
39-
// TODO: Bug on Windows? (EPERM: operation not permitted (rmdir))
40-
this.log.warn(err);
41-
}
35+
await this.delete(".");
4236
}
4337
}
4438

4539
/**
4640
* @inheritDoc
4741
*/
4842
async applyInputEntry(entry) {
49-
return entry.applyToFolder(this.path);
43+
await entry.applyToFolder(this.path);
5044
}
5145

5246
/**
@@ -69,9 +63,11 @@ class LocalFolderOutput extends AbstractOutput {
6963
* @inheritDoc
7064
*/
7165
async rename(from, to) {
72-
return fs_extra.move(this.p(from), this.p(to), {
73-
overwrite: true
74-
});
66+
if (await this.output.exists(to)) {
67+
await this.delete(to);
68+
}
69+
70+
await rename(this.p(from), this.p(to));
7571
}
7672

7773
/**
@@ -93,7 +89,7 @@ class LocalFolderOutput extends AbstractOutput {
9389
* @inheritDoc
9490
*/
9591
async delete(path) {
96-
return rmdir(this.p(path), {recursive: true});
92+
await rmdir(this.p(path), {recursive: true});
9793
}
9894

9995
/**

0 commit comments

Comments
 (0)