|
|
|
@ -39,7 +39,6 @@ import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files |
|
|
|
|
import { getUncommittedFiles } from '../utils/gitStatusFilter' |
|
|
|
|
import { AppModal, ModalTypes } from '@remix-ui/app' |
|
|
|
|
import { contractDeployerScripts, etherscanScripts } from '@remix-project/remix-ws-templates' |
|
|
|
|
import { template } from 'lodash' |
|
|
|
|
|
|
|
|
|
declare global { |
|
|
|
|
interface Window { |
|
|
|
@ -193,14 +192,12 @@ export const createWorkspace = async ( |
|
|
|
|
|
|
|
|
|
export const createWorkspaceTemplate = async (workspaceName: string, template: WorkspaceTemplate = 'remixDefault') => { |
|
|
|
|
const metadata = TEMPLATE_METADATA[template] |
|
|
|
|
if (metadata) { |
|
|
|
|
await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, TEMPLATE_NAMES[template]) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (!workspaceName) throw new Error('workspace name cannot be empty') |
|
|
|
|
if (checkSpecialChars(workspaceName) || checkSlash(workspaceName)) throw new Error('special characters are not allowed') |
|
|
|
|
if ((await workspaceExists(workspaceName)) && template === 'remixDefault') throw new Error('workspace already exists') |
|
|
|
|
else { |
|
|
|
|
else if (metadata) { |
|
|
|
|
await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, workspaceName) |
|
|
|
|
} else { |
|
|
|
|
const workspaceProvider = plugin.fileProviders.workspace |
|
|
|
|
await workspaceProvider.createWorkspace(workspaceName) |
|
|
|
|
} |
|
|
|
|