@alexgorbatchev/dotfiles 0.0.6 → 0.0.10

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.
@@ -42,7 +42,7 @@ import {
42
42
  defineConfig, // Create project configuration
43
43
  defineTool, // Create tool configurations
44
44
  Platform, // Platform enum for cross-platform configs
45
- } from '@alexgorbatchev/dotfiles';
45
+ } from "@alexgorbatchev/dotfiles";
46
46
  ```
47
47
 
48
48
  ## defineTool
@@ -50,7 +50,7 @@ import {
50
50
  Creates a tool configuration.
51
51
 
52
52
  ```typescript
53
- export default defineTool((install, ctx) => install('github-release', { repo: 'owner/tool' }).bin('tool'));
53
+ export default defineTool((install, ctx) => install("github-release", { repo: "owner/tool" }).bin("tool"));
54
54
  ```
55
55
 
56
56
  ### Parameters
@@ -102,16 +102,16 @@ The `env` parameter can be static or dynamic:
102
102
 
103
103
  ```typescript
104
104
  // Static environment variables
105
- install('github-release', {
106
- repo: 'owner/tool',
107
- env: { CUSTOM_FLAG: 'true' },
108
- }).bin('tool');
105
+ install("github-release", {
106
+ repo: "owner/tool",
107
+ env: { CUSTOM_FLAG: "true" },
108
+ }).bin("tool");
109
109
 
110
110
  // Dynamic environment variables (receives context with projectConfig, stagingDir)
111
- install('github-release', {
112
- repo: 'owner/tool',
111
+ install("github-release", {
112
+ repo: "owner/tool",
113
113
  env: (ctx) => ({ INSTALL_DIR: ctx.stagingDir }),
114
- }).bin('tool');
114
+ }).bin("tool");
115
115
  ```
116
116
 
117
117
  ### Shell Configuration
@@ -157,7 +157,7 @@ Creates project configuration. See Project Configuration section.
157
157
 
158
158
  ```typescript
159
159
  export default defineConfig(() => ({
160
- paths: { dotfilesDir: '~/.dotfiles' },
160
+ paths: { dotfilesDir: "~/.dotfiles" },
161
161
  }));
162
162
  ```
163
163
 
@@ -166,12 +166,12 @@ export default defineConfig(() => ({
166
166
  Enum for platform-specific configurations.
167
167
 
168
168
  ```typescript
169
- import { defineTool, Platform } from '@alexgorbatchev/dotfiles';
169
+ import { defineTool, Platform } from "@alexgorbatchev/dotfiles";
170
170
 
171
171
  export default defineTool((install) =>
172
- install('github-release', { repo: 'owner/tool' })
173
- .bin('tool')
174
- .platform(Platform.MacOS, (install) => install('brew', { formula: 'tool' }))
172
+ install("github-release", { repo: "owner/tool" })
173
+ .bin("tool")
174
+ .platform(Platform.MacOS, (install) => install("brew", { formula: "tool" })),
175
175
  );
176
176
  ```
177
177
 
@@ -316,7 +316,7 @@ INFO [my-tool] Configuring tool settings...
316
316
  Tagged template for removing indentation from multi-line strings.
317
317
 
318
318
  ```typescript
319
- import { dedentTemplate } from '@alexgorbatchev/dotfiles';
319
+ import { dedentTemplate } from "@alexgorbatchev/dotfiles";
320
320
 
321
321
  const script = dedentTemplate`
322
322
  if [[ -n "$VAR" ]]; then
@@ -377,13 +377,13 @@ The `ctx` parameter in `defineTool` provides access to tool and project informat
377
377
 
378
378
  ```typescript
379
379
  export default defineTool((install, ctx) =>
380
- install('github-release', { repo: 'owner/tool' })
381
- .bin('tool')
380
+ install("github-release", { repo: "owner/tool" })
381
+ .bin("tool")
382
382
  .zsh((shell) =>
383
383
  shell.always(/* zsh */ `
384
384
  source "${ctx.toolDir}/shell/key-bindings.zsh"
385
- `)
386
- )
385
+ `),
386
+ ),
387
387
  );
388
388
  ```
389
389
 
@@ -391,13 +391,13 @@ export default defineTool((install, ctx) =>
391
391
 
392
392
  ```typescript
393
393
  export default defineTool((install, ctx) =>
394
- install('github-release', { repo: 'owner/tool' })
395
- .bin('tool')
394
+ install("github-release", { repo: "owner/tool" })
395
+ .bin("tool")
396
396
  .zsh((shell) =>
397
397
  shell.env({
398
398
  TOOL_HOME: `${ctx.projectConfig.paths.binariesDir}/${ctx.toolName}`,
399
- })
400
- )
399
+ }),
400
+ ),
401
401
  );
402
402
  ```
403
403
 
@@ -405,13 +405,13 @@ export default defineTool((install, ctx) =>
405
405
 
406
406
  ```typescript
407
407
  export default defineTool((install, ctx) =>
408
- install('github-release', { repo: 'owner/tool' })
409
- .bin('tool')
408
+ install("github-release", { repo: "owner/tool" })
409
+ .bin("tool")
410
410
  .zsh((shell) =>
411
411
  shell.always(/* zsh */ `
412
412
  export TOOL_THEME="${ctx.currentDir}/share/themes/default.toml"
413
- `)
414
- )
413
+ `),
414
+ ),
415
415
  );
