You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ro...@apache.org on 2024/06/07 09:21:35 UTC
(incubator-answer) branch test updated: chore: When there is no plugin, there is no need to reset the index.ts file
This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/test by this push:
new 5ab7d9b3 chore: When there is no plugin, there is no need to reset the index.ts file
5ab7d9b3 is described below
commit 5ab7d9b3a035d80589f1066f0c1b303d67c35f88
Author: robin <ro...@rnode.me>
AuthorDate: Fri Jun 7 17:12:42 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);
}