Skip to content

Commit

Permalink
Do not validate FEC config for build with custom webpack config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Jan 3, 2024
1 parent 6663eb6 commit a619948
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/config/src/bin/build-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ const { resolve } = require('path');
import { spawn } from 'child_process';

export function buildScript(argv: { [name: string]: string }, cwd: string) {
validateFECConfig(cwd);
let configPath;
if (typeof argv.webpackConfig !== 'undefined') {
configPath = getWebpackConfigPath(argv.webpackConfig, cwd);
} else {
// validate the FEC config only if a custom webpack config is not provided
validateFECConfig(cwd);
configPath = resolve(__dirname, './prod.webpack.config.js');
}
process.env.NODE_ENV = 'production';
Expand Down
7 changes: 4 additions & 3 deletions packages/config/src/bin/dev-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ async function devScript(
cwd: string
) {
try {
validateFECConfig(cwd);

const fecConfig = require(process.env.FEC_CONFIG_PATH!);
let fecConfig: any = {};
let configPath;
if (typeof argv.webpackConfig !== 'undefined') {
configPath = getWebpackConfigPath(argv.webpackConfig, cwd);
} else {
// validate the FEC config only if a custom webpack config is not provided
validateFECConfig(cwd);
fecConfig = require(process.env.FEC_CONFIG_PATH!);
configPath = resolve(__dirname, './dev.webpack.config.js');
}

Expand Down
4 changes: 0 additions & 4 deletions packages/config/src/bin/fec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import './tsconfig.template.json';

const devScript = require('./dev-script');
const buildScript = require('./build-script');
const { validateFECConfig } = require('./common');
const { fecLogger, LogType } = require('@redhat-cloud-services/frontend-components-config-utilities');

function patchHosts() {
Expand Down Expand Up @@ -121,13 +120,10 @@ const argv = yargs

const scripts: { [name: string]: (...args: any[]) => void } = {
static: (argv: any, cwd: string) => {
// set fec config
validateFECConfig(cwd);
serveStatic(argv, cwd);
},
'patch-etc-hosts': patchHosts,
dev: (argv: any, cwd: string) => {
validateFECConfig(cwd);
devScript(argv, cwd);
},
build: buildScript,
Expand Down

0 comments on commit a619948

Please sign in to comment.