Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Replace lodash string utilities with change-case (#1318)

Bogdan Chadkinbba102d85793
diff --git a/apps/builder/app/shared/string-utils.ts b/apps/builder/app/shared/string-utils.ts
new file mode 100644
index 0000000000..92c37d23de
--- /dev/null
+++ b/apps/builder/app/shared/string-utils.ts
@@ -0,0 +1,5 @@
+import { noCase } from "no-case";
+import { titleCase } from "title-case";
+
+export const humanizeString = (string: string): string =>
+ titleCase(noCase(string));
diff --git a/apps/builder/app/shared/string-utils/index.ts b/apps/builder/app/shared/string-utils/index.ts
deleted file mode 100644
index 5423d3ab6c..0000000000
--- a/apps/builder/app/shared/string-utils/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import snakeCase from "lodash.snakecase";
-import capitalize from "lodash.capitalize";
-
-export const humanizeString = (string: string): string => {
- return snakeCase(string).split("_").map(capitalize).join(" ");
-};
diff --git a/apps/builder/package.json b/apps/builder/package.json
index 27989828cd..9bd89d8f2b 100644
--- a/apps/builder/package.json
+++ b/apps/builder/package.json
@@ -55,7 +55,6 @@
"@webstudio-is/project-build": "workspace:^",
"@webstudio-is/react-sdk": "workspace:^",
"@webstudio-is/trpc-interface": "workspace:^",
- "camelcase": "^6.3.0",
"colord": "^2.9.3",
"css-tree": "^2.3.1",
"debug": "^4.3.4",
@@ -68,12 +67,7 @@
"immerhin": "^0.4.0",
"jose": "^4.11.2",
"lexical": "^0.6.0",
- "lodash": "4.17.21",
- "lodash.capitalize": "^4.2.1",
"lodash.debounce": "^4.0.8",
- "lodash.memoize": "^4.1.2",
- "lodash.merge": "^4.6.2",
- "lodash.snakecase": "^4.1.1",
"match-sorter": "^6.3.1",
"mdast-util-from-markdown": "^1.3.0",
"micromark": "^3.1.0",
@@ -81,6 +75,7 @@
"mitt": "^3.0.0",
"nanoid": "^3.2.0",
"nanostores": "^0.7.1",
+ "no-case": "^3.0.4",
"pretty-bytes": "^6.0.0",
"react": "^17.0.2",
"react-color": "^2.19.3",
@@ -94,6 +89,7 @@
"remix-auth-google": "^1.1.0",
"shallow-equal": "^3.1.0",
"slugify": "^1.6.5",
+ "title-case": "^3.0.3",
"use-debounce": "^9.0.2",
"uuid": "^9.0.0",
"warn-once": "^0.1.1",
@@ -110,12 +106,7 @@
"@types/css-tree": "^2.0.0",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/hyphenate-style-name": "^1.0.0",
- "@types/lodash": "4.14.182",
- "@types/lodash.capitalize": "^4.2.6",
"@types/lodash.debounce": "^4.0.6",
- "@types/lodash.memoize": "^4.1.6",
- "@types/lodash.merge": "^4.6.6",
- "@types/lodash.snakecase": "^4.1.6",
"@types/react": "^17.0.24",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^17.0.9",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e5d8a62d70..de080e5b1e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -159,9 +159,6 @@ importers:
'@webstudio-is/trpc-interface':
specifier: workspace:^
version: link:../../packages/trpc-interface
- camelcase:
- specifier: ^6.3.0
- version: 6.3.0
colord:
specifier: ^2.9.3
version: 2.9.3
@@ -198,24 +195,9 @@ importers:
lexical:
specifier: ^0.6.0
version: 0.6.0
- lodash:
- specifier: 4.17.21
- version: 4.17.21
- lodash.capitalize:
- specifier: ^4.2.1
- version: 4.2.1
lodash.debounce:
specifier: ^4.0.8
version: 4.0.8
- lodash.memoize:
- specifier: ^4.1.2
- version: 4.1.2
- lodash.merge:
- specifier: ^4.6.2
- version: 4.6.2
- lodash.snakecase:
- specifier: ^4.1.1
- version: 4.1.1
match-sorter:
specifier: ^6.3.1
version: 6.3.1
@@ -237,6 +219,9 @@ importers:
nanostores:
specifier: ^0.7.1
version: 0.7.1
+ no-case:
+ specifier: ^3.0.4
+ version: 3.0.4
pretty-bytes:
specifier: ^6.0.0
version: 6.0.0
@@ -276,6 +261,9 @@ importers:
slugify:
specifier: ^1.6.5
version: 1.6.5
+ title-case:
+ specifier: ^3.0.3
+ version: 3.0.3
use-debounce:
specifier: ^9.0.2
version: 9.0.2([email protected])
@@ -319,24 +307,9 @@ importers:
'@types/hyphenate-style-name':
specifier: ^1.0.0
version: 1.0.0
- '@types/lodash':
- specifier: 4.14.182
- version: 4.14.182
- '@types/lodash.capitalize':
- specifier: ^4.2.6
- version: 4.2.7
'@types/lodash.debounce':
specifier: ^4.0.6
version: 4.0.7
- '@types/lodash.memoize':
- specifier: ^4.1.6
- version: 4.1.7
- '@types/lodash.merge':
- specifier: ^4.6.6
- version: 4.6.7
- '@types/lodash.snakecase':
- specifier: ^4.1.6
- version: 4.1.7
'@types/react':
specifier: 17.0.47
version: 17.0.47
@@ -8525,36 +8498,18 @@ packages:
'@types/node': 18.13.0
dev: true
- resolution: {integrity: sha512-NKtwU9vJFCx7Q6RYMAKQS0Vo2QUF81tyjvfYnhMxw8+ZMj8R4iv2zmLq5ARy28dGXuK0MqqWg45zGRuTnsnFag==}
- dependencies:
- '@types/lodash': 4.14.182
- dev: true
-
resolution: {integrity: sha512-X1T4wMZ+gT000M2/91SYj0d/7JfeNZ9PeeOldSNoE/lunLeQXKvkmIumI29IaKMotU/ln/McOIvgzZcQ/3TrSA==}
dependencies:
'@types/lodash': 4.14.182
dev: true
- resolution: {integrity: sha512-lGN7WeO4vO6sICVpf041Q7BX/9k1Y24Zo3FY0aUezr1QlKznpjzsDk3T3wvH8ofYzoK0QupN9TWcFAFZlyPwQQ==}
- dependencies:
- '@types/lodash': 4.14.182
- dev: true
-
resolution: {integrity: sha512-OwxUJ9E50gw3LnAefSHJPHaBLGEKmQBQ7CZe/xflHkyy/wH2zVyEIAKReHvVrrn7zKdF58p16We9kMfh7v0RRQ==}
dependencies:
'@types/lodash': 4.14.182
dev: true
- resolution: {integrity: sha512-nv9M+JJokFyfZ9QmaWVXZu2DfT40K0GictZaA8SwXczp3oCzMkjp7PtvUBQyvdoG9SnlCpoRXZDIVwQRzJbd9A==}
- dependencies:
- '@types/lodash': 4.14.182
- dev: true
-
resolution: {integrity: sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==}
@@ -15111,25 +15066,13 @@ packages:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
dev: true
- resolution: {integrity: sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==}
- dev: false
-
resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==}
- resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}
- dev: false
-
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: false
- resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==}
- dev: false
-
resolution: {integrity: sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==}
@@ -15167,7 +15110,6 @@ packages:
resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
dependencies:
tslib: 2.5.0
- dev: true
resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==}
@@ -16158,7 +16100,6 @@ packages:
dependencies:
lower-case: 2.0.2
tslib: 2.5.0
- dev: true
resolution: {integrity: sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w==}
@@ -19293,6 +19234,12 @@ packages:
resolution: {integrity: sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==}
dev: false
+ resolution: {integrity: sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA==}
+ dependencies:
+ tslib: 2.5.0
+ dev: false
+
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'}