@dx-pkg/mksymlink 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +2 -2
- package/src/commands/create/mksymlink.command-factory.js +3 -5
- package/src/commands/create/mksymlink.command.d.ts +3 -2
- package/src/commands/create/mksymlink.command.js +5 -3
- package/src/commands/create/mksymlink.option-validator.js +0 -1
- package/src/commands/index.js +0 -1
- package/src/index.js +0 -1
- package/examples/advanced-usage.d.ts +0 -2
- package/examples/advanced-usage.js +0 -39
- package/examples/basic-usage.d.ts +0 -2
- package/examples/basic-usage.js +0 -15
- package/examples/config-usage.d.ts +0 -3
- package/examples/config-usage.js +0 -65
- package/examples/cross-platform.d.ts +0 -2
- package/examples/cross-platform.js +0 -41
- package/examples/index.d.ts +0 -2
- package/examples/index.js +0 -7
- package/src/commands/config/config.command-factory.d.ts +0 -5
- package/src/commands/config/config.command-factory.js +0 -18
- package/src/commands/config/config.command.d.ts +0 -23
- package/src/commands/config/config.command.js +0 -94
- package/src/commands/config/config.option-validator.d.ts +0 -9
- package/src/commands/config/config.option-validator.js +0 -41
- package/src/commands/config.command-factory.d.ts +0 -5
- package/src/commands/config.command-factory.js +0 -18
- package/src/commands/config.command.d.ts +0 -22
- package/src/commands/config.command.js +0 -80
- package/src/commands/config.option-validator.d.ts +0 -9
- package/src/commands/config.option-validator.js +0 -41
- package/src/commands/create/mksymlink.command-factory.d.ts +0 -5
- package/src/commands/create/mksymlink.option-validator.d.ts +0 -9
- package/src/commands/index.d.ts +0 -3
- package/src/commands/mksymlink.command-factory.d.ts +0 -5
- package/src/commands/mksymlink.command-factory.js +0 -20
- package/src/commands/mksymlink.command.d.ts +0 -22
- package/src/commands/mksymlink.command.js +0 -68
- package/src/commands/mksymlink.option-validator.d.ts +0 -9
- package/src/commands/mksymlink.option-validator.js +0 -35
- package/src/index.d.ts +0 -12
- package/src/services/config.service.d.ts +0 -45
- package/src/services/config.service.js +0 -113
- package/src/services/os-detector.d.ts +0 -11
- package/src/services/os-detector.js +0 -36
- package/src/services/platform-detector.d.ts +0 -11
- package/src/services/platform-detector.js +0 -36
- package/src/services/symlink-error.d.ts +0 -12
- package/src/services/symlink-error.js +0 -33
- package/src/services/symlink-manager.d.ts +0 -13
- package/src/services/symlink-manager.js +0 -115
- package/src/services/symlink.service.d.ts +0 -13
- package/src/services/symlink.service.js +0 -115
- package/src/types/index.d.ts +0 -40
- package/src/types/index.js +0 -3
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigOptionValidator = void 0;
|
|
4
|
-
const symlink_error_1 = require("../services/symlink-error");
|
|
5
|
-
const VALID_ACTIONS = ['get', 'set', 'unset', 'list'];
|
|
6
|
-
class ConfigOptionValidator {
|
|
7
|
-
validate(options) {
|
|
8
|
-
this.validateAction(options.action);
|
|
9
|
-
this.validateKey(options.action, options.key);
|
|
10
|
-
this.validateValue(options.action, options.value);
|
|
11
|
-
}
|
|
12
|
-
validateAction(action) {
|
|
13
|
-
if (!VALID_ACTIONS.includes(action)) {
|
|
14
|
-
throw new symlink_error_1.SymlinkError(`Invalid config action: ${action}. Must be one of: ${VALID_ACTIONS.join(', ')}`, 'INVALID_CONFIG_ACTION');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
validateKey(action, key) {
|
|
18
|
-
if (action === 'list') {
|
|
19
|
-
return; // list doesn't require a key
|
|
20
|
-
}
|
|
21
|
-
if (!key) {
|
|
22
|
-
throw new symlink_error_1.SymlinkError(`Key is required for '${action}' action`, 'MISSING_CONFIG_KEY');
|
|
23
|
-
}
|
|
24
|
-
if (typeof key !== 'string' || key.trim().length === 0) {
|
|
25
|
-
throw new symlink_error_1.SymlinkError(`Invalid config key: ${key}. Key must be a non-empty string.`, 'INVALID_CONFIG_KEY');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
validateValue(action, value) {
|
|
29
|
-
if (action !== 'set') {
|
|
30
|
-
return; // only 'set' requires a value
|
|
31
|
-
}
|
|
32
|
-
if (!value) {
|
|
33
|
-
throw new symlink_error_1.SymlinkError(`Value is required for 'set' action`, 'MISSING_CONFIG_VALUE');
|
|
34
|
-
}
|
|
35
|
-
if (typeof value !== 'string') {
|
|
36
|
-
throw new symlink_error_1.SymlinkError(`Invalid config value: ${value}. Value must be a string.`, 'INVALID_CONFIG_VALUE');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.ConfigOptionValidator = ConfigOptionValidator;
|
|
41
|
-
//# sourceMappingURL=config.option-validator.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CommandOptionsValidator } from '../../types';
|
|
2
|
-
import { MkSymlinkCommandOptions } from './mksymlink.command';
|
|
3
|
-
export declare class MkSymlinkOptionValidator implements CommandOptionsValidator<MkSymlinkCommandOptions> {
|
|
4
|
-
validate(options: MkSymlinkCommandOptions): void;
|
|
5
|
-
private validateType;
|
|
6
|
-
private validateSource;
|
|
7
|
-
private validateForce;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=mksymlink.option-validator.d.ts.map
|
package/src/commands/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MkSymlinkCommandFactory = void 0;
|
|
4
|
-
const logger_1 = require("@dx-pkg/logger");
|
|
5
|
-
const mksymlink_command_1 = require("./create/mksymlink.command");
|
|
6
|
-
const mksymlink_option_validator_1 = require("./create/mksymlink.option-validator");
|
|
7
|
-
const symlink_manager_1 = require("../services/symlink-manager");
|
|
8
|
-
const platform_detector_1 = require("../services/platform-detector");
|
|
9
|
-
class MkSymlinkCommandFactory {
|
|
10
|
-
static create(options) {
|
|
11
|
-
const validator = new mksymlink_option_validator_1.MkSymlinkOptionValidator();
|
|
12
|
-
validator.validate(options);
|
|
13
|
-
const logger = new logger_1.ConsoleLogger();
|
|
14
|
-
const osDetector = new platform_detector_1.PlatformDetector();
|
|
15
|
-
const symlinkManager = new symlink_manager_1.SymlinkService(logger, osDetector);
|
|
16
|
-
return new mksymlink_command_1.MkSymlinkCommand(logger, symlinkManager, options);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.MkSymlinkCommandFactory = MkSymlinkCommandFactory;
|
|
20
|
-
//# sourceMappingURL=mksymlink.command-factory.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@dx-tools/logger';
|
|
2
|
-
import { Command, WindowsSymlinkType, SymlinkOperations } from '../types';
|
|
3
|
-
import { ConfigService } from '../services/config.service';
|
|
4
|
-
export interface MkSymlinkCommandOptions {
|
|
5
|
-
target?: string;
|
|
6
|
-
source?: string;
|
|
7
|
-
type?: WindowsSymlinkType;
|
|
8
|
-
force?: boolean;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
export declare const SYMLINK_TYPES: readonly WindowsSymlinkType[];
|
|
12
|
-
export declare class MkSymlinkCommand implements Command<MkSymlinkCommandOptions> {
|
|
13
|
-
private readonly logger;
|
|
14
|
-
private readonly symlinkManager;
|
|
15
|
-
private readonly options;
|
|
16
|
-
private readonly configService;
|
|
17
|
-
constructor(logger: Logger, symlinkManager: SymlinkOperations, options: MkSymlinkCommandOptions, configService?: ConfigService);
|
|
18
|
-
execute(): Promise<void>;
|
|
19
|
-
private resolveOptions;
|
|
20
|
-
private generateDefaultTarget;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=mksymlink.command.d.ts.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MkSymlinkCommand = exports.SYMLINK_TYPES = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const config_service_1 = require("../services/config.service");
|
|
6
|
-
exports.SYMLINK_TYPES = ['file', 'dir', 'junction'];
|
|
7
|
-
class MkSymlinkCommand {
|
|
8
|
-
logger;
|
|
9
|
-
symlinkManager;
|
|
10
|
-
options;
|
|
11
|
-
configService;
|
|
12
|
-
constructor(logger, symlinkManager, options, configService = new config_service_1.ConfigService()) {
|
|
13
|
-
this.logger = logger;
|
|
14
|
-
this.symlinkManager = symlinkManager;
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.configService = configService;
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
try {
|
|
20
|
-
const { source, target, type, force } = this.resolveOptions();
|
|
21
|
-
this.logger.info('Creating symlink with options:');
|
|
22
|
-
this.logger.info(` Source: ${source}`);
|
|
23
|
-
this.logger.info(` Target: ${target}`);
|
|
24
|
-
this.logger.info(` Type: ${type}`);
|
|
25
|
-
this.logger.info(` Force: ${force}`);
|
|
26
|
-
const result = await this.symlinkManager.createSymlink({
|
|
27
|
-
source,
|
|
28
|
-
target,
|
|
29
|
-
type,
|
|
30
|
-
force,
|
|
31
|
-
});
|
|
32
|
-
if (!result.success) {
|
|
33
|
-
if (result.error) {
|
|
34
|
-
throw result.error;
|
|
35
|
-
}
|
|
36
|
-
this.logger.warning(result.message || 'Symlink creation failed');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
this.logger.success('Symlink created successfully!');
|
|
40
|
-
this.logger.info(` Source: ${result.source}`);
|
|
41
|
-
this.logger.info(` Target: ${result.target}`);
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
this.logger.error(`Failed to create symlink: ${error instanceof Error ? error.message : String(error)}`);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
resolveOptions() {
|
|
49
|
-
const currentDir = process.cwd();
|
|
50
|
-
const source = this.options.source || currentDir;
|
|
51
|
-
const target = this.options.target || this.generateDefaultTarget(currentDir);
|
|
52
|
-
const type = this.options.type || 'dir';
|
|
53
|
-
const force = this.options.force || false;
|
|
54
|
-
return { source, target, type, force };
|
|
55
|
-
}
|
|
56
|
-
generateDefaultTarget(currentDir) {
|
|
57
|
-
const currentBasename = (0, path_1.basename)(currentDir);
|
|
58
|
-
const parentDir = (0, path_1.dirname)(currentDir);
|
|
59
|
-
const parentBasename = (0, path_1.basename)(parentDir);
|
|
60
|
-
const symlinkName = `${parentBasename}--${currentBasename}`;
|
|
61
|
-
// Check if there's a configured default directory
|
|
62
|
-
const configuredDir = this.configService.getDefaultSymlinkDir();
|
|
63
|
-
const defaultSymlinkDir = configuredDir || currentDir;
|
|
64
|
-
return (0, path_1.resolve)(defaultSymlinkDir, symlinkName);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.MkSymlinkCommand = MkSymlinkCommand;
|
|
68
|
-
//# sourceMappingURL=mksymlink.command.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CommandOptionsValidator } from '../types';
|
|
2
|
-
import { MkSymlinkCommandOptions } from './mksymlink.command';
|
|
3
|
-
export declare class MkSymlinkOptionValidator implements CommandOptionsValidator<MkSymlinkCommandOptions> {
|
|
4
|
-
validate(options: MkSymlinkCommandOptions): void;
|
|
5
|
-
private validateType;
|
|
6
|
-
private validateSource;
|
|
7
|
-
private validateForce;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=mksymlink.option-validator.d.ts.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MkSymlinkOptionValidator = void 0;
|
|
4
|
-
const symlink_error_1 = require("../services/symlink-error");
|
|
5
|
-
const mksymlink_command_1 = require("./mksymlink.command");
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
class MkSymlinkOptionValidator {
|
|
9
|
-
validate(options) {
|
|
10
|
-
this.validateType(options.type);
|
|
11
|
-
this.validateSource(options.source);
|
|
12
|
-
this.validateForce(options.force);
|
|
13
|
-
}
|
|
14
|
-
validateType(type) {
|
|
15
|
-
if (type && !mksymlink_command_1.SYMLINK_TYPES.includes(type)) {
|
|
16
|
-
throw new symlink_error_1.SymlinkError(`Invalid symlink type: ${type}. Must be one of: ${mksymlink_command_1.SYMLINK_TYPES.join(', ')}`, 'INVALID_SYMLINK_TYPE');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
validateSource(source) {
|
|
20
|
-
if (!source) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const resolvedSource = (0, path_1.resolve)(source);
|
|
24
|
-
if (!(0, fs_1.existsSync)(resolvedSource)) {
|
|
25
|
-
throw new symlink_error_1.SymlinkError(`Source path does not exist: ${resolvedSource}`, 'SOURCE_NOT_FOUND');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
validateForce(force) {
|
|
29
|
-
if (force !== undefined && typeof force !== 'boolean') {
|
|
30
|
-
throw new symlink_error_1.SymlinkError(`Invalid force option: ${force}. Must be a boolean.`, 'INVALID_FORCE_OPTION');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.MkSymlinkOptionValidator = MkSymlinkOptionValidator;
|
|
35
|
-
//# sourceMappingURL=mksymlink.option-validator.js.map
|
package/src/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './services/platform-detector';
|
|
3
|
-
export * from './services/symlink.service';
|
|
4
|
-
export * from './services/symlink-error';
|
|
5
|
-
export * from './services/config.service';
|
|
6
|
-
export * from './commands/create/mksymlink.command';
|
|
7
|
-
export * from './commands/create/mksymlink.option-validator';
|
|
8
|
-
export * from './commands/create/mksymlink.command-factory';
|
|
9
|
-
export * from './commands/config/config.command';
|
|
10
|
-
export * from './commands/config/config.option-validator';
|
|
11
|
-
export * from './commands/config/config.command-factory';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface ConfigData {
|
|
2
|
-
[key: string]: string | undefined;
|
|
3
|
-
}
|
|
4
|
-
export declare class ConfigService {
|
|
5
|
-
private readonly configPath;
|
|
6
|
-
private config;
|
|
7
|
-
constructor(configPath?: string);
|
|
8
|
-
/**
|
|
9
|
-
* Get a configuration value by key
|
|
10
|
-
*/
|
|
11
|
-
get(key: string): string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Set a configuration value
|
|
14
|
-
*/
|
|
15
|
-
set(key: string, value: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Unset (remove) a configuration value
|
|
18
|
-
*/
|
|
19
|
-
unset(key: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* List all configuration values
|
|
22
|
-
*/
|
|
23
|
-
list(): ConfigData;
|
|
24
|
-
/**
|
|
25
|
-
* Get the default symlink directory from config
|
|
26
|
-
*/
|
|
27
|
-
getDefaultSymlinkDir(): string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Set the default symlink directory
|
|
30
|
-
*/
|
|
31
|
-
setDefaultSymlinkDir(dir: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Get configuration file information
|
|
34
|
-
*/
|
|
35
|
-
getConfigInfo(): {
|
|
36
|
-
path: string;
|
|
37
|
-
exists: boolean;
|
|
38
|
-
size?: number;
|
|
39
|
-
modified?: Date;
|
|
40
|
-
entries: number;
|
|
41
|
-
};
|
|
42
|
-
private loadConfig;
|
|
43
|
-
private saveConfig;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=config.service.d.ts.map
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigService = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const os_1 = require("os");
|
|
7
|
-
class ConfigService {
|
|
8
|
-
configPath;
|
|
9
|
-
config = {};
|
|
10
|
-
constructor(configPath) {
|
|
11
|
-
const homeDir = (0, os_1.homedir)();
|
|
12
|
-
this.configPath = configPath || (0, path_1.resolve)(homeDir, '.mksymlinkrc');
|
|
13
|
-
this.loadConfig();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get a configuration value by key
|
|
17
|
-
*/
|
|
18
|
-
get(key) {
|
|
19
|
-
return this.config[key];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Set a configuration value
|
|
23
|
-
*/
|
|
24
|
-
set(key, value) {
|
|
25
|
-
this.config[key] = value;
|
|
26
|
-
this.saveConfig();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Unset (remove) a configuration value
|
|
30
|
-
*/
|
|
31
|
-
unset(key) {
|
|
32
|
-
delete this.config[key];
|
|
33
|
-
this.saveConfig();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* List all configuration values
|
|
37
|
-
*/
|
|
38
|
-
list() {
|
|
39
|
-
return { ...this.config };
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the default symlink directory from config
|
|
43
|
-
*/
|
|
44
|
-
getDefaultSymlinkDir() {
|
|
45
|
-
return this.get('symlink.defaultDir');
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Set the default symlink directory
|
|
49
|
-
*/
|
|
50
|
-
setDefaultSymlinkDir(dir) {
|
|
51
|
-
this.set('symlink.defaultDir', dir);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Get configuration file information
|
|
55
|
-
*/
|
|
56
|
-
getConfigInfo() {
|
|
57
|
-
const exists = (0, fs_1.existsSync)(this.configPath);
|
|
58
|
-
const entries = Object.keys(this.config).length;
|
|
59
|
-
if (!exists) {
|
|
60
|
-
return {
|
|
61
|
-
path: this.configPath,
|
|
62
|
-
exists: false,
|
|
63
|
-
entries,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const stats = (0, fs_1.statSync)(this.configPath);
|
|
67
|
-
return {
|
|
68
|
-
path: this.configPath,
|
|
69
|
-
exists: true,
|
|
70
|
-
size: stats.size,
|
|
71
|
-
modified: stats.mtime,
|
|
72
|
-
entries,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
loadConfig() {
|
|
76
|
-
if (!(0, fs_1.existsSync)(this.configPath)) {
|
|
77
|
-
this.config = {};
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
const content = (0, fs_1.readFileSync)(this.configPath, 'utf-8');
|
|
82
|
-
const lines = content.split('\n').filter((line) => line.trim());
|
|
83
|
-
this.config = {};
|
|
84
|
-
for (const line of lines) {
|
|
85
|
-
const [key, ...valueParts] = line.split('=');
|
|
86
|
-
if (key && valueParts.length > 0) {
|
|
87
|
-
this.config[key.trim()] = valueParts.join('=').trim();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
throw new Error(`Failed to load config from ${this.configPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
saveConfig() {
|
|
96
|
-
try {
|
|
97
|
-
const configDir = (0, path_1.dirname)(this.configPath);
|
|
98
|
-
if (!(0, fs_1.existsSync)(configDir)) {
|
|
99
|
-
(0, fs_1.mkdirSync)(configDir, { recursive: true });
|
|
100
|
-
}
|
|
101
|
-
const content = Object.entries(this.config)
|
|
102
|
-
.filter(([, value]) => value !== undefined)
|
|
103
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
104
|
-
.join('\n');
|
|
105
|
-
(0, fs_1.writeFileSync)(this.configPath, content + '\n', 'utf-8');
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
throw new Error(`Failed to save config to ${this.configPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.ConfigService = ConfigService;
|
|
113
|
-
//# sourceMappingURL=config.service.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PlatformInformation, OSPlatform } from '../types';
|
|
2
|
-
export declare class PlatformDetector implements PlatformInformation {
|
|
3
|
-
private readonly _platform;
|
|
4
|
-
constructor();
|
|
5
|
-
private normalizePlatform;
|
|
6
|
-
getPlatform(): OSPlatform;
|
|
7
|
-
isWindows(): boolean;
|
|
8
|
-
isMacOS(): boolean;
|
|
9
|
-
isLinux(): boolean;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=os-detector.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformDetector = void 0;
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
class PlatformDetector {
|
|
6
|
-
_platform;
|
|
7
|
-
constructor() {
|
|
8
|
-
this._platform = this.normalizePlatform((0, os_1.platform)());
|
|
9
|
-
}
|
|
10
|
-
normalizePlatform(osPlatform) {
|
|
11
|
-
switch (osPlatform) {
|
|
12
|
-
case 'darwin':
|
|
13
|
-
return 'darwin';
|
|
14
|
-
case 'win32':
|
|
15
|
-
return 'win32';
|
|
16
|
-
case 'linux':
|
|
17
|
-
return 'linux';
|
|
18
|
-
default:
|
|
19
|
-
return 'unknown';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
getPlatform() {
|
|
23
|
-
return this._platform;
|
|
24
|
-
}
|
|
25
|
-
isWindows() {
|
|
26
|
-
return this._platform === 'win32';
|
|
27
|
-
}
|
|
28
|
-
isMacOS() {
|
|
29
|
-
return this._platform === 'darwin';
|
|
30
|
-
}
|
|
31
|
-
isLinux() {
|
|
32
|
-
return this._platform === 'linux';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.PlatformDetector = PlatformDetector;
|
|
36
|
-
//# sourceMappingURL=os-detector.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PlatformInformation, OSPlatform } from '../types';
|
|
2
|
-
export declare class PlatformDetector implements PlatformInformation {
|
|
3
|
-
private readonly _platform;
|
|
4
|
-
constructor();
|
|
5
|
-
private normalizePlatform;
|
|
6
|
-
getPlatform(): OSPlatform;
|
|
7
|
-
isWindows(): boolean;
|
|
8
|
-
isMacOS(): boolean;
|
|
9
|
-
isLinux(): boolean;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=platform-detector.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformDetector = void 0;
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
class PlatformDetector {
|
|
6
|
-
_platform;
|
|
7
|
-
constructor() {
|
|
8
|
-
this._platform = this.normalizePlatform((0, os_1.platform)());
|
|
9
|
-
}
|
|
10
|
-
normalizePlatform(osPlatform) {
|
|
11
|
-
switch (osPlatform) {
|
|
12
|
-
case 'darwin':
|
|
13
|
-
return 'darwin';
|
|
14
|
-
case 'win32':
|
|
15
|
-
return 'win32';
|
|
16
|
-
case 'linux':
|
|
17
|
-
return 'linux';
|
|
18
|
-
default:
|
|
19
|
-
return 'unknown';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
getPlatform() {
|
|
23
|
-
return this._platform;
|
|
24
|
-
}
|
|
25
|
-
isWindows() {
|
|
26
|
-
return this._platform === 'win32';
|
|
27
|
-
}
|
|
28
|
-
isMacOS() {
|
|
29
|
-
return this._platform === 'darwin';
|
|
30
|
-
}
|
|
31
|
-
isLinux() {
|
|
32
|
-
return this._platform === 'linux';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.PlatformDetector = PlatformDetector;
|
|
36
|
-
//# sourceMappingURL=platform-detector.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@dx-pkg/logger';
|
|
2
|
-
import { CommandError } from '../types';
|
|
3
|
-
export declare class SymlinkError extends Error implements CommandError {
|
|
4
|
-
code?: string;
|
|
5
|
-
constructor(message: string, code?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class SymlinkErrorHandler {
|
|
8
|
-
private readonly logger;
|
|
9
|
-
constructor(logger: Logger);
|
|
10
|
-
handle(error: unknown): never;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=symlink-error.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SymlinkErrorHandler = exports.SymlinkError = void 0;
|
|
4
|
-
class SymlinkError extends Error {
|
|
5
|
-
code;
|
|
6
|
-
constructor(message, code) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'SymlinkError';
|
|
9
|
-
this.code = code;
|
|
10
|
-
Error.captureStackTrace(this, this.constructor);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.SymlinkError = SymlinkError;
|
|
14
|
-
class SymlinkErrorHandler {
|
|
15
|
-
logger;
|
|
16
|
-
constructor(logger) {
|
|
17
|
-
this.logger = logger;
|
|
18
|
-
}
|
|
19
|
-
handle(error) {
|
|
20
|
-
if (error instanceof SymlinkError) {
|
|
21
|
-
this.logger.error(`Symlink Error [${error.code || 'UNKNOWN'}]: ${error.message}`);
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
if (error instanceof Error) {
|
|
25
|
-
this.logger.error(`Unexpected Error: ${error.message}`);
|
|
26
|
-
throw new SymlinkError(error.message, 'UNEXPECTED_ERROR');
|
|
27
|
-
}
|
|
28
|
-
this.logger.error(`Unknown Error: ${String(error)}`);
|
|
29
|
-
throw new SymlinkError(String(error), 'UNKNOWN_ERROR');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.SymlinkErrorHandler = SymlinkErrorHandler;
|
|
33
|
-
//# sourceMappingURL=symlink-error.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@dx-pkg/logger';
|
|
2
|
-
import { SymlinkOperations, SymlinkOptions, SymlinkResult, PlatformInformation } from '../types';
|
|
3
|
-
export declare class SymlinkService implements SymlinkOperations {
|
|
4
|
-
private readonly logger;
|
|
5
|
-
private readonly osDetector;
|
|
6
|
-
constructor(logger: Logger, osDetector: PlatformInformation);
|
|
7
|
-
createSymlink(options: SymlinkOptions): Promise<SymlinkResult>;
|
|
8
|
-
private createWindowsSymlink;
|
|
9
|
-
private createUnixSymlink;
|
|
10
|
-
symlinkExists(path: string): Promise<boolean>;
|
|
11
|
-
removeSymlink(path: string): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=symlink-manager.d.ts.map
|