Skip to content

Commit

Permalink
Write run command on create (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kitenite authored Dec 2, 2024
1 parent 7cdcb9a commit 89f089b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/studio/src/lib/projects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ export class ProjectsManager {
}
}

createProject(name: string, url: string, folderPath: string): Project {
createProject(name: string, url: string, folderPath: string, runCommand: string): Project {
const newProject: Project = {
id: nanoid(),
name,
url,
folderPath,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
runCommand,
};

const updatedProjects = [...this.projectList, newProject];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,17 @@ const LoadSetUrl: StepComponent = ({ props, variant }) => {
Back
</Button>
<Button
disabled={!projectData.url || projectData.url.length === 0}
disabled={
!projectData.url ||
projectData.url.length === 0 ||
!projectData.runCommand ||
projectData.runCommand.length === 0
}
type="button"
onClick={nextStep}
variant="outline"
>
Complete setup
{'Complete setup'}
</Button>
</>
);
Expand Down
8 changes: 7 additions & 1 deletion apps/studio/src/routes/projects/ProjectsTab/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ const CreateProject = ({
};

const finalizeProject = () => {
if (!projectData.name || !projectData.url || !projectData.folderPath) {
if (
!projectData.name ||
!projectData.url ||
!projectData.folderPath ||
!projectData.runCommand
) {
throw new Error('Project data is missing.');
}

const newProject = projectsManager.createProject(
projectData.name,
projectData.url,
projectData.folderPath,
projectData.runCommand,
);

projectsManager.project = newProject;
Expand Down

0 comments on commit 89f089b

Please sign in to comment.