Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/studio/src/components/Modals/Settings/Project/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ const ProjectTab = observer(() => {
const handleUpdateUrl = (url: string) => {
projectsManager.updatePartialProject({
url,
commands: {
...project?.commands,
run: 'npx next dev -p ' + url.split(':').pop(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using url.split(':').pop() to extract port is fragile. Consider using URL parsing (e.g., new URL(url).port) for robust port extraction.

build: 'npx next build -p ' + url.split(':').pop(),
},
});
projectsManager.editorEngine?.canvas.saveFrames(
projectsManager.editorEngine?.canvas.frames.map((frame) => ({
Expand Down Expand Up @@ -70,6 +75,7 @@ const ProjectTab = observer(() => {
id="url"
value={url}
onChange={(e) => handleUpdateUrl(e.target.value)}
onBlur={() => projectsManager.runner?.restart()}
className="w-2/3"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/src/lib/projects/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ export class CreateManager {
const projectUrl = 'http://localhost:3000';
const projectCommands = {
install: 'npm install',
run: 'npm run dev',
build: 'npm run build',
run: 'npx next dev -p 3000',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default commands now use explicit npx commands with -p 3000; consider extracting the port to a variable for maintainability.

build: 'npx next build -p 3000',
};

return this.projectsManager.createProject(
Expand Down