@henryqw/pi-deps 0.3.1 → 0.3.3

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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Prepare locked Node and uv dependencies whenever Git creates a new worktree for an opted-in repository.
4
4
 
5
+ ## Why
6
+
7
+ - **Created for**: Installing locked dependencies whenever Git creates a new worktree in an opted-in repository.
8
+ - **Advantage**: Prepares each checkout regardless of which tool created it, without paying install cost at every Pi startup.
9
+
5
10
  ## Install
6
11
 
7
12
  ```bash
@@ -71,8 +71,8 @@ const waitTimeoutMs = 10 * 60_000;
71
71
  const spinnerIntervalMs = 100;
72
72
  const spinnerFrames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
73
73
 
74
- function formatElapsed(startedAt: number, now = Date.now()): string {
75
- const seconds = Math.max(0, Math.floor((now - startedAt) / 1_000));
74
+ function formatElapsed(startedAt: number): string {
75
+ const seconds = Math.max(0, Math.floor((Date.now() - startedAt) / 1_000));
76
76
  const minutes = Math.floor(seconds / 60);
77
77
  return minutes ? `${minutes}m ${seconds % 60}s` : `${seconds}s`;
78
78
  }
@@ -93,7 +93,6 @@ export interface InstallWatchContext {
93
93
  export async function watchDependencyInstallation(
94
94
  exec: ExtensionAPI["exec"],
95
95
  ctx: InstallWatchContext,
96
- timing: { pollMs?: number; successTtlMs?: number } = {},
97
96
  ): Promise<void> {
98
97
  if (ctx.mode && ctx.mode !== "tui") return;
99
98
  const git = await exec("git", ["rev-parse", "--path-format=absolute", "--git-dir"], { cwd: ctx.cwd });
@@ -137,7 +136,7 @@ export async function watchDependencyInstallation(
137
136
  }
138
137
  const deadline = Date.now() + waitTimeoutMs;
139
138
  while (status.state === "running" && Date.now() < deadline) {
140
- await new Promise((resolveSleep) => setTimeout(resolveSleep, timing.pollMs ?? pollMs));
139
+ await new Promise((resolveSleep) => setTimeout(resolveSleep, pollMs));
141
140
  status = await readStatus();
142
141
  if (!status) {
143
142
  ctx.ui.setWidget(widgetKey, undefined);
@@ -147,7 +146,7 @@ export async function watchDependencyInstallation(
147
146
  await rm(statusPath, { force: true }); // consume so later sessions do not replay a stale outcome
148
147
  if (status.state === "ok") {
149
148
  ctx.ui.setWidget(widgetKey, ["pi-deps: dependencies installed"]);
150
- setTimeout(() => ctx.ui.setWidget(widgetKey, undefined), timing.successTtlMs ?? successTtlMs);
149
+ setTimeout(() => ctx.ui.setWidget(widgetKey, undefined), successTtlMs);
151
150
  } else if (status.state === "error") {
152
151
  ctx.ui.setWidget(widgetKey, [
153
152
  `pi-deps: install failed: ${status.message ?? "unknown error"}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-deps",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Prepare Node and uv dependencies when opted-in Git worktrees are created.",
5
5
  "keywords": [
6
6
  "pi-package",