@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.
@@ -76,18 +76,18 @@ For other context properties (`toolDir`, `currentDir`, `projectConfig`, etc.), u
76
76
 
77
77
  ```typescript
78
78
  export default defineTool((install, ctx) =>
79
- install('github-release', { repo: 'owner/tool' })
80
- .bin('tool')
79
+ install("github-release", { repo: "owner/tool" })
80
+ .bin("tool")
81
81
  .zsh((shell) =>
82
82
  shell
83
83
  .env({ TOOL_HOME: ctx.currentDir })
84
84
  .path(`${ctx.currentDir}/bin`) // Add tool's bin directory to PATH
85
- .aliases({ t: 'tool', ts: 'tool status' })
86
- .completions('completions/_tool')
85
+ .aliases({ t: "tool", ts: "tool status" })
86
+ .completions("completions/_tool")
87
87
  .functions({
88
- 'tool-helper': 'tool --config "$TOOL_HOME/config.toml" "$@"',
89
- })
90
- )
88
+ "tool-helper": 'tool --config "$TOOL_HOME/config.toml" "$@"',
89
+ }),
90
+ ),
91
91
  );
92
92
  ```
93
93
 
@@ -259,13 +259,13 @@ For expensive operations:
259
259
 
260
260
  ```typescript
261
261
  export default defineTool((install, ctx) =>
262
- install('github-release', { repo: 'owner/tool' })
263
- .bin('tool')
262
+ install("github-release", { repo: "owner/tool" })
263
+ .bin("tool")
264
264
  .zsh((shell) =>
265
265
  shell.once(`
266
266
  tool gen-completions --zsh > "${ctx.projectConfig.paths.generatedDir}/completions/_tool"
267
- `)
268
- )
267
+ `),
268
+ ),
269
269
  );
270
270
  ```
271
271
 
@@ -275,9 +275,9 @@ Share configuration across shells using the outer `ctx` from `defineTool`:
275
275
 
276
276
  ```typescript
277
277
  export default defineTool((install, ctx) => {
278
- const configureShell = (shell) => shell.env({ TOOL_HOME: ctx.currentDir }).aliases({ t: 'tool' });
278
+ const configureShell = (shell) => shell.env({ TOOL_HOME: ctx.currentDir }).aliases({ t: "tool" });
279
279
 
280
- return install('github-release', { repo: 'owner/tool' }).bin('tool').zsh(configureShell).bash(configureShell);
280
+ return install("github-release", { repo: "owner/tool" }).bin("tool").zsh(configureShell).bash(configureShell);
281
281
  });
282
282
  ```
283
283
 
@@ -287,17 +287,17 @@ Always use context variables from the outer `ctx`:
287
287
 
288
288
  ```typescript
