Skip to content

Commit

Permalink
Working on workflow...
Browse files Browse the repository at this point in the history
  • Loading branch information
iLiftALot committed Nov 13, 2024
1 parent 64e3fef commit 3520551
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 24 deletions.
29 changes: 7 additions & 22 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {
existsSync,
writeFileSync,
readFileSync,
symlinkSync,
unlinkSync,
lstatSync
copyFileSync
} from "fs";

const banner =
Expand Down Expand Up @@ -155,25 +153,12 @@ const context = await esbuild.context({
})

try {
if (existsSync(targetPath)) {
try {
const stat = lstatSync(targetPath);
if (stat.isDirectory()) {
// Remove directory
rmSync(targetPath, { recursive: true, force: true });
logs.push(`Removed existing directory at ${targetPath}`);
} else {
// Remove file or symlink
unlinkSync(targetPath);
logs.push(`Removed existing file/symlink at ${targetPath}`);
}
} catch (unlinkError) {
console.error(`Error removing existing file/symlink: ${unlinkError}\nLogs:\n${logs.join('\n')}`);
process.exit(1);
}
}
symlinkSync(sourcePath, targetPath);
logs.push(`Symlink created: ${targetPath} -> ${sourcePath}`);
//symlinkSync(sourcePath, targetPath);
//logs.push(`Symlink created: ${targetPath} -> ${sourcePath}`);

// Copy the file instead of creating a symlink
copyFileSync(sourcePath, targetPath);
logs.push(`Copied file: ${sourcePath} -> ${targetPath}`);
} catch (error) {
console.error(`Error creating symlink: ${error}\nLogs:\n${logs.join('\n')}`);
process.exit(1);
Expand Down
1 change: 0 additions & 1 deletion main.js

This file was deleted.

Loading

0 comments on commit 3520551

Please sign in to comment.