Skip to content

Commit

Permalink
feat: Add copy plugin public files
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurTriis1 committed Dec 20, 2024
1 parent 44d41b2 commit 8096ab5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/cli/src/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,29 @@ const copyPluginsSrc = async (basePath: string, plugins: Plugin[]) => {
})
}

const copyPluginPublicFiles = async (basePath: string, plugins: Plugin[]) => {
const { tmpDir, getPackagePath } = withBasePath(basePath)

logger.log('Copying plugin public files')

plugins.forEach(async (plugin) => {
const pluginName = getPluginName(plugin)
const pluginPath = getPackagePath(getPluginName(pluginName))

try {
if (existsSync(`${pluginPath}/public`)) {
copySync(`${pluginPath}/public`, `${tmpDir}/public`, {
dereference: true,
overwrite: true,
})
logger.log(`Plugin public files copied`)
}
} catch (e) {
logger.error(e)
}
})
}

const getPluginPageFileContent = (
pluginName: string,
pageName: string,
Expand Down Expand Up @@ -285,6 +308,7 @@ export const installPlugins = async (basePath: string) => {
const plugins = await getPluginsList(basePath)

copyPluginsSrc(basePath, plugins)
copyPluginPublicFiles(basePath, plugins)
generatePluginPages(basePath, plugins)
addPluginsSections(basePath, plugins)
addPluginsOverrides(basePath, plugins)
Expand Down

0 comments on commit 8096ab5

Please sign in to comment.