@dx-pkg/mksymlink 1.0.4 → 1.0.6

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.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/examples/advanced-usage.d.ts +0 -1
  3. package/examples/advanced-usage.js +0 -1
  4. package/examples/basic-usage.d.ts +0 -1
  5. package/examples/basic-usage.js +0 -1
  6. package/examples/config-usage.d.ts +0 -1
  7. package/examples/config-usage.js +0 -1
  8. package/examples/cross-platform.d.ts +0 -1
  9. package/examples/cross-platform.js +0 -1
  10. package/examples/index.d.ts +0 -1
  11. package/examples/index.js +0 -1
  12. package/package.json +2 -2
  13. package/src/commands/config/config.command-factory.d.ts +0 -1
  14. package/src/commands/config/config.command-factory.js +0 -1
  15. package/src/commands/config/config.command.d.ts +0 -1
  16. package/src/commands/config/config.command.js +0 -1
  17. package/src/commands/config/config.option-validator.d.ts +0 -1
  18. package/src/commands/config/config.option-validator.js +0 -1
  19. package/src/commands/create/mksymlink.command-factory.d.ts +0 -1
  20. package/src/commands/create/mksymlink.command-factory.js +0 -1
  21. package/src/commands/create/mksymlink.command.d.ts +0 -1
  22. package/src/commands/create/mksymlink.command.js +0 -1
  23. package/src/commands/create/mksymlink.option-validator.d.ts +0 -1
  24. package/src/commands/create/mksymlink.option-validator.js +0 -1
  25. package/src/commands/index.d.ts +0 -1
  26. package/src/commands/index.js +0 -1
  27. package/src/index.d.ts +0 -1
  28. package/src/index.js +0 -1
  29. package/src/services/config.service.d.ts +0 -1
  30. package/src/services/config.service.js +0 -1
  31. package/src/services/platform-detector.d.ts +0 -1
  32. package/src/services/platform-detector.js +0 -1
  33. package/src/services/symlink-error.d.ts +0 -1
  34. package/src/services/symlink-error.js +0 -1
  35. package/src/services/symlink-manager.d.ts +0 -1
  36. package/src/services/symlink-manager.js +0 -1
  37. package/src/services/symlink.service.d.ts +0 -1
  38. package/src/services/symlink.service.js +0 -1
  39. package/src/types/index.d.ts +0 -1
  40. package/src/types/index.js +0 -1
  41. package/src/commands/config.command-factory.d.ts +0 -5
  42. package/src/commands/config.command-factory.js +0 -18
  43. package/src/commands/config.command.d.ts +0 -22
  44. package/src/commands/config.command.js +0 -80
  45. package/src/commands/config.option-validator.d.ts +0 -9
  46. package/src/commands/config.option-validator.js +0 -41
  47. package/src/commands/mksymlink.command-factory.d.ts +0 -5
  48. package/src/commands/mksymlink.command-factory.js +0 -20
  49. package/src/commands/mksymlink.command.d.ts +0 -22
  50. package/src/commands/mksymlink.command.js +0 -68
  51. package/src/commands/mksymlink.option-validator.d.ts +0 -9
  52. package/src/commands/mksymlink.option-validator.js +0 -35
  53. package/src/services/os-detector.d.ts +0 -11
  54. package/src/services/os-detector.js +0 -36
package/README.md CHANGED
@@ -168,6 +168,7 @@ npx mksymlink config set symlink.defaultDir ~/test-symlinks
168
168
  npx mksymlink config list
169
169
  npx mksymlink config get symlink.defaultDir
170
170
  npx mksymlink config unset symlink.defaultDir
171
+ npx mksymlink config info
171
172
 
172
173
  # Create mode
173
174
  npx mksymlink create -s /path/to/source -t /path/to/target
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=advanced-usage.d.ts.map
@@ -36,4 +36,3 @@ async function advancedExample() {
36
36
  }
37
37
  }
38
38
  advancedExample().catch(console.error);
39
- //# sourceMappingURL=advanced-usage.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=basic-usage.d.ts.map
@@ -12,4 +12,3 @@ async function basicExample() {
12
12
  await command.execute();
13
13
  }
14
14
  basicExample().catch(console.error);
15
- //# sourceMappingURL=basic-usage.js.map
@@ -1,3 +1,2 @@
1
1
  declare function configExamples(): Promise<void>;
2
2
  export { configExamples };
3
- //# sourceMappingURL=config-usage.d.ts.map
@@ -62,4 +62,3 @@ async function configExamples() {
62
62
  console.error('Error running config examples:', error);
63
63
  }
