@lsst/pik-plugin-worktree 0.7.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 +10 -7
- package/dist/lib/commands/create.d.ts.map +1 -1
- package/package.json +1 -1
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
|
|
192
|
-
for (const
|
|
193
|
-
const src = resolve(repoRoot,
|
|
194
|
-
const dest = resolve(worktreePath,
|
|
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 (
|
|
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,
|
|
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"}
|