mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-06 04:48:04 +00:00
use a descriptive anique filename when downloading the files to zip
This commit is contained in:
parent
399affd1e9
commit
8978ed0ff3
@ -334,9 +334,6 @@ export class WorkbenchStore {
|
|||||||
const timestampHash = Date.now().toString(36).slice(-6);
|
const timestampHash = Date.now().toString(36).slice(-6);
|
||||||
const uniqueProjectName = `${projectName}_${timestampHash}`;
|
const uniqueProjectName = `${projectName}_${timestampHash}`;
|
||||||
|
|
||||||
// Prompt the user for a file name, prefilled with the project name
|
|
||||||
const fileName = prompt('Enter the file name', `${uniqueProjectName}.zip`);
|
|
||||||
|
|
||||||
for (const [filePath, dirent] of Object.entries(files)) {
|
for (const [filePath, dirent] of Object.entries(files)) {
|
||||||
if (dirent?.type === 'file' && !dirent.isBinary) {
|
if (dirent?.type === 'file' && !dirent.isBinary) {
|
||||||
const relativePath = extractRelativePath(filePath);
|
const relativePath = extractRelativePath(filePath);
|
||||||
@ -358,15 +355,10 @@ export class WorkbenchStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (fileName) {
|
|
||||||
// Generate the zip file and save it
|
// Generate the zip file and save it
|
||||||
const content = await zip.generateAsync({ type: 'blob' });
|
const content = await zip.generateAsync({ type: 'blob' });
|
||||||
saveAs(content, fileName);
|
saveAs(content, `${uniqueProjectName}.zip`);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async syncFiles(targetHandle: FileSystemDirectoryHandle) {
|
async syncFiles(targetHandle: FileSystemDirectoryHandle) {
|
||||||
|
Loading…
Reference in New Issue
Block a user