@timeax/scaffold 0.0.10 → 0.0.11
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/.idea/prettier.xml +6 -0
- package/dist/cli.cjs +21 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +21 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +21 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/apply-structure.ts +306 -255
package/dist/cli.cjs
CHANGED
|
@@ -941,6 +941,9 @@ async function applyStructure(opts) {
|
|
|
941
941
|
interactiveDelete
|
|
942
942
|
} = opts;
|
|
943
943
|
const logger6 = opts.logger ?? defaultLogger.child(groupName ? `[apply:${groupName}]` : "[apply]");
|
|
944
|
+
const projectRootAbs = path2__default.default.resolve(projectRoot);
|
|
945
|
+
const baseDirAbs = path2__default.default.resolve(baseDir);
|
|
946
|
+
baseDirAbs.endsWith(path2__default.default.sep) ? baseDirAbs : baseDirAbs + path2__default.default.sep;
|
|
944
947
|
const desiredPaths = /* @__PURE__ */ new Set();
|
|
945
948
|
const threshold = sizePromptThreshold ?? config.sizePromptThreshold ?? 128 * 1024;
|
|
946
949
|
async function walk(entry, inheritedStub) {
|
|
@@ -953,9 +956,9 @@ async function applyStructure(opts) {
|
|
|
953
956
|
}
|
|
954
957
|
async function handleDir(entry, inheritedStub) {
|
|
955
958
|
const relFromBase = entry.path.replace(/^[./]+/, "");
|
|
956
|
-
const absDir = path2__default.default.resolve(
|
|
959
|
+
const absDir = path2__default.default.resolve(baseDirAbs, relFromBase);
|
|
957
960
|
const relFromRoot = toPosixPath(
|
|
958
|
-
toProjectRelativePath(
|
|
961
|
+
toProjectRelativePath(projectRootAbs, absDir)
|
|
959
962
|
);
|
|
960
963
|
desiredPaths.add(relFromRoot);
|
|
961
964
|
ensureDirSync(absDir);
|
|
@@ -968,14 +971,14 @@ async function applyStructure(opts) {
|
|
|
968
971
|
}
|
|
969
972
|
async function handleFile(entry, inheritedStub) {
|
|
970
973
|
const relFromBase = entry.path.replace(/^[./]+/, "");
|
|
971
|
-
const absFile = path2__default.default.resolve(
|
|
974
|
+
const absFile = path2__default.default.resolve(baseDirAbs, relFromBase);
|
|
972
975
|
const relFromRoot = toPosixPath(
|
|
973
|
-
toProjectRelativePath(
|
|
976
|
+
toProjectRelativePath(projectRootAbs, absFile)
|
|
974
977
|
);
|
|
975
978
|
desiredPaths.add(relFromRoot);
|
|
976
979
|
const stubName = entry.stub ?? inheritedStub;
|
|
977
980
|
const ctx = {
|
|
978
|
-
projectRoot,
|
|
981
|
+
projectRoot: projectRootAbs,
|
|
979
982
|
targetPath: relFromRoot,
|
|
980
983
|
absolutePath: absFile,
|
|
981
984
|
isDirectory: false,
|
|
@@ -1015,7 +1018,19 @@ async function applyStructure(opts) {
|
|
|
1015
1018
|
await walk(entry);
|
|
1016
1019
|
}
|
|
1017
1020
|
for (const cachedPath of cache.allPaths()) {
|
|
1018
|
-
|
|
1021
|
+
const entry = cache.get(cachedPath);
|
|
1022
|
+
if (groupName) {
|
|
1023
|
+
if (!entry || entry.groupName !== groupName) {
|
|
1024
|
+
continue;
|
|
1025
|
+
}
|
|
1026
|
+
} else {
|
|
1027
|
+
if (entry && entry.groupName) {
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
if (desiredPaths.has(cachedPath)) {
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
1019
1034
|
const abs = path2__default.default.resolve(projectRoot, cachedPath);
|
|
1020
1035
|
const stats = statSafeSync(abs);
|
|
1021
1036
|
if (!stats) {
|
|
@@ -1026,7 +1041,6 @@ async function applyStructure(opts) {
|
|
|
1026
1041
|
cache.delete(cachedPath);
|
|
1027
1042
|
continue;
|
|
1028
1043
|
}
|
|
1029
|
-
const entry = cache.get(cachedPath);
|
|
1030
1044
|
const ctx = {
|
|
1031
1045
|
projectRoot,
|
|
1032
1046
|
targetPath: cachedPath,
|