This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch feat/1.3.5/embed
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.3.5/embed by this push:
new eebd7c39 chore: When there is no plugin, there is no need to reset the
index.ts file
eebd7c39 is described below
commit eebd7c39ef3f24cc01bb874435c196b7c43af463
Author: robin <[email protected]>
AuthorDate: Fri Jun 7 16:56:35 2024 +0800
chore: When there is no plugin, there is no need to reset the index.ts file
---
ui/scripts/plugin.js | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ui/scripts/plugin.js b/ui/scripts/plugin.js
index d26dbcdc..cdd84d17 100644
--- a/ui/scripts/plugin.js
+++ b/ui/scripts/plugin.js
@@ -71,13 +71,22 @@ function addPluginToIndexTs(packageName) {
fs.writeFileSync(indexTsPath, lines.join('\n'));
}
+const pluginLength = pluginFolders.filter((folder) => {
+ const pluginFolder = path.join(pluginPath, folder);
+ const stat = fs.statSync(pluginFolder);
+ return stat.isDirectory() && folder !== 'builtin';
+}).length
+
+if (pluginLength > 0) {
+ resetIndexTs();
+}
resetPackageJson();
-resetIndexTs();
+
pluginFolders.forEach((folder) => {
const pluginFolder = path.join(pluginPath, folder);
const stat = fs.statSync(pluginFolder);
-
+
if (stat.isDirectory() && folder !== 'builtin') {
if (!fs.existsSync(path.join(pluginFolder, 'index.ts'))) {
return;
@@ -85,7 +94,7 @@ pluginFolders.forEach((folder) => {
const packageJson = require(path.join(pluginFolder, 'package.json'));
const packageName = packageJson.name;
-
+
addPluginToPackageJson(packageName);
addPluginToIndexTs(packageName);
}