Skip to content

Commit

Permalink
fix(dotfiles): 🚑 minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Feb 19, 2024
1 parent dd8ecca commit b3ef810
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/dotfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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
Expand Down

0 comments on commit b3ef810

Please sign in to comment.