find-duplicate-strings
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -30,2 +30,3 @@ "use strict"; | ||
}); | ||
console.log('answer: ', answer); | ||
return answer[this.name]; | ||
@@ -32,0 +33,0 @@ }); |
@@ -5,2 +5,3 @@ import { Question } from './question'; | ||
constructor(name: string, message: string, type?: keyof QuestionMap, defaultAnswer?: string); | ||
getAnswer(): Promise<string>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,6 +15,14 @@ exports.QuestionMock = void 0; | ||
class QuestionMock extends question_1.Question { | ||
constructor(name, message, type = 'input', defaultAnswer) { | ||
constructor(name, message, type, defaultAnswer) { | ||
super(name, message, type, defaultAnswer); | ||
} | ||
getAnswer() { | ||
const _super = Object.create(null, { | ||
getAnswer: { get: () => super.getAnswer } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return _super.getAnswer.call(this); | ||
}); | ||
} | ||
} | ||
exports.QuestionMock = QuestionMock; |
@@ -20,3 +20,2 @@ import BottomBar from 'inquirer/lib/ui/bottom-bar'; | ||
scan(): Promise<void>; | ||
private startScan; | ||
private scanDir; | ||
@@ -23,0 +22,0 @@ private scanFile; |
@@ -54,7 +54,12 @@ "use strict"; | ||
const path = this.path.length ? this.path : yield new path_2.PathQuestion().getAnswer(); | ||
if (!this.exclusions) { | ||
const fullPath = (0, path_1.normalize)((0, path_1.resolve)(process_1.default.cwd(), path)); | ||
if (!(0, fs_1.existsSync)(fullPath)) { | ||
throw new Error('Invalid path: No such directory or file.'); | ||
} | ||
const lstat = (0, fs_1.statSync)(fullPath); | ||
if (!this.exclusions && lstat.isDirectory()) { | ||
const answer = yield new questions_1.ExclusionsQuestion().getAnswer(); | ||
this.exclusions = exclusions_1.Exclusions.process(answer); | ||
} | ||
if (!this.extensions) { | ||
if (!this.extensions && lstat.isDirectory()) { | ||
const answer = yield new questions_1.ExtensionsQuestion().getAnswer(); | ||
@@ -87,21 +92,2 @@ this.extensions = extensions_1.Extensions.process(answer); | ||
} | ||
startScan(path) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fullPath = (0, path_1.normalize)((0, path_1.resolve)(process_1.default.cwd(), path)); | ||
const noSuchDirectoryOrFileError = new Error('Invalid path: No such directory or file.'); | ||
if (!(0, fs_1.existsSync)(fullPath)) { | ||
throw noSuchDirectoryOrFileError; | ||
} | ||
const lstat = (0, fs_1.statSync)(fullPath); | ||
if (lstat.isFile()) { | ||
yield this.scanFile(fullPath); | ||
return; | ||
} | ||
if (lstat.isDirectory()) { | ||
yield this.scanDir(fullPath); | ||
return; | ||
} | ||
throw noSuchDirectoryOrFileError; | ||
}); | ||
} | ||
scanDir(path) { | ||
@@ -152,8 +138,8 @@ var e_1, _a; | ||
}); | ||
try { | ||
yield this.startScan(path); | ||
const lstat = (0, fs_1.statSync)(path); | ||
if (lstat.isFile()) { | ||
yield this.scanFile(path); | ||
} | ||
catch (error) { | ||
clearLoader(); | ||
throw error; | ||
if (lstat.isDirectory()) { | ||
yield this.scanDir(path); | ||
} | ||
@@ -160,0 +146,0 @@ clearLoader(); |
{ | ||
"name": "find-duplicate-strings", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Easy to use CLI that finds duplicate strings in a directory and stores them in a external file for easy reference", | ||
@@ -5,0 +5,0 @@ "author": "Erwin Heitzman", |
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
45202
906