Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hlink

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hlink - npm Package Compare versions

Comparing version 0.3.0-0 to 0.3.0-1

20

lib/config/paths.js

@@ -6,8 +6,24 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.configPath = exports.configName = exports.mapJson = exports.configSaveDir = void 0;
exports.readSaveRecord = exports.writeSaveRecord = exports.configPath = exports.configName = exports.configSaveDir = void 0;
var path_1 = __importDefault(require("path"));
var os_1 = __importDefault(require("os"));
var fs_extra_1 = __importDefault(require("fs-extra"));
exports.configSaveDir = path_1.default.join(os_1.default.homedir(), '.hlink');
exports.mapJson = path_1.default.join(exports.configSaveDir, 'source_dest_map.json');
var mapJson = path_1.default.join(exports.configSaveDir, 'source_dest_map.json');
exports.configName = 'hlink.config.js';
exports.configPath = path_1.default.join(os_1.default.homedir(), exports.configName);
function writeSaveRecord(content) {
if (!fs_extra_1.default.existsSync(exports.configSaveDir)) {
fs_extra_1.default.ensureDirSync(exports.configSaveDir);
}
fs_extra_1.default.writeJSONSync(mapJson, content);
}
exports.writeSaveRecord = writeSaveRecord;
function readSaveRecord() {
if (!fs_extra_1.default.existsSync(mapJson)) {
writeSaveRecord({});
return {};
}
return fs_extra_1.default.readJSONSync(mapJson);
}
exports.readSaveRecord = readSaveRecord;

7

lib/config/saveRecord.js

@@ -12,6 +12,3 @@ "use strict";

fs_extra_1.default.ensureDirSync(paths_1.configSaveDir);
var savedPath = {};
if (fs_extra_1.default.existsSync(paths_1.mapJson)) {
savedPath = fs_extra_1.default.readJSONSync(paths_1.mapJson);
}
var savedPath = paths_1.readSaveRecord();
var savedDestPath = savedPath[source];

@@ -34,3 +31,3 @@ if (savedDestPath) {

}
fs_extra_1.default.writeJSONSync(paths_1.mapJson, savedPath);
paths_1.writeSaveRecord(savedPath);
}

@@ -37,0 +34,0 @@ catch (e) {

@@ -83,3 +83,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var isDeleteDir, isSecondDir, source, sourceDir, dest, answerDeleteMode, pathsMap, answers, _a, finalSource, finalSourceDir;
var isDeleteDir, isSecondDir, source, sourceDir, dest, answerDeleteMode, answers, _a, finalSource, finalSourceDir;
return __generator(this, function (_b) {

@@ -113,3 +113,2 @@ switch (_b.label) {

if (!isDelete) return [3 /*break*/, 6];
pathsMap = fs_extra_1.default.readJSONSync(paths.mapJson);
return [4 /*yield*/, questions_1.deleteQuestion()];

@@ -121,3 +120,3 @@ case 5:

sourceDir = finalSourceDir;
dest = answers.destDir || pathsMap[finalSourceDir][0];
dest = answers.destDir;
isSecondDir = answers.sourcePath === '二级目录';

@@ -147,2 +146,3 @@ _b.label = 6;

_a = _c.sent(), source = _a.source, sourceDir = _a.sourceDir, isDeleteDir = _a.isDeleteDir, isSecondDir = _a.isSecondDir, dest = _a.dest;
console.log(configPath);
_b = parseConfig_1.default(path_1.default.isAbsolute(configPath)

@@ -156,3 +156,3 @@ ? configPath

excludeExts = (e || ee || '').split(',').filter(Boolean);
saveMode = +(s || String(sm) || 0);
saveMode = +(s || sm || 0);
maxFindLevel = +(m || mfl || 4);

@@ -159,0 +159,0 @@ checkDirectory(source, dest);

@@ -66,3 +66,2 @@ "use strict";

var paths = __importStar(require("../config/paths"));
var pathsMap = fs_extra_1.default.readJSONSync(paths.mapJson);
function getSource(answers) {

@@ -76,3 +75,5 @@ var isSecondDir = answers.sourcePath === '二级目录';

var deleteQuestion = function () { return __awaiter(void 0, void 0, void 0, function () {
var pathsMap;
return __generator(this, function (_a) {
pathsMap = paths.readSaveRecord();
return [2 /*return*/, inquirer_1.default.prompt([

@@ -79,0 +80,0 @@ {

{
"name": "hlink",
"version": "0.3.0-0",
"version": "0.3.0-1",
"description": "hlink",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc