Skip to content

Commit

Permalink
Merge pull request #929 from HubSpot/br-safer-project-structure-lookup
Browse files Browse the repository at this point in the history
Validate paths before generating card config paths
  • Loading branch information
brandenrodgers authored Aug 31, 2023
2 parents 50781b4 + b398765 commit de416e3
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions packages/cli/lib/projectStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ function getAppCardConfigs(appConfig, appPath) {

if (cards) {
cards.forEach(({ file }) => {
const cardConfigPath = path.join(appPath, file);
const cardConfig = loadConfigFile(cardConfigPath);
if (typeof file === 'string') {
const cardConfigPath = path.join(appPath, file);
const cardConfig = loadConfigFile(cardConfigPath);

if (cardConfig) {
cardConfigs.push(cardConfig);
if (cardConfig) {
cardConfigs.push(cardConfig);
}
}
});
}
Expand Down Expand Up @@ -84,14 +86,16 @@ async function findProjectComponents(projectSourceDir) {
0,
projectFile.indexOf(APP_COMPONENT_CONFIG)
);
const isLegacy = getIsLegacyApp(parsedAppConfig, appPath);

components.push({
type: COMPONENT_TYPES.app,
config: parsedAppConfig,
runnable: !isLegacy,
path: appPath,
});
if (typeof appPath === 'string') {
const isLegacy = getIsLegacyApp(parsedAppConfig, appPath);

components.push({
type: COMPONENT_TYPES.app,
config: parsedAppConfig,
runnable: !isLegacy,
path: appPath,
});
}
}
}
});
Expand Down

0 comments on commit de416e3

Please sign in to comment.