diff --git a/packages/create-toolpad-app/tests/index.spec.ts b/packages/create-toolpad-app/tests/index.spec.ts index 75fd539f57d..cbdfe5db0a9 100644 --- a/packages/create-toolpad-app/tests/index.spec.ts +++ b/packages/create-toolpad-app/tests/index.spec.ts @@ -43,7 +43,7 @@ test( cwd: currentDirectory, }); cp.stdout?.pipe(process.stdout); - cp.stderr?.pipe(process.stdout); + cp.stderr?.pipe(process.stderr); const result = await cp; expect(result.stdout).toMatch('Run the following to get started'); const packageJsonContent = await fs.readFile(path.resolve(testDir, './package.json'), { @@ -77,10 +77,10 @@ test( BROWSER: 'none', }, }); - const { stdout: toolpadDevOutput } = toolpadProcess; + toolpadProcess.stdout?.pipe(process.stdout); + toolpadProcess.stderr?.pipe(process.stderr); - expect(toolpadDevOutput).toBeTruthy(); - const match = await waitForMatch(toolpadDevOutput!, /http:\/\/localhost:(\d+)/); + const match = await waitForMatch(toolpadProcess.stdout!, /http:\/\/localhost:(\d+)/); expect(match).toBeTruthy(); diff --git a/packages/toolpad-app/cli/index.ts b/packages/toolpad-app/cli/index.ts index d5ee2836c6b..e6b5b50d91f 100644 --- a/packages/toolpad-app/cli/index.ts +++ b/packages/toolpad-app/cli/index.ts @@ -11,12 +11,11 @@ export interface RunOptions { port?: number; dev?: boolean; base: string; - create: boolean; } async function runCommand( cmd: 'dev' | 'start', - { dir, dev: toolpadDevMode, create: createIfNotExists, ...args }: Omit, + { dir, dev: toolpadDevMode, ...args }: Omit, ) { const projectDir = path.resolve(process.cwd(), dir); @@ -25,7 +24,6 @@ async function runCommand( dir: projectDir, dev: cmd !== 'start', toolpadDevMode, - createIfNotExists, }); process.once('SIGINT', () => { @@ -94,11 +92,6 @@ export default async function cli(argv: string[]) { describe: 'Public base path of the Toolpad application', default: '/prod', }, - create: { - type: 'boolean', - describe: "Create the application directory if it doesn't exist", - default: false, - }, } as const; const sharedRunOptions = { diff --git a/packages/toolpad-app/src/server/index.ts b/packages/toolpad-app/src/server/index.ts index ba663a25bb7..6c61e643913 100644 --- a/packages/toolpad-app/src/server/index.ts +++ b/packages/toolpad-app/src/server/index.ts @@ -12,7 +12,6 @@ import { WebSocket, WebSocketServer } from 'ws'; import { listen } from '@mui/toolpad-utils/http'; // eslint-disable-next-line import/extensions import openBrowser from 'react-dev-utils/openBrowser.js'; -import { folderExists } from '@mui/toolpad-utils/fs'; import chalk from 'chalk'; import { serveRpc } from '@mui/toolpad-utils/workerRpc'; import * as url from 'node:url'; @@ -425,7 +424,6 @@ export interface RunAppOptions { dir?: string; base?: string; toolpadDevMode?: boolean; - createIfNotExists?: boolean; } export async function runApp({ @@ -434,19 +432,9 @@ export async function runApp({ base = '/prod', port = 3000, toolpadDevMode = false, - createIfNotExists, }: RunAppOptions) { const projectDir = resolveProjectDir(dir); - if (!(await folderExists(projectDir)) && !createIfNotExists) { - console.error( - `${chalk.red('error')} - No project found at ${chalk.cyan( - `"${projectDir}"`, - )}. Use the --create option to initialize a new Toolpad project in this folder.`, - ); - process.exit(1); - } - if (!port) { port = dev ? await getPort({ port: getPreferredPorts(DEFAULT_PORT) }) : DEFAULT_PORT; } else { diff --git a/test/integration/editor/deleteLast.spec.ts b/test/integration/editor/deleteLast.spec.ts index 66d33e806e7..7bc00b51cc7 100644 --- a/test/integration/editor/deleteLast.spec.ts +++ b/test/integration/editor/deleteLast.spec.ts @@ -4,7 +4,6 @@ import { ToolpadEditor } from '../../models/ToolpadEditor'; test.use({ localAppConfig: { cmd: 'dev', - create: true, }, }); diff --git a/test/integration/editor/new.spec.ts b/test/integration/editor/new.spec.ts index c571e332c11..d4c48c0b183 100644 --- a/test/integration/editor/new.spec.ts +++ b/test/integration/editor/new.spec.ts @@ -7,7 +7,6 @@ import { ToolpadEditor } from '../../models/ToolpadEditor'; test.use({ localAppConfig: { cmd: 'dev', - create: true, }, }); diff --git a/test/playwright/localTest.ts b/test/playwright/localTest.ts index 32d68be2cab..c20ac49ca4c 100644 --- a/test/playwright/localTest.ts +++ b/test/playwright/localTest.ts @@ -51,7 +51,6 @@ interface LocalAppConfig { // Extra environment variables when running Toolpad env?: Record; base?: string; - create?: boolean; } interface LocalServerConfig { @@ -156,7 +155,7 @@ export async function runCustomServer( } export async function runApp(projectDir: string, options: LocalAppConfig) { - const { cmd = 'start', env, base, create } = options; + const { cmd = 'start', env, base } = options; if (cmd === 'start') { await buildApp(projectDir, { base, env }); @@ -167,10 +166,6 @@ export async function runApp(projectDir: string, options: LocalAppConfig) { args.push('--dev'); } - if (create) { - args.push('--create'); - } - // Run each test on its own port to avoid race conditions when running tests in parallel. args.push('--port', String(await getPort()));