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 1066a445 chore(plugins): Add plugin to index.ts
1066a445 is described below
commit 1066a445b442418aec16a4d2ea5ac2df8685aacf
Author: robin <[email protected]>
AuthorDate: Thu May 30 17:52:26 2024 +0800
chore(plugins): Add plugin to index.ts
---
ui/scripts/plugin.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/ui/scripts/plugin.js b/ui/scripts/plugin.js
index 0dad3090..9aab061d 100644
--- a/ui/scripts/plugin.js
+++ b/ui/scripts/plugin.js
@@ -19,6 +19,7 @@
const path = require('path');
const fs = require('fs');
+const humps = require('humps');
const pluginPath = path.join(__dirname, '../src/plugins');
const pluginFolders = fs.readdirSync(pluginPath);
@@ -42,5 +43,17 @@ pluginFolders.forEach((folder) => {
packageJsonPath,
JSON.stringify(packageJsonContent, null, 2),
);
+
+
+ // add plugin to index.ts last line
+ const indexTsPath = path.join(pluginPath, 'index.ts');
+ const indexTsContent = fs.readFileSync(indexTsPath, 'utf-8');
+ const lines = indexTsContent.split('\n');
+ const ComponentName = humps.pascalize(packageName);
+ const importLine = `export { default as ${ComponentName} } from
'${packageName}';`;
+ if (!lines.includes(importLine)) {
+ lines.push(importLine);
+ }
+ fs.writeFileSync(indexTsPath, lines.join('\n'));
}
});