Updates
This commit is contained in:
Vendored
+3
-1
@@ -1,6 +1,8 @@
|
||||
import { TurboSyncConfigObject } from "../types";
|
||||
type Params = {
|
||||
dirs?: string[];
|
||||
files?: string[];
|
||||
config: TurboSyncConfigObject;
|
||||
};
|
||||
export default function getLatestSource({ dirs, files, }: Params): string | undefined;
|
||||
export default function getLatestSource({ dirs, files, config, }: Params): string | undefined;
|
||||
export {};
|
||||
|
||||
Vendored
+9
-1
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = getLatestSource;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
function getLatestSource({ dirs, files, }) {
|
||||
function getLatestSource({ dirs, files, config, }) {
|
||||
let latestDir = undefined;
|
||||
let latestMtime = 0;
|
||||
const isFiles = files === null || files === void 0 ? void 0 : files[0];
|
||||
@@ -28,6 +28,10 @@ function getLatestSource({ dirs, files, }) {
|
||||
console.error(`Error accessing ${pth}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
if (latestDir) {
|
||||
if (isDirEmptySync(latestDir))
|
||||
return undefined;
|
||||
}
|
||||
return latestDir;
|
||||
}
|
||||
function getLatestDirMtime(dir) {
|
||||
@@ -55,3 +59,7 @@ function getLatestDirMtime(dir) {
|
||||
}
|
||||
return latestMtime;
|
||||
}
|
||||
function isDirEmptySync(path) {
|
||||
const files = fs_1.default.readdirSync(path);
|
||||
return files.length === 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user