64
64
  }
65
- //# sourceMappingURL=config-usage.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=cross-platform.d.ts.map
@@ -38,4 +38,3 @@ async function crossPlatformExample() {
38
38
  }
39
39
  }
40
40
  crossPlatformExample().catch(console.error);
41
- //# sourceMappingURL=cross-platform.js.map
@@ -1,2 +1 @@
1
1
  import './basic-usage';
2
- //# sourceMappingURL=index.d.ts.map
package/examples/index.js CHANGED
@@ -4,4 +4,3 @@ require("./basic-usage");
4
4
  // import { configExamples } from './config-usage';
5
5
  // Uncomment to run config examples:
6
6
  // configExamples().catch(console.error);
7
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dx-pkg/mksymlink",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Create symbolic links across platforms (macOS, Windows)",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -19,7 +19,7 @@
19
19
  "mksymlink": "src/commands/index.js"
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc -p tsconfig.json",
22
+ "build": "tsc -p tsconfig.prod.json",
23
23
  "watch": "tsc -p tsconfig.json --watch",
24
24
  "dev": "tsc-watch -b --onSuccess \"npm start\"",
25
25
  "start": "node ../../dist/packages/mksymlink/examples/index.js",
@@ -2,4 +2,3 @@ import { ConfigCommand, ConfigCommandOptions } from './config.command';
2
2
  export declare class ConfigCommandFactory {
3
3
  static create(options: ConfigCommandOptions): ConfigCommand;
4
4
  }
5
- //# sourceMappingURL=config.command-factory.d.ts.map
@@ -15,4 +15,3 @@ class ConfigCommandFactory {
15
15
  }
16
16
  }
17
17
  exports.ConfigCommandFactory = ConfigCommandFactory;
18
- //# sourceMappingURL=config.command-factory.js.map
@@ -20,4 +20,3 @@ export declare class ConfigCommand implements Command<ConfigCommandOptions> {
20
20
  private handleList;
21
21
  private handleInfo;
22
22
  }
23
- //# sourceMappingURL=config.command.d.ts.map
@@ -91,4 +91,3 @@ class ConfigCommand {
91
91
  }
92
92
  }
93
93
  exports.ConfigCommand = ConfigCommand;
94
- //# sourceMappingURL=config.command.js.map
@@ -6,4 +6,3 @@ export declare class ConfigOptionValidator implements CommandOptionsValidator<Co
6
6
  private validateKey;
7
7
  private validateValue;
8
8
  }
9
- //# sourceMappingURL=config.option-validator.d.ts.map
@@ -38,4 +38,3 @@ class ConfigOptionValidator {
38
38
  }
39
39
  }
40
40
  exports.ConfigOptionValidator = ConfigOptionValidator;
41
- //# sourceMappingURL=config.option-validator.js.map
@@ -2,4 +2,3 @@ import { MkSymlinkCommand, MkSymlinkCommandOptions } from './mksymlink.command';
2
2
  export declare class MkSymlinkCommandFactory {
3
3
  static create(options: MkSymlinkCommandOptions): MkSymlinkCommand;
4
4
  }
5
- //# sourceMappingURL=mksymlink.command-factory.d.ts.map
@@ -17,4 +17,3 @@ class MkSymlinkCommandFactory {
17
17
  }
18
18
  }
19
19
  exports.MkSymlinkCommandFactory = MkSymlinkCommandFactory;
20
- //# sourceMappingURL=mksymlink.command-factory.js.map
@@ -19,4 +19,3 @@ export declare class MkSymlinkCommand implements Command<MkSymlinkCommandOptions
19
19
  private resolveOptions;
20
20
  private generateDefaultTarget;
21
21
  }
22
- //# sourceMappingURL=mksymlink.command.d.ts.map
@@ -65,4 +65,3 @@ class MkSymlinkCommand {
65
65
  }
66
66
  }
67
67
  exports.MkSymlinkCommand = MkSymlinkCommand;
68
- //# sourceMappingURL=mksymlink.command.js.map
@@ -6,4 +6,3 @@ export declare class MkSymlinkOptionValidator implements CommandOptionsValidator
6
6
  private validateSource;
7
7
  private validateForce;
8
8
  }
9
- //# sourceMappingURL=mksymlink.option-validator.d.ts.map
@@ -32,4 +32,3 @@ class MkSymlinkOptionValidator {
32
32
  }
33
33
  }
