lalph 0.2.8 → 0.2.9

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/dist/cli.mjs CHANGED
@@ -151188,9 +151188,9 @@ var Worktree = class extends Service$1()("lalph/Worktree", { make: gen(function*
151188
151188
  yield* fs.makeDirectory(pathService.join(directory, ".lalph"), { recursive: true });
151189
151189
  const setupPath = pathService.resolve("scripts", "worktree-setup.sh");
151190
151190
  yield* seedSetupScript(setupPath);
151191
+ yield* seedCheckoutScript(pathService.resolve("scripts", "checkout-setup.sh"));
151191
151192
  if (yield* fs.exists(setupPath)) yield* make$23({
151192
151193
  cwd: directory,
151193
- extendEnv: true,
151194
151194
  shell: process.env.SHELL ?? true
151195
151195
  })`${setupPath}`.pipe(exitCode);
151196
151196
  return {
@@ -151221,6 +151221,12 @@ const seedSetupScript = fnUntraced(function* (setupPath) {
151221
151221
  yield* fs.writeFileString(setupPath, setupScriptTemplate(baseBranch));
151222
151222
  yield* fs.chmod(setupPath, 493);
151223
151223
  });
151224
+ const seedCheckoutScript = fnUntraced(function* (setupPath) {
151225
+ const fs = yield* FileSystem;
151226
+ if (yield* fs.exists(setupPath)) return;
151227
+ yield* fs.writeFileString(setupPath, checkoutScriptTemplate);
151228
+ yield* fs.chmod(setupPath, 493);
151229
+ });
151224
151230
  const discoverBaseBranch = gen(function* () {
151225
151231
  const originHead = yield* make$23`git symbolic-ref --short refs/remotes/origin/HEAD`.pipe(string, catch_$1((_) => succeed$1("")), map$8((output) => output.trim()));
151226
151232
  if (originHead !== "") return originHead.startsWith("origin/") ? originHead.slice(7) : originHead;
@@ -151235,6 +151241,13 @@ git checkout origin/${baseBranch}
151235
151241
 
151236
151242
  # Seeded by lalph. Customize this to prepare new worktrees.
151237
151243
  `;
151244
+ const checkoutScriptTemplate = `#!/usr/bin/env bash
151245
+ set -euo pipefail
151246
+
151247
+ pnpm install || true
151248
+
151249
+ # Seeded by lalph. Customize this to prepare branches after checkout.
151250
+ `;
151238
151251
  const makeExecHelpers = fnUntraced(function* (options) {
151239
151252
  const spawner = yield* ChildProcessSpawner;
151240
151253
  const provide = provideService(ChildProcessSpawner, spawner);
@@ -151854,6 +151867,8 @@ const run = fnUntraced(function* (options) {
151854
151867
  yield* worktree.exec`git branch -D ${gitFlow.branch}`;
151855
151868
  yield* worktree.exec`git checkout -b ${gitFlow.branch}`;
151856
151869
  }
151870
+ const checkoutScript = pathService.resolve("scripts", "checkout-setup.sh");
151871
+ if (yield* fs.exists(checkoutScript)) yield* worktree.exec`${checkoutScript}`;
151857
151872
  yield* addFinalizer(fnUntraced(function* () {
151858
151873
  const currentBranchName = yield* worktree.currentBranch(worktree.directory).pipe(option$1, map$8(getOrUndefined));
151859
151874
  if (!currentBranchName) return;
@@ -152209,7 +152224,7 @@ const commandSource = make$35("source").pipe(withDescription("Select the issue s
152209
152224
 
152210
152225
  //#endregion
152211
152226
  //#region package.json
152212
- var version = "0.2.8";
152227
+ var version = "0.2.9";
152213
152228
 
152214
152229
  //#endregion
152215
152230
  //#region src/commands/projects/ls.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.2.8",
4
+ "version": "0.2.9",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
package/src/Worktree.ts CHANGED
@@ -54,10 +54,12 @@ export class Worktree extends ServiceMap.Service<Worktree>()("lalph/Worktree", {
54
54
 
55
55
  const setupPath = pathService.resolve("scripts", "worktree-setup.sh")
56
56
  yield* seedSetupScript(setupPath)
57
+ yield* seedCheckoutScript(
58
+ pathService.resolve("scripts", "checkout-setup.sh"),
59
+ )
57
60
  if (yield* fs.exists(setupPath)) {
58
61
  yield* ChildProcess.make({
59
62
  cwd: directory,
60
- extendEnv: true,
61
63
  shell: process.env.SHELL ?? true,
62
64
  })`${setupPath}`.pipe(ChildProcess.exitCode)
63
65
  }
@@ -105,6 +107,15 @@ const seedSetupScript = Effect.fnUntraced(function* (setupPath: string) {
105
107
  yield* fs.chmod(setupPath, 0o755)
106
108
  })
107
109
 
110
+ const seedCheckoutScript = Effect.fnUntraced(function* (setupPath: string) {
111
+ const fs = yield* FileSystem.FileSystem
112
+
113
+ if (yield* fs.exists(setupPath)) return
114
+
115
+ yield* fs.writeFileString(setupPath, checkoutScriptTemplate)
116
+ yield* fs.chmod(setupPath, 0o755)
117
+ })
118
+
108
119
  const discoverBaseBranch = Effect.gen(function* () {
109
120
  const originHead =
110
121
  yield* ChildProcess.make`git symbolic-ref --short refs/remotes/origin/HEAD`.pipe(
@@ -137,6 +148,13 @@ git checkout origin/${baseBranch}
137
148
 
138
149
  # Seeded by lalph. Customize this to prepare new worktrees.
139
150
  `
151
+ const checkoutScriptTemplate = `#!/usr/bin/env bash
152
+ set -euo pipefail
153
+
154
+ pnpm install || true
155
+
156
+ # Seeded by lalph. Customize this to prepare branches after checkout.
157
+ `
140
158
 
141
159
  const makeExecHelpers = Effect.fnUntraced(function* (options: {
142
160
  readonly directory: string
@@ -79,6 +79,11 @@ const run = Effect.fnUntraced(
79
79
  yield* worktree.exec`git checkout -b ${gitFlow.branch}`
80
80
  }
81
81
 
82
+ const checkoutScript = pathService.resolve("scripts", "checkout-setup.sh")
83
+ if (yield* fs.exists(checkoutScript)) {
84
+ yield* worktree.exec`${checkoutScript}`
85
+ }
86
+
82
87
  // ensure cleanup of branch after run
83
88
  yield* Effect.addFinalizer(
84
89
  Effect.fnUntraced(function* () {