Skip to content

Commit

Permalink
chore: use lodash-es instead of lodash (#5125)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.12.x

#### What this PR does / why we need it:

优化 Lodash 依赖,使用 lodash-es 代替 lodash 库。

#### Which issue(s) this PR fixes:

Fixes #5124 

#### Special notes for your reviewer:

CI 通过即可。

#### Does this PR introduce a user-facing change?

```release-note
None 
```
  • Loading branch information
ruibaby authored Dec 28, 2023
1 parent 285ac6a commit 36ebc24
Show file tree
Hide file tree
Showing 38 changed files with 57 additions and 110 deletions.
2 changes: 1 addition & 1 deletion console/console-src/composables/use-content-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface ContentCache {
content?: string;
version: number;
}
import debounce from "lodash.debounce";
import { debounce } from "lodash-es";
import { useI18n } from "vue-i18n";

interface useContentCacheReturn {
Expand Down
3 changes: 1 addition & 2 deletions console/console-src/composables/use-setting-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { ref } from "vue";
import { apiClient } from "@/utils/api-client";

// libs
import cloneDeep from "lodash.clonedeep";
import merge from "lodash.merge";
import { cloneDeep, merge } from "lodash-es";
import type { ConfigMap, Setting, SettingForm } from "@halo-dev/api-client";
import type { FormKitSchemaCondition, FormKitSchemaNode } from "@formkit/core";
import { Toast } from "@halo-dev/components";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type { Attachment, Group } from "@halo-dev/api-client";
import { useFetchAttachmentPolicy } from "./composables/use-attachment-policy";
import { useAttachmentControl } from "./composables/use-attachment";
import { apiClient } from "@/utils/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { isImage } from "@/utils/image";
import { useRouteQuery } from "@vueuse/router";
import { useFetchAttachmentGroup } from "./composables/use-attachment-group";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
import SubmitButton from "@/components/button/SubmitButton.vue";
import type { Group } from "@halo-dev/api-client";
import { computed, ref, watch } from "vue";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import { reset } from "@formkit/core";
import { setFocus } from "@/formkit/utils/focus";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
import SubmitButton from "@/components/button/SubmitButton.vue";
import type { Policy, PolicyTemplate } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { computed, ref, toRaw, watch, watchEffect } from "vue";
import { useSettingForm } from "@console/composables/use-setting-form";
import { apiClient } from "@/utils/api-client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { formatDatetime } from "@/utils/date";
import { computed, provide, ref, onMounted, type Ref } from "vue";
import ReplyListItem from "./ReplyListItem.vue";
import { apiClient } from "@/utils/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { usePermission } from "@/utils/permission";
import { useQuery, useQueryClient } from "@tanstack/vue-query";
import { useI18n } from "vue-i18n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Picker } from "emoji-mart";
import i18n from "@emoji-mart/data/i18n/zh.json";
import { computed, nextTick, ref, watch, watchEffect } from "vue";
import { reset } from "@formkit/core";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { setFocus } from "@/formkit/utils/focus";
import { apiClient } from "@/utils/api-client";
import { useI18n } from "vue-i18n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ListedReply } from "@halo-dev/api-client";
import { formatDatetime } from "@/utils/date";
import { apiClient } from "@/utils/api-client";
import { computed, inject, type Ref } from "vue";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { useI18n } from "vue-i18n";
import { useQueryClient } from "@tanstack/vue-query";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ref, watch } from "vue";
import type { ListedSinglePage, SinglePage } from "@halo-dev/api-client";
import { apiClient } from "@/utils/api-client";
import { formatDatetime } from "@/utils/date";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { usePermission } from "@/utils/permission";
import { useQuery } from "@tanstack/vue-query";
import { useI18n } from "vue-i18n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from "vue";
import { apiClient } from "@/utils/api-client";
import { useRouteQuery } from "@vueuse/router";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { useRouter } from "vue-router";
import { randomUUID } from "@/utils/id";
import { useContentCache } from "@console/composables/use-content-cache";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { ListedSinglePage, SinglePage } from "@halo-dev/api-client";
import { apiClient } from "@/utils/api-client";
import { formatDatetime } from "@/utils/date";
import { RouterLink } from "vue-router";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { usePermission } from "@/utils/permission";
import { singlePageLabels } from "@/constants/labels";
import { useMutation, useQueryClient } from "@tanstack/vue-query";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@halo-dev/components";
import { computed, nextTick, ref, watchEffect } from "vue";
import type { SinglePage } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme";
import { singlePageLabels } from "@/constants/labels";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { ListedPost, Post } from "@halo-dev/api-client";
import { apiClient } from "@/utils/api-client";
import { formatDatetime } from "@/utils/date";
import { usePermission } from "@/utils/permission";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { useQuery } from "@tanstack/vue-query";
import { useI18n } from "vue-i18n";
import ContributorList from "../_components/ContributorList.vue";
Expand Down
2 changes: 1 addition & 1 deletion console/console-src/modules/contents/posts/PostEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
toRef,
type ComputedRef,
} from "vue";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import { useRouteQuery } from "@vueuse/router";
import { useRouter } from "vue-router";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SubmitButton from "@/components/button/SubmitButton.vue";
import type { Category } from "@halo-dev/api-client";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
import { setFocus } from "@/formkit/utils/focus";
import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Category, CategorySpec } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";

