Skip to content

Commit

Permalink
Create missing dist directory when serving chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Aug 20, 2024
1 parent 5afb26b commit 8d044f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/config/src/bin/serve-chrome.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import fs from 'fs';
import { execSync, spawn } from 'child_process';
import { LogType, fecLogger } from '@redhat-cloud-services/frontend-components-config-utilities';
import waitOn from 'wait-on';
Expand Down Expand Up @@ -177,7 +178,13 @@ async function startServer(tag: string, serverPort: number) {
}

function copyIndex(path: string) {
const copyCommand = `${execBin} cp ${CONTAINER_NAME}:/opt/app-root/src/build/stable/index.html ${path}`;
try {
fs.statSync(path);
} catch (error) {
// create dist directory if it doesn't exist
fs.mkdirSync(path, { recursive: true });
}
const copyCommand = `${execBin} cp -p ${CONTAINER_NAME}:/opt/app-root/src/build/stable/index.html ${path}`;
execSync(copyCommand, {
stdio: 'inherit',
});
Expand Down

0 comments on commit 8d044f2

Please sign in to comment.