34
34
  exports.MkSymlinkOptionValidator = MkSymlinkOptionValidator;
35
- //# sourceMappingURL=mksymlink.option-validator.js.map
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -116,4 +116,3 @@ configCmd
116
116
  }
117
117
  });
118
118
  program.parse(process.argv);
119
- //# sourceMappingURL=index.js.map
package/src/index.d.ts CHANGED
@@ -9,4 +9,3 @@ export * from './commands/create/mksymlink.command-factory';
9
9
  export * from './commands/config/config.command';
10
10
  export * from './commands/config/config.option-validator';
11
11
  export * from './commands/config/config.command-factory';
12
- //# sourceMappingURL=index.d.ts.map
package/src/index.js CHANGED
@@ -25,4 +25,3 @@ __exportStar(require("./commands/create/mksymlink.command-factory"), exports);
25
25
  __exportStar(require("./commands/config/config.command"), exports);
26
26
  __exportStar(require("./commands/config/config.option-validator"), exports);
27
27
  __exportStar(require("./commands/config/config.command-factory"), exports);
28
- //# sourceMappingURL=index.js.map
@@ -42,4 +42,3 @@ export declare class ConfigService {
42
42
  private loadConfig;
43
43
  private saveConfig;
44
44
  }
45
- //# sourceMappingURL=config.service.d.ts.map
@@ -110,4 +110,3 @@ class ConfigService {
110
110
  }
111
111
  }
112
112
  exports.ConfigService = ConfigService;
113
- //# sourceMappingURL=config.service.js.map
@@ -8,4 +8,3 @@ export declare class PlatformDetector implements PlatformInformation {
8
8
  isMacOS(): boolean;
9
9
  isLinux(): boolean;
10
10
  }
11
- //# sourceMappingURL=platform-detector.d.ts.map
@@ -33,4 +33,3 @@ class PlatformDetector {
33
33
  }
34
34
  }
35
35
  exports.PlatformDetector = PlatformDetector;
36
- //# sourceMappingURL=platform-detector.js.map
@@ -9,4 +9,3 @@ export declare class SymlinkErrorHandler {
9
9
  constructor(logger: Logger);
10
10
  handle(error: unknown): never;
11
11
  }
12
- //# sourceMappingURL=symlink-error.d.ts.map
@@ -30,4 +30,3 @@ class SymlinkErrorHandler {
30
30
  }
31
31
  }
32
32
  exports.SymlinkErrorHandler = SymlinkErrorHandler;
33
- //# sourceMappingURL=symlink-error.js.map
@@ -10,4 +10,3 @@ export declare class SymlinkService implements SymlinkOperations {
10
10
  symlinkExists(path: string): Promise<boolean>;
11
11
  removeSymlink(path: string): Promise<void>;
12
12
  }
13
- //# sourceMappingURL=symlink-manager.d.ts.map
@@ -112,4 +112,3 @@ class SymlinkService {
112
112
  }
113
113
  }
114
114
  exports.SymlinkService = SymlinkService;
115
- //# sourceMappingURL=symlink-manager.js.map
@@ -10,4 +10,3 @@ export declare class SymlinkService implements SymlinkOperations {
10
10
  symlinkExists(path: string): Promise<boolean>;
11
11
  removeSymlink(path: string): Promise<void>;
12
12
  }
13
- //# sourceMappingURL=symlink.service.d.ts.map
@@ -112,4 +112,3 @@ class SymlinkService {
112
112
  }
113
113
  }
114
114
  exports.SymlinkService = SymlinkService;
115
- //# sourceMappingURL=symlink.service.js.map
@@ -37,4 +37,3 @@ export interface SymlinkOperations {
37
37
  symlinkExists(path: string): Promise<boolean>;
38
38
  removeSymlink(path: string): Promise<void>;
39
39
  }
