@icarusmx/creta 0.5.0 → 0.5.2
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/.claude/settings.local.json +2 -1
- package/bin/creta.js +20 -10
- package/package.json +1 -1
package/bin/creta.js
CHANGED
|
@@ -115,18 +115,28 @@ async function copyTemplate(src, dest, projectName, studentName, level) {
|
|
|
115
115
|
fs.mkdirSync(destPath, { recursive: true })
|
|
116
116
|
await copyTemplate(srcPath, destPath, projectName, studentName, level)
|
|
117
117
|
} else {
|
|
118
|
-
|
|
118
|
+
// Check if this is a binary file
|
|
119
|
+
const binaryExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.woff', '.woff2', '.ttf', '.eot']
|
|
120
|
+
const ext = path.extname(srcPath).toLowerCase()
|
|
119
121
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
if (binaryExtensions.includes(ext)) {
|
|
123
|
+
// Copy binary files directly without text processing
|
|
124
|
+
fs.copyFileSync(srcPath, destPath)
|
|
125
|
+
} else {
|
|
126
|
+
// Process text files with placeholders
|
|
127
|
+
let content = fs.readFileSync(srcPath, 'utf8')
|
|
128
|
+
|
|
129
|
+
// Apply level-specific modifications first
|
|
130
|
+
if (level > 0) {
|
|
131
|
+
content = applyLevelModifications(content, item, level)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Then replace placeholders
|
|
135
|
+
content = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName)
|
|
136
|
+
content = content.replace(/\{\{STUDENT_NAME\}\}/g, studentName)
|
|
137
|
+
|
|
138
|
+
fs.writeFileSync(destPath, content)
|
|
123
139
|
}
|
|
124
|
-
|
|
125
|
-
// Then replace placeholders
|
|
126
|
-
content = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName)
|
|
127
|
-
content = content.replace(/\{\{STUDENT_NAME\}\}/g, studentName)
|
|
128
|
-
|
|
129
|
-
fs.writeFileSync(destPath, content)
|
|
130
140
|
}
|
|
131
141
|
}
|
|
132
142
|
}
|