create-addfox-app 0.1.1-beta.11 → 0.1.1-beta.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/cli.js +9 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -19,14 +19,16 @@ function getBundledTemplatesDir() {
|
|
|
19
19
|
function hasLocalTemplate(templateName) {
|
|
20
20
|
return existsSync(join(getBundledTemplatesDir(), templateName));
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const SKIP_RELATIVE_SEGMENTS = new Set([
|
|
23
23
|
"node_modules",
|
|
24
24
|
".git",
|
|
25
25
|
".pnpm"
|
|
26
26
|
]);
|
|
27
|
-
function shouldCopyLocalTemplatePath(src) {
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
function shouldCopyLocalTemplatePath(src, templateRoot) {
|
|
28
|
+
const root = external_node_path_resolve(templateRoot);
|
|
29
|
+
const rel = relative(root, external_node_path_resolve(src));
|
|
30
|
+
if (rel.startsWith("..")) return true;
|
|
31
|
+
for (const part of rel.split(/[/\\]/))if (SKIP_RELATIVE_SEGMENTS.has(part)) return false;
|
|
30
32
|
return true;
|
|
31
33
|
}
|
|
32
34
|
async function copyBundledTemplate(templateName, destDir) {
|
|
@@ -35,9 +37,10 @@ async function copyBundledTemplate(templateName, destDir) {
|
|
|
35
37
|
await mkdir(destDir, {
|
|
36
38
|
recursive: true
|
|
37
39
|
});
|
|
38
|
-
|
|
40
|
+
const resolvedTemplate = external_node_path_resolve(templatePath);
|
|
41
|
+
await cp(resolvedTemplate, destDir, {
|
|
39
42
|
recursive: true,
|
|
40
|
-
filter: (src)=>shouldCopyLocalTemplatePath(src)
|
|
43
|
+
filter: (src)=>shouldCopyLocalTemplatePath(src, resolvedTemplate)
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
const FRAMES = [
|