@tbsten/mir-core 0.0.1-alpha03 → 0.0.1-alpha04
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/package.json +1 -1
- package/src/registry.ts +3 -0
- package/src/template-engine.ts +3 -0
package/package.json
CHANGED
package/src/registry.ts
CHANGED
|
@@ -40,6 +40,8 @@ export function listTemplateFiles(
|
|
|
40
40
|
return listFilesRecursive(dirPath, "");
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const IGNORED_FILES = new Set([".DS_Store", "Thumbs.db", "desktop.ini"]);
|
|
44
|
+
|
|
43
45
|
function listFilesRecursive(basePath: string, relativePath: string): string[] {
|
|
44
46
|
const fullPath = relativePath
|
|
45
47
|
? path.join(basePath, relativePath)
|
|
@@ -48,6 +50,7 @@ function listFilesRecursive(basePath: string, relativePath: string): string[] {
|
|
|
48
50
|
const files: string[] = [];
|
|
49
51
|
|
|
50
52
|
for (const entry of entries) {
|
|
53
|
+
if (IGNORED_FILES.has(entry.name)) continue;
|
|
51
54
|
const entryRelative = relativePath
|
|
52
55
|
? path.join(relativePath, entry.name)
|
|
53
56
|
: entry.name;
|
package/src/template-engine.ts
CHANGED
|
@@ -62,12 +62,15 @@ export function extractVariables(template: string): string[] {
|
|
|
62
62
|
return [...vars];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
const IGNORED_FILES = new Set([".DS_Store", "Thumbs.db", "desktop.ini"]);
|
|
66
|
+
|
|
65
67
|
export function extractVariablesFromDirectory(dirPath: string): string[] {
|
|
66
68
|
const allVars = new Set<string>();
|
|
67
69
|
|
|
68
70
|
function walkDir(currentPath: string): void {
|
|
69
71
|
const entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
70
72
|
for (const entry of entries) {
|
|
73
|
+
if (IGNORED_FILES.has(entry.name)) continue;
|
|
71
74
|
const fullPath = path.join(currentPath, entry.name);
|
|
72
75
|
if (entry.isDirectory()) {
|
|
73
76
|
// ディレクトリ名からも変数を抽出
|