export interface CategoryTreeSpec extends Omit<CategorySpec, "children"> {
children: CategoryTree[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@halo-dev/components";
import { computed, nextTick, ref, watchEffect } from "vue";
import type { Post } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme";
import { postLabels } from "@/constants/labels";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SubmitButton from "@/components/button/SubmitButton.vue";
import type { Tag } from "@halo-dev/api-client";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
import { setFocus } from "@/formkit/utils/focus";
import AnnotationsForm from "@/components/form/AnnotationsForm.vue";
Expand Down
2 changes: 1 addition & 1 deletion console/console-src/modules/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ import {
} from "@halo-dev/components";
import { onMounted, provide, ref, type Ref } from "vue";
import { useStorage } from "@vueuse/core";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import type { DashboardStats } from "@halo-dev/api-client";
import { useI18n } from "vue-i18n";
Expand Down
2 changes: 1 addition & 1 deletion console/console-src/modules/interface/menus/Menus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import MenuList from "./components/MenuList.vue";
import { computed, ref } from "vue";
import { apiClient } from "@/utils/api-client";
import type { Menu, MenuItem } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import type { MenuTreeItem } from "./utils";
import {
buildMenuItemsTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Menu } from "@halo-dev/api-client";
import { computed, ref, watch } from "vue";
import { apiClient } from "@/utils/api-client";
import { reset } from "@formkit/core";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { setFocus } from "@/formkit/utils/focus";
import { useI18n } from "vue-i18n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { computed, nextTick, ref, watch } from "vue";
import type { Menu, MenuItem, Ref } from "@halo-dev/api-client";
import { apiClient } from "@/utils/api-client";
import { reset } from "@formkit/core";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { setFocus } from "@/formkit/utils/focus";
import AnnotationsForm from "@/components/form/AnnotationsForm.vue";
import { useI18n } from "vue-i18n";
Expand Down
2 changes: 1 addition & 1 deletion console/console-src/modules/interface/menus/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MenuItem, MenuItemSpec } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";

export interface MenuTreeItemSpec extends Omit<MenuItemSpec, "children"> {
children: MenuTreeItem[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { provide, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
// hooks
import { useThemeLifeCycle } from "../composables/use-theme";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRoute } from "vue-router";
import { apiClient } from "@/utils/api-client";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
// components
import { VCard, VPageHeader, VTabbar, VAvatar } from "@halo-dev/components";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComputedRef, Ref } from "vue";
import { computed } from "vue";
import { type Plugin } from "@halo-dev/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import { Dialog, Toast } from "@halo-dev/components";
import { useI18n } from "vue-i18n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { computed, watch } from "vue";
import { rbacAnnotations } from "@/constants/annotations";
import type { Role } from "@halo-dev/api-client";
import { useRoleForm, useRoleTemplateSelection } from "@/composables/use-role";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
import { setFocus } from "@/formkit/utils/focus";
import { pluginLabels, roleLabels } from "@/constants/labels";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
import SubmitButton from "@/components/button/SubmitButton.vue";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
// hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
import SubmitButton from "@/components/button/SubmitButton.vue";
// libs
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
// hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SubmitButton from "@/components/button/SubmitButton.vue";
import { ref, watch } from "vue";
import type { User } from "@halo-dev/api-client";
import { apiClient } from "@/utils/api-client";
import cloneDeep from "lodash.clonedeep";
import { cloneDeep } from "lodash-es";
import { reset } from "@formkit/core";
import { setFocus } from "@/formkit/utils/focus";
Expand Down
12 changes: 2 additions & 10 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@
"floating-vue": "2.0.0-beta.24",
"fuse.js": "^6.6.2",
"jsencrypt": "^3.3.2",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.2",
"lodash.sortby": "^4.7.0",
"lodash-es": "^4.17.21",
"overlayscrollbars": "^2.1.1",
"overlayscrollbars-vue": "^0.5.1",
"path-browserify": "^1.0.1",
Expand All @@ -114,11 +110,7 @@
"@tailwindcss/forms": "^0.5.7",
"@tsconfig/node18": "^2.0.1",
"@types/jsdom": "^20.0.1",
"@types/lodash.clonedeep": "4.5.7",
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.merge": "^4.6.7",
"@types/lodash.sortby": "^4.7.9",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.11.19",
"@types/qs": "^6.9.7",
"@types/randomstring": "^1.1.8",
Expand Down
Loading

0 comments on commit 36ebc24

Please sign in to comment.