Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Aug 18, 2024
1 parent 06a873f commit 3b4825e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
12 changes: 4 additions & 8 deletions Source/Function/Copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async (Option: Partial<Option> = {}): Promise<Plugin> => {
return;
}

if (!Format.length) {
if (Format.length === 0) {
return;
}

Expand Down Expand Up @@ -79,26 +79,22 @@ export default async (Option: Partial<Option> = {}): Promise<Plugin> => {
// The final value of outDirResolveFrom will be used by all asset pairs
// Both relative and absolute path are okay
await Log(
`Resolve assert pair to path from: ${(
await import("path")
).resolve(outDirResolveFrom)}`,
`Resolve assert pair to path from: ${(await import("path")).resolve(outDirResolveFrom)}`,
Verbose,
);

for (const { from, to } of Format) {
const deduplicatedPaths = [
...new Set(
await (
await import("fast-glob")
).default(from, {
await (await import("fast-glob")).default(from, {
// Ensure outputs contains only file path
onlyFiles: true,
...Glob,
}),
),
];

if (!deduplicatedPaths.length) {
if (deduplicatedPaths.length === 0) {
await Log(
`No files matched using current glob pattern: ${Chalk.white(
from,
Expand Down
2 changes: 1 addition & 1 deletion Source/Function/Ensure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @module Ensure
*
*/
export default <T>(item: MaybeArray<T>): Array<T> => {
export default <T>(item: MaybeArray<T>): T[] => {
return Array.isArray(item) ? item : [item];
};

Expand Down
8 changes: 3 additions & 5 deletions Source/Function/Handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async (

// only works for /**/*(.ext) pattern
// ./assets/** → ./assets
const startFragment = dir.replace(`/**`, "");
const startFragment = dir.replace("/**", "");

// globbedFromPath: /PATH/TO/assets/foo.js → /foo.js
// globbedFromPath: /PATH/TO/assets/nest/foo.js → /nest/foo.js
Expand Down Expand Up @@ -69,9 +69,7 @@ export default async (

if (!Dry) {
try {
await (
await import("fs/promises")
).access(
await (await import("fs/promises")).access(
(await import("path")).dirname(composedDistDirPath),
(await import("fs/promises")).constants.R_OK,
);
Expand All @@ -81,7 +79,7 @@ export default async (
composedDistDirPath,
);
} catch (_Error) {
Log(new String(_Error).toString(), Verbose);
Log(String(_Error).toString(), Verbose);
}
}

Expand Down

0 comments on commit 3b4825e

Please sign in to comment.