diff --git a/bin/dotfiles.js b/bin/dotfiles.js index 272c9f7..fd5cf48 100644 --- a/bin/dotfiles.js +++ b/bin/dotfiles.js @@ -14,23 +14,28 @@ import { aliases, copies } from "./constants.js"; import fs from "fs/promises"; import os from "os"; import path from "path"; -import { createLogger, transports, format } from 'winston'; +import { createLogger, transports, format } from "winston"; const dir = path.resolve(__dirname, os.homedir()); const logger = createLogger({ - level: 'error', + level: "error", format: format.combine( format.timestamp(), format.json() ), transports: [ new transports.Console(), - new transports.File({ filename: 'error.log' }) + new transports.File({ filename: "error.log" }) ] }); const sleep = (waitTimeInMs) => new Promise((resolve) => setTimeout(resolve, waitTimeInMs)); +// Function to validate and sanitize input +const validateAndSanitizeInput = (input) => { + return input.replace(/[^\w]/g, ""); // Example: Remove non-word characters +}; + const backupAndCopy = async () => { try { for (let i = 0; i < Math.min(aliases.length, copies.length); i++) { @@ -47,11 +52,6 @@ const backupAndCopy = async () => { } }; -// Function to validate and sanitize input -const validateAndSanitizeInput = (input) => { - return input.replace(/[^\w]/g, ''); // Example: Remove non-word characters -}; - const downloadAndUnpack = async () => { try { download(); // download the dotfiles