From fae5be82359f787d0da6f728308a1ae2983d0539 Mon Sep 17 00:00:00 2001 From: Karan Handa Date: Thu, 7 Mar 2024 17:20:13 +0530 Subject: [PATCH] fix: fix dev stopping flow --- package.json | 7 +++++-- src/index.ts | 15 +++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 81d53b9..d08c3cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "million-lint-check", - "version": "1.0.3", + "version": "1.0.4", "description": "A command-line tool to verify if Million Lint is active in a project.", "main": "index.js", "files": [ @@ -15,7 +15,10 @@ "test": "echo \"Error: no test specified\" && exit 0" }, "keywords": [ - "" + "million", + "cli", + "testing", + "frontend" ], "author": "Karan Handa", "license": "ISC", diff --git a/src/index.ts b/src/index.ts index 12cd390..335c62e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ const pjson = require('./package.json'); import { Command } from 'commander'; -import { execSync } from 'child_process'; +import { execSync, spawn } from 'child_process'; import puppeteer from 'puppeteer'; import { fuzzPage } from './fuzzer'; @@ -42,12 +42,19 @@ program.command('setup') execSync('ni', { stdio: 'inherit' }); try { execSync('npx @million/lint@latest', { stdio: 'inherit' }); - } catch { - + } catch(error) { + console.error('Error running Million Lint:', error); } console.log('Running development server...'); - execSync('nr dev', { stdio: 'inherit' }); + // Start the development server in the background + const devServer = spawn('nr', ['dev'], { + stdio: 'inherit', + shell: true, + detached: true, + }); + console.log('Development server started in the background.'); + devServer.unref(); console.log('Opening browser and interacting with components...'); await checkWhetherMillionWorks(options.port)