@lsst/pik-plugin-worktree 0.8.0 → 0.8.1

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/index.js CHANGED
@@ -3,7 +3,7 @@ import pc from "picocolors";
3
3
  import { Command } from "commander";
4
4
  import { basename, resolve, relative } from "path";
5
5
  import { execSync } from "child_process";
6
- import { existsSync, mkdirSync, copyFileSync } from "fs";
6
+ import { existsSync, mkdirSync, statSync, cpSync, copyFileSync } from "fs";
7
7
  import { glob } from "glob";
8
8
  import { loadConfig } from "@lsst/pik-core";
9
9
  import { simpleGit } from "simple-git";
@@ -188,18 +188,21 @@ const createCommand = new Command("create").alias("add").description("Create a n
188
188
  if (worktreeConfig.copyFiles?.length) {
189
189
  console.log(pc.dim("Copying files..."));
190
190
  for (const pattern of worktreeConfig.copyFiles) {
191
- const files = await glob(pattern, { cwd: repoRoot, nodir: true });
192
- for (const file of files) {
193
- const src = resolve(repoRoot, file);
194
- const dest = resolve(worktreePath, file);
191
+ const matches = await glob(pattern, { cwd: repoRoot });
192
+ for (const match of matches) {
193
+ const src = resolve(repoRoot, match);
194
+ const dest = resolve(worktreePath, match);
195
195
  const destDir = resolve(dest, "..");
196
+ if (!existsSync(src)) continue;
196
197
  if (!existsSync(destDir)) {
197
198
  mkdirSync(destDir, { recursive: true });
198
199
  }
199
- if (existsSync(src)) {
200
+ if (statSync(src).isDirectory()) {
201
+ cpSync(src, dest, { recursive: true });
202
+ } else {
200
203
  copyFileSync(src, dest);
201
- console.log(pc.dim(` Copied ${file}`));
202
204
  }
205
+ console.log(pc.dim(` Copied ${match}`));
203
206
  }
204
207
  }
205
208
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,OAAO,aAAa,CAAC;AAQrB,eAAO,MAAM,aAAa,SA4JtB,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,OAAO,aAAa,CAAC;AAQrB,eAAO,MAAM,aAAa,SAgKtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsst/pik-plugin-worktree",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Git worktree management plugin for pik CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",