From 5cf0e43b5cb903b1d0d93f9e37670c6de0894480 Mon Sep 17 00:00:00 2001 From: Lu Date: Tue, 22 Aug 2023 15:17:23 -0700 Subject: [PATCH 1/2] "fix the pacakage.json scripts" --- package-lock.json | 10 +++++++++- package.json | 12 ++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a049a9..0ef8cc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,13 @@ { "name": "communication-services-web-chat-hero", "version": "1.0.0", - "lockfileVersion": 1 + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "communication-services-web-chat-hero", + "version": "1.0.0", + "license": "MIT" + } + } } diff --git a/package.json b/package.json index 5855941..248e511 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,14 @@ "description": "--- page_type: sample languages: - javascript - nodejs - products: - azure - azure-communication-services ---", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "setup": "cd Server && npm install && cd ../Chat && npm install && cd ..", - "start": "cd Chat && npm run start && cd ..", - "build": "cd Server && npm run build && cd ../Chat && npm run build && cd ..", - "package": "cd Chat && npm run package && cd .." + "setup:chat": "cd Chat && npm install", + "setup:server": "cd Server && npm install", + "setup": "npm run setup:chat && npm run setup:server", + "start": "cd Chat && npm start", + "build:chat": "cd Chat && npm run build", + "build:server": "cd Server && npm run build", + "build": "npm run build:chat && npm run build:server", + "package": "cd Chat && npm run package" }, "repository": { "type": "git", From 2ef6afa94a203bdb682ee787bed4f967026fd6ff Mon Sep 17 00:00:00 2001 From: Lu Date: Tue, 22 Aug 2023 15:32:43 -0700 Subject: [PATCH 2/2] update the npm run start --- package.json | 2 +- startChat.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 startChat.js diff --git a/package.json b/package.json index 248e511..f86174e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "setup:chat": "cd Chat && npm install", "setup:server": "cd Server && npm install", "setup": "npm run setup:chat && npm run setup:server", - "start": "cd Chat && npm start", + "start": "node startChat.js", "build:chat": "cd Chat && npm run build", "build:server": "cd Server && npm run build", "build": "npm run build:chat && npm run build:server", diff --git a/startChat.js b/startChat.js new file mode 100644 index 0000000..270ee01 --- /dev/null +++ b/startChat.js @@ -0,0 +1,12 @@ +const { spawn } = require('child_process'); + +// This script will spawn a new process to run the npm start command inside the Chat directory. +const child = spawn('npm', ['run', 'start'], { + stdio: 'inherit', + cwd: './Chat', + shell: true +}); + +child.on('exit', (code) => { + process.exit(code); +});