@timeax/scaffold 0.0.9 → 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 +38 -22
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +38 -22
- 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 +2 -1
- package/src/cli/main.ts +285 -286
- package/src/core/apply-structure.ts +306 -255
package/dist/index.mjs
CHANGED
|
@@ -926,6 +926,9 @@ async function applyStructure(opts) {
|
|
|
926
926
|
interactiveDelete
|
|
927
927
|
} = opts;
|
|
928
928
|
const logger5 = opts.logger ?? defaultLogger.child(groupName ? `[apply:${groupName}]` : "[apply]");
|
|
929
|
+
const projectRootAbs = path2.resolve(projectRoot);
|
|
930
|
+
const baseDirAbs = path2.resolve(baseDir);
|
|
931
|
+
baseDirAbs.endsWith(path2.sep) ? baseDirAbs : baseDirAbs + path2.sep;
|
|
929
932
|
const desiredPaths = /* @__PURE__ */ new Set();
|
|
930
933
|
const threshold = sizePromptThreshold ?? config.sizePromptThreshold ?? 128 * 1024;
|
|
931
934
|
async function walk(entry, inheritedStub) {
|
|
@@ -938,9 +941,9 @@ async function applyStructure(opts) {
|
|
|
938
941
|
}
|
|
939
942
|
async function handleDir(entry, inheritedStub) {
|
|
940
943
|
const relFromBase = entry.path.replace(/^[./]+/, "");
|
|
941
|
-
const absDir = path2.resolve(
|
|
944
|
+
const absDir = path2.resolve(baseDirAbs, relFromBase);
|
|
942
945
|
const relFromRoot = toPosixPath(
|
|
943
|
-
toProjectRelativePath(
|
|
946
|
+
toProjectRelativePath(projectRootAbs, absDir)
|
|
944
947
|
);
|
|
945
948
|
desiredPaths.add(relFromRoot);
|
|
946
949
|
ensureDirSync(absDir);
|
|
@@ -953,14 +956,14 @@ async function applyStructure(opts) {
|
|
|
953
956
|
}
|
|
954
957
|
async function handleFile(entry, inheritedStub) {
|
|
955
958
|
const relFromBase = entry.path.replace(/^[./]+/, "");
|
|
956
|
-
const absFile = path2.resolve(
|
|
959
|
+
const absFile = path2.resolve(baseDirAbs, relFromBase);
|
|
957
960
|
const relFromRoot = toPosixPath(
|
|
958
|
-
toProjectRelativePath(
|
|
961
|
+
toProjectRelativePath(projectRootAbs, absFile)
|
|
959
962
|
);
|
|
960
963
|
desiredPaths.add(relFromRoot);
|
|
961
964
|
const stubName = entry.stub ?? inheritedStub;
|
|
962
965
|
const ctx = {
|
|
963
|
-
projectRoot,
|
|
966
|
+
projectRoot: projectRootAbs,
|
|
964
967
|
targetPath: relFromRoot,
|
|
965
968
|
absolutePath: absFile,
|
|
966
969
|
isDirectory: false,
|
|
@@ -1000,7 +1003,19 @@ async function applyStructure(opts) {
|
|
|
1000
1003
|
await walk(entry);
|
|
1001
1004
|
}
|
|
1002
1005
|
for (const cachedPath of cache.allPaths()) {
|
|
1003
|
-
|
|
1006
|
+
const entry = cache.get(cachedPath);
|
|
1007
|
+
if (groupName) {
|
|
1008
|
+
if (!entry || entry.groupName !== groupName) {
|
|
1009
|
+
continue;
|
|
1010
|
+
}
|
|
1011
|
+
} else {
|
|
1012
|
+
if (entry && entry.groupName) {
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
if (desiredPaths.has(cachedPath)) {
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1004
1019
|
const abs = path2.resolve(projectRoot, cachedPath);
|
|
1005
1020
|
const stats = statSafeSync(abs);
|
|
1006
1021
|
if (!stats) {
|
|
@@ -1011,7 +1026,6 @@ async function applyStructure(opts) {
|
|
|
1011
1026
|
cache.delete(cachedPath);
|
|
1012
1027
|
continue;
|
|
1013
1028
|
}
|
|
1014
|
-
const entry = cache.get(cachedPath);
|
|
1015
1029
|
const ctx = {
|
|
1016
1030
|
projectRoot,
|
|
1017
1031
|
targetPath: cachedPath,
|