416
416
  ```
417
417
 
@@ -429,18 +429,18 @@ The `ctx.replaceInFile` method performs regex-based replacements within files.
429
429
 
430
430
  ```typescript
431
431
  export default defineTool((install, ctx) =>
432
- install('github-release', { repo: 'owner/tool' })
433
- .bin('tool')
434
- .hook('after-install', async () => {
432
+ install("github-release", { repo: "owner/tool" })
433
+ .bin("tool")
434
+ .hook("after-install", async () => {
435
435
  // Simple replacement (replaces all matches)
436
- const wasReplaced = await ctx.replaceInFile(`${ctx.currentDir}/config.toml`, /placeholder_value/, 'actual_value');
436
+ const wasReplaced = await ctx.replaceInFile(`${ctx.currentDir}/config.toml`, /placeholder_value/, "actual_value");
437
437
 
438
438
  // Line-by-line replacement with callback
439
439
  await ctx.replaceInFile(
440
440
  `${ctx.currentDir}/settings.ini`,
441
441
  /version=(\d+)/,
442
442
  (match) => `version=${Number(match.captures[0]) + 1}`,
443
- { mode: 'line' },
443
+ { mode: "line" },
444
444
  );
445
445
 
446
446
  // Async replacer function
@@ -451,9 +451,9 @@ export default defineTool((install, ctx) =>
451
451
 
452
452
  // With error message for debugging missing patterns
453
453
  await ctx.replaceInFile(`${ctx.currentDir}/config.toml`, /theme = ".*"/, 'theme = "dark"', {
454
- errorMessage: 'Could not find theme setting in config.toml',
454
+ errorMessage: "Could not find theme setting in config.toml",
455
455
  });
456
- })
456
+ }),
457
457
  );
458
458
  ```
459
459
 
@@ -482,20 +482,20 @@ The `ctx.log` provides a simple logging interface for user-facing messages:
482
482
 
483
483
  ```typescript
484
484
  export default defineTool((install, ctx) =>
485
- install('github-release', { repo: 'owner/tool' })
486
- .bin('tool')
487
- .hook('after-install', async () => {
488
- ctx.log.info('Configuring tool settings...');
485
+ install("github-release", { repo: "owner/tool" })
486
+ .bin("tool")
487
+ .hook("after-install", async () => {
488
+ ctx.log.info("Configuring tool settings...");
489
489
 
490
490
  // Perform configuration
491
491
  const result = await configureSettings();
492
492
 
493
493
  if (result.warnings.length > 0) {
494
- ctx.log.warn('Some settings could not be applied');
494
+ ctx.log.warn("Some settings could not be applied");
495
495
  }
496
496
 
497
- ctx.log.debug('Configuration complete');
498
- })
497
+ ctx.log.debug("Configuration complete");
498
+ }),
499
499
  );
500
500
  ```
501
501
 
@@ -526,13 +526,13 @@ The `ctx.resolve` method resolves a glob pattern to a single file or directory p
526
526
 
527
527
  ```typescript
528
528
  export default defineTool((install, ctx) =>
529
- install('github-release', { repo: 'BurntSushi/ripgrep' })
530
- .bin('rg')
529
+ install("github-release", { repo: "BurntSushi/ripgrep" })
530
+ .bin("rg")
531
531
  .zsh((shell) =>
532
532
  shell.always(/* zsh */ `
533
- source "${ctx.resolve('completions/_rg.zsh')}"
534
- `)
535
- )
533
+ source "${ctx.resolve("completions/_rg.zsh")}"
534
+ `),
535
+ ),
536
536
  );
537
537
  ```
538
538
 
@@ -540,15 +540,15 @@ export default defineTool((install, ctx) =>
540
540
 
541
541
  ```typescript
542
542
  // Versioned directory with wildcard
543
- const versionDir = ctx.resolve('ripgrep-*-x86_64-*');
543
+ const versionDir = ctx.resolve("ripgrep-*-x86_64-*");
544
544
  // -> "/path/to/tools/rg/ripgrep-14.1.0-x86_64-linux"
545
545
 
546
546
  // Single completion file
547
- const completion = ctx.resolve('completions/*.zsh');
547
+ const completion = ctx.resolve("completions/*.zsh");
548
548
  // -> "/path/to/tools/rg/completions/_rg.zsh"
549
549
 
550
550
  // Absolute path pattern
551
- const binary = ctx.resolve('/opt/myapp/bin/myapp-*');
551
+ const binary = ctx.resolve("/opt/myapp/bin/myapp-*");
552
552
  // -> "/opt/myapp/bin/myapp-1.2.3"
553
553
  ```
554
554