Skip to content

Commit 7c307fc

Browse files
committed
refactor(commands): remove backup option from clean command
1 parent 11d2cd6 commit 7c307fc

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/commands/clean.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,8 @@ export default defineCommand({
3939
description: 'Regular expression to exclude matching keys',
4040
required: false,
4141
},
42-
backup: {
43-
type: 'boolean',
44-
description: 'Create backup before cleaning',
45-
default: false,
46-
},
4742
},
48-
async run({ args }: { args: { cwd?: string, translationDir?: string, logLevel?: string, include?: string, exclude?: string, backup?: boolean } }) {
43+
async run({ args }: { args: { cwd?: string, translationDir?: string, logLevel?: string, include?: string, exclude?: string } }) {
4944
const cwd = resolve((args.cwd || '.').toString())
5045

5146
const { locales, translationDir: defaultTranslationDir } = await getI18nConfig(cwd, args.logLevel)
@@ -79,18 +74,6 @@ export default defineCommand({
7974
return true
8075
}
8176

82-
// Функция для создания резервной копии
83-
const createBackup = (filePath: string) => {
84-
const backupDir = path.join(translationDir, 'backups')
85-
if (!fs.existsSync(backupDir)) {
86-
fs.mkdirSync(backupDir, { recursive: true })
87-
}
88-
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
89-
const backupPath = path.join(backupDir, `${path.basename(filePath)}.${timestamp}.bak`)
90-
fs.copyFileSync(filePath, backupPath)
91-
consola.info(`Created backup at ${backupPath}`)
92-
}
93-
9477
for (const locale of locales) {
9578
const { code } = locale
9679
const translationFilePath = path.join(translationDir, `${code}.json`)
@@ -100,11 +83,6 @@ export default defineCommand({
10083
continue
10184
}
10285

103-
// Создаем резервную копию, если указана опция backup
104-
if (args.backup) {
105-
createBackup(translationFilePath)
106-
}
107-
10886
let translations: Translations
10987
try {
11088
translations = loadJsonFile(translationFilePath) as Translations

0 commit comments

Comments
 (0)