Comparing version 1.0.9 to 1.0.10
55
cli.js
@@ -118,5 +118,6 @@ #!/usr/bin/env node | ||
function getDirFiles(directory, callback) { | ||
fs.readdirSync(directory, function(err, files) { | ||
files.forEach(function(file) { | ||
fs.statSync(directory + "/" + file, function(err, stats) { | ||
fs.readdir(directory, function(err, files) { | ||
for (let i = 0; i < files.length; i++) { | ||
let file = files[i]; | ||
fs.stat(directory + "/" + file, function(err, stats) { | ||
if (stats.isFile()) { | ||
@@ -129,10 +130,13 @@ callback(directory + "/" + file); | ||
}); | ||
}); | ||
} | ||
}); | ||
} | ||
getDirFiles(".", function(file_with_path) { | ||
getDirFiles(`${args[2]}`, file_with_path => { | ||
// console.log(`file_with_path: ${file_with_path}`); | ||
const sourcePath = path.resolve(args[2], file_with_path); | ||
const destPath = path.resolve(args[3], file_with_path); | ||
handleCopy(ignoreList, sourcePath, destPath, false); | ||
// console.log(`Copying over ${sourcePath}`); | ||
// console.log(`Copying over ${destPath}`); | ||
handleCopy(ignoreList, sourcePath, destPath); | ||
}); | ||
@@ -146,6 +150,6 @@ | ||
if (type !== "rename") { | ||
handleCopy(ignoreList, sourcePath, destPath); | ||
handleCopy(ignoreList, sourcePath, destPath, true); | ||
} else if (fs.existsSync(sourcePath)) { | ||
// File has been changed to this | ||
handleCopy(ignoreList, sourcePath, destPath); | ||
handleCopy(ignoreList, sourcePath, destPath, true); | ||
} else if (fs.existsSync(destPath)) { | ||
@@ -158,6 +162,7 @@ // File has been deleted | ||
function handleCopy(ignoreList, sourcePath, destPath, debug = true) { | ||
function handleCopy(ignoreList, sourcePath, destPath, debug = false) { | ||
try { | ||
for (let i = 0; i < ignoreList.length; i++) { | ||
if (sourcePath.includes(ignoreList[i])) { | ||
console.log(`Not copying ${sourcePath}`); | ||
return; | ||
@@ -243,10 +248,3 @@ } | ||
if (!fs.existsSync(getIgnorePath())) { | ||
const ignoreList = [".idea", "tmp", "jb_", "_old_", "node_modules"]; | ||
let str = ""; | ||
for (let i = 0; i < ignoreList.length; i++) { | ||
if (ignoreList[i] !== "") { | ||
str += ignoreList[i] + "\n"; | ||
} | ||
} | ||
fs.outputFile(getIgnorePath(), str); | ||
createNewIgnore(); | ||
} | ||
@@ -264,6 +262,25 @@ const contents = fs | ||
if (resultIsYes(result)) { | ||
remove(); | ||
createNewIgnore(); | ||
} | ||
return {}; | ||
return []; | ||
} | ||
} | ||
function createNewIgnore() { | ||
const ignoreList = [ | ||
".idea", | ||
"tmp", | ||
"jb_", | ||
"_old_", | ||
"node_modules", | ||
"build", | ||
"generated", | ||
]; | ||
let str = ""; | ||
for (let i = 0; i < ignoreList.length; i++) { | ||
if (ignoreList[i] !== "") { | ||
str += ignoreList[i] + "\n"; | ||
} | ||
} | ||
fs.outputFile(getIgnorePath(), str); | ||
} |
{ | ||
"name": "node-lode", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"preferGlobal": true, | ||
@@ -5,0 +5,0 @@ "bin": { |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
8606
253
1