289
289
  export default defineTool((install, ctx) =>
290
- install('github-release', { repo: 'owner/tool' })
291
- .bin('tool')
290
+ install("github-release", { repo: "owner/tool" })
291
+ .bin("tool")
292
292
  .zsh((shell) =>
293
293
  shell.env({
294
294
  TOOL_CONFIG: ctx.toolDir, // Tool config directory
295
- TOOL_DATA: '~/.local/share/tool',
295
+ TOOL_DATA: "~/.local/share/tool",
296
296
  }).always(`
297
297
  FZF_DIR="${ctx.projectConfig.paths.binariesDir}/fzf"
298
298
  [[ -d "$FZF_DIR" ]] && export FZF_BASE="$FZF_DIR"
299
- `)
300
- )
299
+ `),
300
+ ),
301
301
  );
302
302
  ```
303
303
 
@@ -347,15 +347,15 @@ tools/my-tool/
347
347
 
348
348
  ```typescript
349
349
  export default defineTool((install) =>
350
- install('github-release', { repo: 'owner/my-tool' })
351
- .bin('my-tool')
352
- .symlink('./config.toml', '~/.config/my-tool/config.toml')
353
- .symlink('./themes/', '~/.config/my-tool/themes')
350
+ install("github-release", { repo: "owner/my-tool" })
351
+ .bin("my-tool")
352
+ .symlink("./config.toml", "~/.config/my-tool/config.toml")
353
+ .symlink("./themes/", "~/.config/my-tool/themes")
354
354
  .zsh((shell) =>
355
355
  shell.env({
356
- MY_TOOL_CONFIG: '~/.config/my-tool/config.toml',
357
- })
358
- )
356
+ MY_TOOL_CONFIG: "~/.config/my-tool/config.toml",
357
+ }),
358
+ ),
359
359
  );
360
360
  ```
361
361
 
@@ -430,9 +430,9 @@ For other context properties (`toolDir`, `currentDir`, `projectConfig`, etc.), u
430
430
 
431
431
  ```typescript
432
432
  export default defineTool((install, ctx) =>
433
- install('github-release', { repo: 'owner/tool' })
434
- .bin('tool')
435
- .zsh((shell) => shell.completions('completions/_tool.zsh'))
433
+ install("github-release", { repo: "owner/tool" })
434
+ .bin("tool")
435
+ .zsh((shell) => shell.completions("completions/_tool.zsh")),
436
436
  );
437
437
  ```
438
438
 
@@ -541,16 +541,16 @@ Hooks allow custom logic at different stages of the installation process.
541
541
  ## Basic Usage
542
542
 
543
543
  ```typescript
544
- import { defineTool } from '@alexgorbatchev/dotfiles';
544
+ import { defineTool } from "@alexgorbatchev/dotfiles";
545
545
 
546
546
  export default defineTool((install, ctx) =>
547
- install('github-release', { repo: 'owner/tool' })
548
- .bin('tool')
549
- .hook('after-install', async (context) => {
547
+ install("github-release", { repo: "owner/tool" })
548
+ .bin("tool")
549
+ .hook("after-install", async (context) => {
550
550
  const { $, log, fileSystem } = context;
551
551
  await $`./tool init`;
552
- log.info('Tool initialized');
553
- })
552
+ log.info("Tool initialized");
553
+ }),
554
554
  );
555
555
  ```
556
556
 
@@ -709,53 +709,53 @@ This logging happens regardless of whether `.quiet()` is used on the shell comma
709
709
  ### Custom Binary Processing
710
710
 
711
711
  ```typescript
712
- import { defineTool } from '@alexgorbatchev/dotfiles';
713
- import path from 'path';
712
+ import { defineTool } from "@alexgorbatchev/dotfiles";
713
+ import path from "path";
714
714
 
715
715
  export default defineTool((install, ctx) =>
716
- install('github-release', { repo: 'owner/custom-tool' })
717
- .bin('custom-tool')
718
- .hook('after-extract', async ({ extractDir, stagingDir, fileSystem, log }) => {
716
+ install("github-release", { repo: "owner/custom-tool" })
717
+ .bin("custom-tool")
718
+ .hook("after-extract", async ({ extractDir, stagingDir, fileSystem, log }) => {
719
719
  if (extractDir) {
720
720
  // Custom binary selection and processing
721
- const binaries = await fileSystem.readdir(path.join(extractDir, 'bin'));
722
- const mainBinary = binaries.find((name) => name.startsWith('main-'));
721
+ const binaries = await fileSystem.readdir(path.join(extractDir, "bin"));
722
+ const mainBinary = binaries.find((name) => name.startsWith("main-"));
723
723
 
724
724
  if (mainBinary) {
725
- const sourcePath = path.join(extractDir, 'bin', mainBinary);
726
- const targetPath = path.join(stagingDir ?? '', 'tool');
725
+ const sourcePath = path.join(extractDir, "bin", mainBinary);
726
+ const targetPath = path.join(stagingDir ?? "", "tool");
727
727
  await fileSystem.copy(sourcePath, targetPath);
728
728
  log.info(`Selected binary: ${mainBinary}`);
729
729
  }
730
730
  }
731
- })
731
+ }),
732
732
  );
733
733
  ```
734
734
 
735
735
  ### Environment-Specific Setup
736
736
 
737
737
  ```typescript
738
- import { defineTool } from '@alexgorbatchev/dotfiles';
738
+ import { defineTool } from "@alexgorbatchev/dotfiles";
739
739
 
740
740
  export default defineTool((install, ctx) =>
741
- install('github-release', { repo: 'owner/custom-tool' })
742
- .bin('custom-tool')
743
- .hook('after-install', async ({ systemInfo, fileSystem, log, $ }) => {
741
+ install("github-release", { repo: "owner/custom-tool" })
742
+ .bin("custom-tool")
743
+ .hook("after-install", async ({ systemInfo, fileSystem, log, $ }) => {
744
744
  // Platform-specific setup
745
- if (systemInfo.platform === 'darwin') {
745
+ if (systemInfo.platform === "darwin") {
746
746
  // macOS-specific setup
747
747
  await $`./setup-macos.sh`;
748
- } else if (systemInfo.platform === 'linux') {
748
+ } else if (systemInfo.platform === "linux") {
749
749
  // Linux-specific setup
750
750
  await $`./setup-linux.sh`;
751
751
  }
752
752
 
753
753
  // Architecture-specific setup
754
- if (systemInfo.arch === 'arm64') {
755
- log.info('Configuring for ARM64 architecture');
754
+ if (systemInfo.arch === "arm64") {
755
+ log.info("Configuring for ARM64 architecture");
756
756
  await $`./configure-arm64.sh`;
757
757
  }
758
- })
758
+ }),
759
759
  );
760
760
  ```
761
761
 
@@ -764,18 +764,18 @@ export default defineTool((install, ctx) =>
764
764
  Set environment variables during installation (for curl-script installs):
765
765
 
766
766
  ```typescript
767
- import { defineTool } from '@alexgorbatchev/dotfiles';
767
+ import { defineTool } from "@alexgorbatchev/dotfiles";
768
768
 
769
769
  export default defineTool((install) =>
770
- install('curl-script', {
771
- url: 'https://example.com/install.sh',
772
- shell: 'bash',
770
+ install("curl-script", {
771
+ url: "https://example.com/install.sh",
772
+ shell: "bash",
773
773
  env: {
774
- INSTALL_DIR: '~/.local/bin',
775
- ENABLE_FEATURE: 'true',
776
- API_KEY: process.env.TOOL_API_KEY || 'default',
774
+ INSTALL_DIR: "~/.local/bin",
775
+ ENABLE_FEATURE: "true",
776
+ API_KEY: process.env.TOOL_API_KEY || "default",
777
777
  },
778
- }).bin('my-tool')
778
+ }).bin("my-tool"),
779
779
  );
780
780
  ```
781
781
 
@@ -803,38 +803,39 @@ export default defineTool((install) =>
803
803
  ## Complete Example
804
804
 
805
805
  ```typescript
806
- import { defineTool } from '@alexgorbatchev/dotfiles';
807
- import path from 'path';
806
+ import { defineTool } from "@alexgorbatchev/dotfiles";
807
+ import path from "path";
808
808
 
809
809
  export default defineTool((install, ctx) =>
810
- install('github-release', { repo: 'owner/custom-tool' })
811
- .bin('custom-tool')
812
- .symlink('./config.yml', '~/.config/custom-tool/config.yml')
813
- .hook('before-install', async ({ log }) => {
814
- log.info('Starting custom-tool installation...');
810
+ install("github-release", { repo: "owner/custom-tool" })
811
+ .bin("custom-tool")
812
+ .symlink("./config.yml", "~/.config/custom-tool/config.yml")
813
+ .hook("before-install", async ({ log }) => {
814
+ log.info("Starting custom-tool installation...");
815
815
  })
816
- .hook('after-extract', async ({ extractDir, log, $ }) => {
816
+ .hook("after-extract", async ({ extractDir, log, $ }) => {
817
817
  if (extractDir) {
818
818
  // Build additional components
819
- log.info('Building plugins...');
819
+ log.info("Building plugins...");
820
820
  await $`cd ${extractDir} && make plugins`;
821
821
  }
822
822
  })
823
- .hook('after-install', async ({ toolName, installedDir, systemInfo, fileSystem, log, $ }) => {
823
+ .hook("after-install", async ({ toolName, installedDir, systemInfo, fileSystem, log, $ }) => {
824
824
  // Create data directory
825
- const dataDir = path.join(systemInfo.homeDir, '.local/share', toolName);
825
+ const dataDir = path.join(systemInfo.homeDir, ".local/share", toolName);
826
826
  await fileSystem.mkdir(dataDir, { recursive: true });
827
827
 
828
828
  // Initialize tool
829
- await $`${path.join(installedDir ?? '', toolName)} init --data-dir ${dataDir}`;
829
+ await $`${path.join(installedDir ?? "", toolName)} init --data-dir ${dataDir}`;
830
830
 
831
831
  // Set up completion
832
- await $`${
833
- path.join(installedDir ?? '', toolName)
834
- } completion zsh > ${ctx.projectConfig.paths.generatedDir}/completions/_${toolName}`;
832
+ await $`${path.join(
833
+ installedDir ?? "",
834
+ toolName,
835
+ )} completion zsh > ${ctx.projectConfig.paths.generatedDir}/completions/_${toolName}`;
835
836
 
836
837
  log.info(`Initialized ${toolName} with data directory: ${dataDir}`);
837
838
  })
838
- .zsh((shell) => shell.env({ CUSTOM_TOOL_DATA: '~/.local/share/custom-tool' }).aliases({ ct: 'custom-tool' }))
839
+ .zsh((shell) => shell.env({ CUSTOM_TOOL_DATA: "~/.local/share/custom-tool" }).aliases({ ct: "custom-tool" })),
839
840
  );
840
841
  ```