Comparing version 0.0.795 to 0.0.796
@@ -5,3 +5,4 @@ /* eslint-disable no-console */ | ||
import path from "node:path"; | ||
import { writeFile } from "node:fs/promises"; | ||
import { existsSync } from "node:fs"; | ||
import { writeFile, rename } from "node:fs/promises"; | ||
import { styleText } from "node:util"; | ||
@@ -28,2 +29,17 @@ | ||
if (existsSync(formattedDestPath)) { | ||
const timestamp = new Date().valueOf(); | ||
const renamedTarget = `${VUELESS_CONFIG_FILE_NAME}-backup-${timestamp}${fileExt}`; | ||
await rename(formattedDestPath, renamedTarget); | ||
const warnMessage = styleText( | ||
"yellow", | ||
// eslint-disable-next-line vue/max-len | ||
`Current Vueless config backed into: '${path.basename(renamedTarget)}' folder. Don't forget to remove it before commit.`, | ||
); | ||
console.warn(warnMessage); | ||
} | ||
await writeFile(formattedDestPath, DEFAULT_VUELESS_CONFIG_CONTNET, "utf-8"); | ||
@@ -30,0 +46,0 @@ |
@@ -5,2 +5,4 @@ #!/usr/bin/env node | ||
import { styleText } from "node:util"; | ||
import { commands } from "./commands/index.js"; | ||
@@ -20,7 +22,7 @@ | ||
} else { | ||
throw new Error(`There is no such command: ${command}`); | ||
throw new Error(styleText("red", `There is no such command: ${command}`)); | ||
} | ||
} catch (error) { | ||
console.error(error.message); | ||
console.error(styleText("red", error.message)); | ||
process.exit(error.code || FAILURE_CODE); | ||
} |
{ | ||
"name": "vueless", | ||
"version": "0.0.795", | ||
"version": "0.0.796", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.", |
1063128
22233