diff --git a/.changeset/lovely-cows-act.md b/.changeset/lovely-cows-act.md new file mode 100644 index 00000000..16ef6868 --- /dev/null +++ b/.changeset/lovely-cows-act.md @@ -0,0 +1,6 @@ +--- +"commonality": patch +"@commonalityco/studio": patch +--- + +Updates logging information for Studio failures diff --git a/apps/commonality/src/cli/commands/studio.ts b/apps/commonality/src/cli/commands/studio.ts index 5d925cab..84d18c08 100644 --- a/apps/commonality/src/cli/commands/studio.ts +++ b/apps/commonality/src/cli/commands/studio.ts @@ -20,18 +20,22 @@ const spinner = ora('Starting Commonality Studio...'); export const studio = command .name('studio') .description('Open Commonality Studio') - .option('--debug', 'Show additional logging output') + .option('--verbose', 'Show additional logging output') .option( '--port ', 'The port that Commonality Studio will run on', '8888', ) .action( - async (options: { debug?: boolean; port?: string; install?: boolean }) => { + async (options: { + verbose?: boolean; + port?: string; + install?: boolean; + }) => { spinner.start(); const preferredPort = Number(options.port); - const debug = Boolean(options.debug); + const verbose = Boolean(options.verbose); try { await validateProjectStructure({ @@ -61,7 +65,7 @@ export const studio = command const { kill } = studio.startStudio({ port, rootDirectory, - debug, + debug: verbose, }); const handleExit = () => { @@ -85,9 +89,9 @@ export const studio = command suffixText: chalk.dim('\n (press ctrl-c to quit)'), }); } catch (error) { - console.log(chalk.red('Failed to start Commonality Studio')); + spinner.fail('Failed to start Commonality Studio'); - if (debug) { + if (verbose) { console.log(error); } } diff --git a/apps/commonality/test/integration/studio.test.ts b/apps/commonality/test/integration/studio.test.ts index e255b0d0..ee64e85e 100644 --- a/apps/commonality/test/integration/studio.test.ts +++ b/apps/commonality/test/integration/studio.test.ts @@ -28,7 +28,7 @@ describe.concurrent('studio', () => { const cliProcess = execa( binPath, - ['studio', '--debug', '--port', String(preferredPort)], + ['studio', '--verbose', '--port', String(preferredPort)], { cwd: temporaryPath, stdout: 'pipe', @@ -92,7 +92,7 @@ describe.concurrent('studio', () => { const cliProcess = execa( binPath, - ['studio', '--debug', '--port', String(preferredPort)], + ['studio', '--verbose', '--port', String(preferredPort)], { cwd: temporaryPath, stdout: 'pipe', @@ -155,7 +155,7 @@ describe.concurrent('studio', () => { const cliProcess = execa( binPath, - ['studio', '--debug', '--port', String(preferredPort)], + ['studio', '--verbose', '--port', String(preferredPort)], { cwd: temporaryPath, stdout: 'pipe', diff --git a/apps/documentation/pages/docs/cli.mdx b/apps/documentation/pages/docs/cli.mdx index 3ce77ed0..c8838485 100644 --- a/apps/documentation/pages/docs/cli.mdx +++ b/apps/documentation/pages/docs/cli.mdx @@ -130,10 +130,10 @@ The port that Commonality Studio should run on. By default, Commonality Studio w commonality studio --port 1234 ``` -##### `--debug` +##### `--verbose` Show the server logs from the Commonality Studio application. ```bash copy -commonality studio --debug +commonality studio --verbose ``` diff --git a/apps/studio/start.mjs b/apps/studio/start.mjs index 58118d92..cc61e360 100644 --- a/apps/studio/start.mjs +++ b/apps/studio/start.mjs @@ -13,8 +13,8 @@ const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); */ export const startStudio = ({ port, rootDirectory, debug }) => { const serverProcess = execa('node', ['server.js'], { - stdout: debug ? 'pipe' : 'ignore', - stderr: debug ? 'pipe' : 'ignore', + stdout: debug ? 'inherit' : 'ignore', + stderr: debug ? 'inherit' : 'ignore', cwd: __dirname, env: { PATH: process.env.PATH,