This is an automated email from the ASF dual-hosted git repository. robin0716 pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 95b9af557f1d40eebf58d5433b44c2e57d39640d Author: robin <[email protected]> AuthorDate: Thu Oct 10 10:37:36 2024 +0800 refactor(pluginKit): update addPluginToIndexTs function to include pluginFolder parameter --- ui/scripts/plugin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/scripts/plugin.js b/ui/scripts/plugin.js index ede9f13f..7ad3d7c5 100644 --- a/ui/scripts/plugin.js +++ b/ui/scripts/plugin.js @@ -59,14 +59,14 @@ function addPluginToPackageJson(packageName) { ); } -function addPluginToIndexTs(packageName) { +function addPluginToIndexTs(packageName, pluginFolder) { const indexTsPath = path.join(pluginPath, 'index.ts'); const indexTsContent = fs.readFileSync(indexTsPath, 'utf-8'); const lines = indexTsContent.split('\n'); const ComponentName = pascalize(packageName); const importLine = `const load${ComponentName} = () => import('${packageName}').then(module => module.default);`; - const info = yaml.load(fs.readFileSync(path.join(pluginPath, packageName, 'info.yaml'), 'utf8')); + const info = yaml.load(fs.readFileSync(path.join(pluginFolder, 'info.yaml'), 'utf8')); const exportLine = `export const ${info.slug_name} = load${ComponentName}`; if (!lines.includes(exportLine)) { @@ -101,6 +101,6 @@ pluginFolders.forEach((folder) => { const packageName = packageJson.name; addPluginToPackageJson(packageName); - addPluginToIndexTs(packageName); + addPluginToIndexTs(packageName, pluginFolder); } });
