This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch refactor/plugin
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/refactor/plugin by this push:
new ff88d507 refactor(pluginKit): update addPluginToIndexTs function to
include pluginFolder parameter
ff88d507 is described below
commit ff88d507a753465ceb32085725324d806d63c58a
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);
}
});