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/07/15 03:32:33 UTC
(incubator-answer) 01/01: chore(scripts): Remove humps dependency
This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch chore/remove-humps
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 3a33513f76b65ec2256cd9ee77f8ec2bbd8adfd2
Author: robin <ro...@rnode.me>
AuthorDate: Mon Jul 15 11:31:57 2024 +0800
chore(scripts): Remove humps dependency
---
ui/package.json | 1 -
ui/pnpm-lock.yaml | 7 -------
ui/scripts/plugin.js | 7 +++++--
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/ui/package.json b/ui/package.json
index b2c4aa8f..19e66981 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -79,7 +79,6 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
- "humps": "^2.0.1",
"husky": "^8.0.1",
"js-yaml": "^4.1.0",
"lint-staged": "^13.2.3",
diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml
index 0298231b..b855bfa0 100644
--- a/ui/pnpm-lock.yaml
+++ b/ui/pnpm-lock.yaml
@@ -192,9 +192,6 @@ importers:
eslint-plugin-react-hooks:
specifier: ^4.6.0
version: 4.6.0(eslint@8.53.0)
- humps:
- specifier: ^2.0.1
- version: 2.0.1
husky:
specifier: ^8.0.1
version: 8.0.1
@@ -7052,10 +7049,6 @@ packages:
engines: {node: '>=14.18.0'}
dev: true
- /humps@2.0.1:
- resolution: {integrity: sha512-E0eIbrFWUhwfXJmsbdjRQFQPrl5pTEoKlz163j1mTqqUnU9PgR4AgB8AIITzuB3vLBdxZXyZ9TDIrwB2OASz4g==}
- dev: true
-
/husky@8.0.1:
resolution: {integrity: sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==}
engines: {node: '>=14'}
diff --git a/ui/scripts/plugin.js b/ui/scripts/plugin.js
index a0d31e0c..d554df8f 100644
--- a/ui/scripts/plugin.js
+++ b/ui/scripts/plugin.js
@@ -19,11 +19,14 @@
const path = require('path');
const fs = require('fs');
-const humps = require('humps');
const pluginPath = path.join(__dirname, '../src/plugins');
const pluginFolders = fs.readdirSync(pluginPath);
+function pascalize(str) {
+ return str.split(/[_-]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('');
+}
+
function resetPackageJson() {
const packageJsonPath = path.join(__dirname, '..', 'package.json');
const packageJsonContent = require(packageJsonPath);
@@ -59,7 +62,7 @@ function addPluginToIndexTs(packageName) {
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 ComponentName = pascalize(packageName);
const importLine = `export { default as ${ComponentName} } from '${packageName}';`;
if (!lines.includes(importLine)) {
lines.push(importLine);