ai-renamer
Advanced tools
Comparing version 1.0.15 to 1.0.16
{ | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"license": "GPL-3.0", | ||
@@ -4,0 +4,0 @@ "name": "ai-renamer", |
@@ -9,6 +9,7 @@ const path = require('path') | ||
module.exports = async ({ model, _case, chars, language, filePath }) => { | ||
module.exports = async ({ model, _case, chars, language, filePath, inputPath }) => { | ||
try { | ||
const fileName = path.basename(filePath) | ||
const ext = path.extname(filePath).toLowerCase() | ||
const relativeFilePath = path.relative(inputPath, filePath) | ||
@@ -18,3 +19,3 @@ if (fileName === '.DS_Store') return | ||
if (!isProcessableFile({ filePath })) { | ||
console.log(`🟡 Unsupported file: ${fileName}`) | ||
console.log(`🟡 Unsupported file: ${relativeFilePath}`) | ||
return | ||
@@ -30,3 +31,3 @@ } | ||
if (!content) { | ||
console.log(`🔴 No text content: ${fileName}`) | ||
console.log(`🔴 No text content: ${relativeFilePath}`) | ||
return | ||
@@ -38,3 +39,3 @@ } | ||
if (!newName) { | ||
console.log(`🔴 No new name: ${fileName}`) | ||
console.log(`🔴 No new name: ${relativeFilePath}`) | ||
return | ||
@@ -44,3 +45,4 @@ } | ||
const newFileName = await saveFile({ ext, newName, filePath }) | ||
console.log(`🟢 Renamed: ${fileName} to ${newFileName}`) | ||
const relativeNewFilePath = path.join(path.dirname(relativeFilePath), newFileName) | ||
console.log(`🟢 Renamed: ${relativeFilePath} to ${relativeNewFilePath}`) | ||
} catch (err) { | ||
@@ -47,0 +49,0 @@ throw new Error(err.message) |
@@ -27,3 +27,3 @@ const fs = require('fs').promises | ||
const stats = await fs.stat(inputPath) | ||
const options = { model, _case, chars, language, includeSubdirectories } | ||
const options = { model, _case, chars, language, inputPath, includeSubdirectories } | ||
@@ -30,0 +30,0 @@ if (stats.isDirectory()) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49210
325