Use the project name in the export filename
This commit is contained in:
@ -76,12 +76,32 @@ const ArtifactExporter = {
|
||||
return finalMap;
|
||||
},
|
||||
|
||||
toSnakeCase(str) {
|
||||
return str
|
||||
.replace(/([a-z])([A-Z])/g, '$1_$2') // camelCase to snake_case
|
||||
.replace(/[\s\-\.]+/g, '_') // spaces, hyphens, dots to underscores
|
||||
.replace(/[^\w]/g, '') // remove non-word characters
|
||||
.toLowerCase() // convert to lowercase
|
||||
.replace(/^_+|_+$/g, '') // trim leading/trailing underscores
|
||||
.replace(/_+/g, '_'); // collapse multiple underscores
|
||||
},
|
||||
|
||||
generateZipFilename() {
|
||||
const now = new Date();
|
||||
const timestamp = now.getFullYear() + '-' +
|
||||
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(now.getDate()).padStart(2, '0');
|
||||
return `${timestamp}_claude-artifacts.zip`;
|
||||
String(now.getDate()).padStart(2, '0') + '_' +
|
||||
String(now.getHours()).padStart(2, '0') + '-' +
|
||||
String(now.getMinutes()).padStart(2, '0') + '-' +
|
||||
String(now.getSeconds()).padStart(2, '0');
|
||||
|
||||
// Get project name and convert to snake_case
|
||||
const rawProjectName = ProjectMeta.getProjectName();
|
||||
const projectName = (rawProjectName && rawProjectName.trim())
|
||||
? this.toSnakeCase(rawProjectName.trim())
|
||||
: 'claude_artifacts';
|
||||
|
||||
return `${timestamp}_${projectName}.zip`;
|
||||
},
|
||||
|
||||
addFilesToZip(zip, finalMap) {
|
||||
|
||||
Reference in New Issue
Block a user