40
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.js.map
@@ -1,5 +0,0 @@
1
- import { ConfigCommand, ConfigCommandOptions } from './config.command';
2
- export declare class ConfigCommandFactory {
3
- static create(options: ConfigCommandOptions): ConfigCommand;
4
- }
5
- //# sourceMappingURL=config.command-factory.d.ts.map
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigCommandFactory = void 0;
4
- const logger_1 = require("@dx-tools/logger");
5
- const config_command_1 = require("./config.command");
6
- const config_option_validator_1 = require("./config.option-validator");
7
- const config_service_1 = require("../services/config.service");
8
- class ConfigCommandFactory {
9
- static create(options) {
10
- const validator = new config_option_validator_1.ConfigOptionValidator();
11
- validator.validate(options);
12
- const logger = new logger_1.ConsoleLogger();
13
- const configService = new config_service_1.ConfigService();
14
- return new config_command_1.ConfigCommand(logger, configService, options);
15
- }
16
- }
17
- exports.ConfigCommandFactory = ConfigCommandFactory;
18
- //# sourceMappingURL=config.command-factory.js.map
@@ -1,22 +0,0 @@
1
- import { Logger } from '@dx-pkg/logger';
2
- import { Command } from '../types';
3
- import { ConfigService } from '../services/config.service';
4
- export type ConfigAction = 'get' | 'set' | 'unset' | 'list';
5
- export interface ConfigCommandOptions {
6
- action: ConfigAction;
7
- key?: string;
8
- value?: string;
9
- [key: string]: unknown;
10
- }
11
- export declare class ConfigCommand implements Command<ConfigCommandOptions> {
12
- private readonly logger;
13
- private readonly configService;
14
- private readonly options;
15
- constructor(logger: Logger, configService: ConfigService, options: ConfigCommandOptions);
16
- execute(): Promise<void>;
17
- private handleGet;
18
- private handleSet;
19
- private handleUnset;
20
- private handleList;
21
- }
22
- //# sourceMappingURL=config.command.d.ts.map
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigCommand = void 0;
4
- class ConfigCommand {
5
- logger;
6
- configService;
7
- options;
8
- constructor(logger, configService, options) {
9
- this.logger = logger;
10
- this.configService = configService;
11
- this.options = options;
12
- }
13
- async execute() {
14
- try {
15
- const { action, key, value } = this.options;
16
- switch (action) {
17
- case 'get':
18
- await this.handleGet(key);
19
- break;
20
- case 'set':
21
- await this.handleSet(key, value);
22
- break;
23
- case 'unset':
24
- await this.handleUnset(key);
25
- break;
26
- case 'list':
27
- await this.handleList();
28
- break;
29
- default:
30
- throw new Error(`Unknown config action: ${action}`);
31
- }
32
- }
33
- catch (error) {
34
- this.logger.error(`Config command failed: ${error instanceof Error ? error.message : String(error)}`);
35
- throw error;
36
- }
37
- }
38
- async handleGet(key) {
39
- if (!key) {
40
- throw new Error('Key is required for get action');
41
- }
42
- const value = this.configService.get(key);
43
- if (value === undefined) {
44
- this.logger.warning(`Config key '${key}' not found`);
45
- return;
46
- }
47
- this.logger.info(value);
48
- }
49
- async handleSet(key, value) {
50
- if (!key) {
51
- throw new Error('Key is required for set action');
52
- }
53
- if (!value) {
54
- throw new Error('Value is required for set action');
55
- }
56
- this.configService.set(key, value);
57
- this.logger.success(`Config set: ${key} = ${value}`);
58
- }
59
- async handleUnset(key) {
60
- if (!key) {
61
- throw new Error('Key is required for unset action');
62
- }
63
- this.configService.unset(key);
64
- this.logger.success(`Config unset: ${key}`);
65
- }
66
- async handleList() {
67
- const config = this.configService.list();
68
- const entries = Object.entries(config);
69
- if (entries.length === 0) {
70
- this.logger.info('No configuration found');
71
- return;
72
- }
73
- this.logger.info('Current configuration:');
74
- for (const [key, value] of entries) {
75
- this.logger.info(` ${key} = ${value}`);
76
- }
77
- }
78
- }
79
- exports.ConfigCommand = ConfigCommand;
80
- //# sourceMappingURL=config.command.js.map
@@ -1,9 +0,0 @@
1
- import { CommandOptionsValidator } from '../types';
2
- import { ConfigCommandOptions } from './config.command';
3
- export declare class ConfigOptionValidator implements CommandOptionsValidator<ConfigCommandOptions> {
4
- validate(options: ConfigCommandOptions): void;
5
- private validateAction;
6
- private validateKey;
7
- private validateValue;
8
- }
9
- //# sourceMappingURL=config.option-validator.d.ts.map
@@ -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,5 +0,0 @@
1
- import { MkSymlinkCommand, MkSymlinkCommandOptions } from './create/mksymlink.command';
2
- export declare class MkSymlinkCommandFactory {
3
- static create(options: MkSymlinkCommandOptions): MkSymlinkCommand;
4
- }
5
- //# sourceMappingURL=mksymlink.command-factory.d.ts.map
@@ -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
@@ -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