Skip to content

Commit ca92ba5

Browse files
committed
refactor: remove deployment script and enhance test command for CI
1 parent 79fdb8d commit ca92ba5

3 files changed

Lines changed: 20 additions & 54 deletions

File tree

scripts/deploy.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

scripts/utils.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,21 @@ export function log(message, color = colors.reset) {
3232
* @param {string} command - The command to run
3333
* @param {string[]} args - Command arguments
3434
* @param {string} cwd - Working directory
35+
* @param {Object} options - Additional options
36+
* @param {boolean} options.nonInteractive - Whether to run in non-interactive mode
3537
* @returns {Promise<void>}
3638
*/
37-
export function runCommand(command, args, cwd = process.cwd()) {
39+
export function runCommand(command, args, cwd = process.cwd(), options = {}) {
3840
return new Promise((resolve, reject) => {
3941
log(`${colors.cyan}Running: ${command} ${args.join(' ')}${colors.reset}`, colors.cyan);
4042
log(`${colors.yellow}Working directory: ${cwd}${colors.reset}`, colors.yellow);
41-
43+
44+
// Configure stdio based on interactive mode
45+
const stdio = options.nonInteractive ? ['ignore', 'inherit', 'inherit'] : 'inherit';
46+
4247
const child = spawn(command, args, {
4348
cwd,
44-
stdio: 'inherit',
49+
stdio,
4550
shell: process.platform === 'win32'
4651
});
4752

@@ -217,7 +222,11 @@ export async function runProjectOperations(projects, operation, stopOnFailure =
217222
for (const project of projects) {
218223
try {
219224
log(`${colors.bright}${project.icon || '⚙️'} ${operation} ${project.name}...${colors.reset}`, colors.blue);
220-
await runCommand(project.command, project.args, project.path);
225+
226+
// Use non-interactive mode for test operations
227+
const options = operation.toLowerCase() === 'test' ? { nonInteractive: true } : {};
228+
229+
await runCommand(project.command, project.args, project.path, options);
221230
results.push({ name: project.name, status: 'success' });
222231
log(`${colors.green}${project.name} ${operation.toLowerCase()} completed${colors.reset}`, colors.green);
223232
} catch (error) {
@@ -249,22 +258,26 @@ export async function getAvailableProjects(operation = 'build') {
249258

250259
// Client project
251260
if (directoryExists(paths.client)) {
261+
// Use non-interactive test script for client (vitest run instead of vitest)
262+
const clientOperation = operation === 'test' ? 'test:ci' : operation;
252263
projects.push({
253264
name: 'Client',
254265
path: paths.client,
255266
command: pmConfig.command,
256-
args: ['run', operation],
267+
args: ['run', clientOperation],
257268
icon: '🎨'
258269
});
259270
}
260271

261272
// Server project
262273
if (directoryExists(paths.server)) {
274+
// Use non-interactive test script for server (jest --passWithNoTests --ci)
275+
const serverOperation = operation === 'test' ? 'test:ci' : operation;
263276
projects.push({
264277
name: 'Server',
265278
path: paths.server,
266279
command: pmConfig.command,
267-
args: ['run', operation],
280+
args: ['run', serverOperation],
268281
icon: '⚙️'
269282
});
270283
}

server-ts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dev": "nodemon --exec ts-node src/main.ts",
99
"start": "node dist/src/main.js",
1010
"test": "jest",
11+
"test:ci": "jest --passWithNoTests --ci",
1112
"test:watch": "jest --watch",
1213
"test:coverage": "jest --coverage",
1314
"test:unit": "jest tests/unit",

0 commit comments

Comments
 (0)