Skip to content

Commit

Permalink
feat: apply adjusts in hcms
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurTriis1 committed Nov 14, 2024
1 parent f681703 commit cff672f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/cli/src/utils/hcms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ export async function mergeCMSFile(fileName: string, basePath: string) {

const plugins = await getPluginsList(basePath)

const pluginPaths = plugins.map((plugin) =>
getPackagePath(getPluginName(plugin), 'src', 'cms', fileName)
const pluginCMSFilePaths = plugins.map((plugin) =>
getPackagePath(getPluginName(plugin), 'cms', 'faststore', fileName)
)

const customizations = [...pluginPaths, customFilePath].filter((pluginPath) =>
existsSync(pluginPath)
const customizations = [...pluginCMSFilePaths, customFilePath].filter(
(pluginCMSFilePath) => existsSync(pluginCMSFilePath)
)

// TODO: create a validation when the CMS files exist but don't have a component for them
Expand Down
9 changes: 7 additions & 2 deletions packages/cli/src/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ const getPluginSrcPath = async (basePath: string, pluginName: string) => {
export const getPluginsList = async (basePath: string): Promise<Plugin[]> => {
const { tmpStoreConfigFile } = withBasePath(basePath)

const { plugins = [] } = await import(tmpStoreConfigFile)
try {
const { plugins } = await import(tmpStoreConfigFile)
return plugins
} catch (error) {
logger.error(`Could not load plugins from store config`)
}

return plugins
return []
}

const copyPluginsSrc = async (basePath: string, plugins: Plugin[]) => {
Expand Down

0 comments on commit cff672f

Please sign in to comment.