@timeax/scaffold 0.0.10 → 0.0.12

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.cjs CHANGED
@@ -935,6 +935,9 @@ async function applyStructure(opts) {
935
935
  interactiveDelete
936
936
  } = opts;
937
937
  const logger5 = opts.logger ?? defaultLogger.child(groupName ? `[apply:${groupName}]` : "[apply]");
938
+ const projectRootAbs = path2__default.default.resolve(projectRoot);
939
+ const baseDirAbs = path2__default.default.resolve(baseDir);
940
+ baseDirAbs.endsWith(path2__default.default.sep) ? baseDirAbs : baseDirAbs + path2__default.default.sep;
938
941
  const desiredPaths = /* @__PURE__ */ new Set();
939
942
  const threshold = sizePromptThreshold ?? config.sizePromptThreshold ?? 128 * 1024;
940
943
  async function walk(entry, inheritedStub) {
@@ -947,9 +950,9 @@ async function applyStructure(opts) {
947
950
  }
948
951
  async function handleDir(entry, inheritedStub) {
949
952
  const relFromBase = entry.path.replace(/^[./]+/, "");
950
- const absDir = path2__default.default.resolve(baseDir, relFromBase);
953
+ const absDir = path2__default.default.resolve(baseDirAbs, relFromBase);
951
954
  const relFromRoot = toPosixPath(
952
- toProjectRelativePath(projectRoot, absDir)
955
+ toProjectRelativePath(projectRootAbs, absDir)
953
956
  );
954
957
  desiredPaths.add(relFromRoot);
955
958
  ensureDirSync(absDir);
@@ -962,14 +965,14 @@ async function applyStructure(opts) {
962
965
  }
963
966
  async function handleFile(entry, inheritedStub) {
964
967
  const relFromBase = entry.path.replace(/^[./]+/, "");
965
- const absFile = path2__default.default.resolve(baseDir, relFromBase);
968
+ const absFile = path2__default.default.resolve(baseDirAbs, relFromBase);
966
969
  const relFromRoot = toPosixPath(
967
- toProjectRelativePath(projectRoot, absFile)
970
+ toProjectRelativePath(projectRootAbs, absFile)
968
971
  );
969
972
  desiredPaths.add(relFromRoot);
970
973
  const stubName = entry.stub ?? inheritedStub;
971
974
  const ctx = {
972
- projectRoot,
975
+ projectRoot: projectRootAbs,
973
976
  targetPath: relFromRoot,
974
977
  absolutePath: absFile,
975
978
  isDirectory: false,
@@ -1009,7 +1012,19 @@ async function applyStructure(opts) {
1009
1012
  await walk(entry);
1010
1013
  }
1011
1014
  for (const cachedPath of cache.allPaths()) {
1012
- if (desiredPaths.has(cachedPath)) continue;
1015
+ const entry = cache.get(cachedPath);
1016
+ if (groupName) {
1017
+ if (!entry || entry.groupName !== groupName) {
1018
+ continue;
1019
+ }
1020
+ } else {
1021
+ if (entry && entry.groupName) {
1022
+ continue;
1023
+ }
1024
+ }
1025
+ if (desiredPaths.has(cachedPath)) {
1026
+ continue;
1027
+ }
1013
1028
  const abs = path2__default.default.resolve(projectRoot, cachedPath);
1014
1029
  const stats = statSafeSync(abs);
1015
1030
  if (!stats) {
@@ -1020,7 +1035,6 @@ async function applyStructure(opts) {
1020
1035
  cache.delete(cachedPath);
1021
1036
  continue;
1022
1037
  }
1023
- const entry = cache.get(cachedPath);
1024
1038
  const ctx = {
1025
1039
  projectRoot,
1026
1040
  targetPath: cachedPath,