diff --git a/app/lib/stores/workbench.ts b/app/lib/stores/workbench.ts index 75e328a..a4f56ff 100644 --- a/app/lib/stores/workbench.ts +++ b/app/lib/stores/workbench.ts @@ -14,7 +14,7 @@ import { saveAs } from 'file-saver'; import { Octokit, type RestEndpointMethodTypes } from '@octokit/rest'; import * as nodePath from 'node:path'; import { extractRelativePath } from '~/utils/diff'; -import { description } from '../persistence'; +import { description } from '~/persistence'; export interface ArtifactState { id: string; @@ -169,7 +169,6 @@ export class WorkbenchStore { this.#editorStore.setSelectedFile(filePath); } - async saveFile(filePath: string) { const documents = this.#editorStore.documents.get(); const document = documents[filePath]; @@ -329,9 +328,10 @@ export class WorkbenchStore { async downloadZip() { const zip = new JSZip(); const files = this.files.get(); + // Get the project name from the description input, or use a default name const projectName = (description.value ?? 'project').toLocaleLowerCase().split(' ').join('_'); - + // Generate a simple 6-character hash based on the current timestamp const timestampHash = Date.now().toString(36).slice(-6); const uniqueProjectName = `${projectName}_${timestampHash}`; @@ -357,10 +357,10 @@ export class WorkbenchStore { } } } + // Generate the zip file and save it const content = await zip.generateAsync({ type: 'blob' }); saveAs(content, `${uniqueProjectName}.zip`); - } async syncFiles(targetHandle: FileSystemDirectoryHandle) { diff --git a/app/utils/constants.ts b/app/utils/constants.ts index 54b78c4..96db70f 100644 --- a/app/utils/constants.ts +++ b/app/utils/constants.ts @@ -283,7 +283,7 @@ const getOllamaBaseUrl = () => { }; async function getOllamaModels(): Promise { - /* + /* * if (typeof window === 'undefined') { * return []; * } diff --git a/package-lock.json b/package-lock.json index 3ed7fb1..93afd4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ "jszip": "^3.10.1", "nanostores": "^0.10.3", "ollama-ai-provider": "^0.15.2", + "pnpm": "^9.14.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hotkeys-hook": "^4.5.0", @@ -18446,6 +18447,22 @@ "pathe": "^1.1.2" } }, + "node_modules/pnpm": { + "version": "9.14.4", + "resolved": "https://registry.npmjs.org/pnpm/-/pnpm-9.14.4.tgz", + "integrity": "sha512-yBgLP75OS8oCyUI0cXiWtVKXQKbLrfGfp4JUJwQD6i8n1OHUagig9WyJtj3I6/0+5TMm2nICc3lOYgD88NGEqw==", + "license": "MIT", + "bin": { + "pnpm": "bin/pnpm.cjs", + "pnpx": "bin/pnpx.cjs" + }, + "engines": { + "node": ">=18.12" + }, + "funding": { + "url": "https://opencollective.com/pnpm" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", diff --git a/package.json b/package.json index 6e4e1e1..dbfae73 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "jszip": "^3.10.1", "nanostores": "^0.10.3", "ollama-ai-provider": "^0.15.2", + "pnpm": "^9.14.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hotkeys-hook": "^4.5.0", @@ -96,9 +97,9 @@ "devDependencies": { "@blitz/eslint-plugin": "0.1.0", "@cloudflare/workers-types": "^4.20240620.0", - "@remix-run/dev": "^2.10.0", - "@rollup/plugin-inject": "^5.0.5", "@jridgewell/sourcemap-codec": "^1.4.15", + "@remix-run/dev": "^2.10.0", + "@rollup/plugin-inject": "^5.0.5", "@types/diff": "^5.2.1", "@types/file-saver": "^2.0.7", "@types/js-cookie": "^3.0.6",