From fd8cf40f0d4bc1187650f51ae0a50fafab0154ea Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 13 Jan 2023 14:58:09 +0100 Subject: [PATCH 1/9] Make filesize lib work in ts components in jest --- .npmrc | 1 + packages/design-system/package.json | 4 ++-- pnpm-lock.yaml | 2 +- tests/unit/config/jest.config.ts | 9 +++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.npmrc b/.npmrc index b4718360b8a..2d7748d6e6b 100644 --- a/.npmrc +++ b/.npmrc @@ -8,6 +8,7 @@ public-hoist-pattern[]=owncloud-sdk public-hoist-pattern[]=lodash-es public-hoist-pattern[]=mark.js public-hoist-pattern[]=fuse.js +public-hoist-pattern[]=filesize # @vue/component-compiler-utils hoist-pattern[]=sass diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 1964659e246..197f25ff9fc 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -64,7 +64,7 @@ "deepmerge": "^4.2.2", "depcheck": "^1.3.1", "file-loader": "^6.2.0", - "filesize": "^9.0.9", + "filesize": "^9.0.11", "focus-trap": "^6.4.0", "focus-trap-vue": "^1.1.1", "fuse.js": "^6.4.6", @@ -126,7 +126,7 @@ }, "peerDependencies": { "@popperjs/core": "^2.4.0", - "filesize": "^9.0.9", + "filesize": "^9.0.11", "focus-trap": "^6.4.0", "focus-trap-vue": "^1.1.1", "fuse.js": "^6.4.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eb113667e0..76f86f6d858 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -218,7 +218,7 @@ importers: deepmerge: ^4.2.2 depcheck: ^1.3.1 file-loader: ^6.2.0 - filesize: ^9.0.9 + filesize: ^9.0.11 focus-trap: ^6.4.0 focus-trap-vue: ^1.1.1 fuse.js: ^6.4.6 diff --git a/tests/unit/config/jest.config.ts b/tests/unit/config/jest.config.ts index 6533cca3d1f..6b97e2ef691 100644 --- a/tests/unit/config/jest.config.ts +++ b/tests/unit/config/jest.config.ts @@ -3,7 +3,7 @@ import { compilerOptions } from '../../../vite.config' const rootDir = path.resolve(__dirname, '../../../') // We need to transpile these modules as they are using esm syntax -const esmModules = ['lodash-es', 'mark.js', 'fuse.js'].map((m) => `.pnpm/${m}@.*`) +const esmModules = ['lodash-es', 'mark.js', 'fuse.js', 'filesize'].map((m) => `.pnpm/${m}@.*`) process.env.TZ = 'GMT' module.exports = { globals: { @@ -22,10 +22,11 @@ module.exports = { moduleNameMapper: { '\\.(css|less|scss)$': '/tests/unit/stubs/empty.js', '^@/(.*)$': '/$1', - 'core-js': '/node_modules/core-js', + '^core-js$': '/node_modules/core-js', '^vue$': '@vue/compat', - 'mark.js': '/node_modules/mark.js/src/vanilla.js', - 'fuse.js': '/node_modules/fuse.js/dist/fuse.esm.js', + '^mark.js$': '/node_modules/mark.js/src/vanilla.js', + '^fuse.js$': '/node_modules/fuse.js/dist/fuse.esm.js', + '^filesize$': '/node_modules/filesize/lib/filesize.esm.js', // HACK: workaround for https://github.com/transloadit/uppy/issues/4127 '@uppy/core': 'tests/unit/stubs/uppy', From 3829f4b7b46d0511c76b0a8b035c587af414b372 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 13 Jan 2023 15:19:56 +0100 Subject: [PATCH 2/9] Make vue-inline-svg lib work in ts components in jest --- package.json | 3 ++- patches/vue-inline-svg@2.1.1.patch | 11 +++++++++++ pnpm-lock.yaml | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 patches/vue-inline-svg@2.1.1.patch diff --git a/package.json b/package.json index a3599bdd965..028a5753296 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,8 @@ "@adobe/leonardo-contrast-colors@1.0.0-alpha.16": "patches/@adobe__leonardo-contrast-colors@1.0.0-alpha.16.patch", "jest-serializer-vue-tjw@3.19.0": "patches/jest-serializer-vue-tjw@3.19.0.patch", "vue-gettext@2.1.12": "patches/vue-gettext@2.1.12.patch", - "keycode@2.2.1": "patches/keycode@2.2.1.patch" + "keycode@2.2.1": "patches/keycode@2.2.1.patch", + "vue-inline-svg@2.1.1": "patches/vue-inline-svg@2.1.1.patch" } }, "jestSerializer": { diff --git a/patches/vue-inline-svg@2.1.1.patch b/patches/vue-inline-svg@2.1.1.patch new file mode 100644 index 00000000000..b873df86a99 --- /dev/null +++ b/patches/vue-inline-svg@2.1.1.patch @@ -0,0 +1,11 @@ +diff --git a/dist/vue-inline-svg.js b/dist/vue-inline-svg.js +index d41be2f1da8615dac2242313a629c6b8b93ac263..04cae73f0fd7c20a02faf8f68ec3f360287c0cb1 100644 +--- a/dist/vue-inline-svg.js ++++ b/dist/vue-inline-svg.js +@@ -1,5 +1,5 @@ + (function (global, factory) { +- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : ++ typeof exports === 'object' && typeof module !== 'undefined' ? function() { Object.defineProperty(exports, "__esModule", { value: true }); module.exports.default = factory(require('vue')) }() : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueInlineSvg = {})); + })(this, (function (exports) { 'use strict'; \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 76f86f6d858..097f7bf11a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ patchedDependencies: keycode@2.2.1: hash: nmisee7m676ph5sqah5fka5ueu path: patches/keycode@2.2.1.patch + vue-inline-svg@2.1.1: + hash: nh46h6vcl5bo5utrghvvpm2kue + path: patches/vue-inline-svg@2.1.1.patch importers: From d1c69df09d2c3191bc87b64494de202b8a6d1ae3 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 13 Jan 2023 15:21:00 +0100 Subject: [PATCH 3/9] chore: Typescript all the things --- .../docs/components/status/ComponentsList.vue | 2 +- .../design-system/docs/components/tokens/AllTokens.vue | 7 ++++--- .../docs/components/tokens/ColorTokens.vue | 7 ++++--- .../design-system/docs/components/tokens/IconList.vue | 8 +++++--- .../docs/components/tokens/SpacingTokens.vue | 8 +++++--- .../src/components/OcAccordion/OcAccordion.vue | 7 ++++--- .../src/components/OcAvatarCount/OcAvatarCount.vue | 8 +++++--- .../components/OcAvatarFederated/OcAvatarFederated.vue | 7 ++++--- .../src/components/OcAvatarGroup/OcAvatarGroup.vue | 7 ++++--- .../src/components/OcAvatarGuest/OcAvatarGuest.vue | 7 ++++--- .../src/components/OcAvatarItem/OcAvatarItem.vue | 7 ++++--- .../src/components/OcAvatarLink/OcAvatarLink.vue | 8 +++++--- .../src/components/OcAvatars/OcAvatars.vue | 2 +- .../src/components/OcBreadcrumb/OcBreadcrumb.vue | 10 ++++++---- .../design-system/src/components/OcButton/OcButton.vue | 8 +++++--- .../src/components/OcCheckbox/OcCheckbox.vue | 7 ++++--- .../OcContextualHelper/OcContextualHelper.vue | 7 ++++--- .../src/components/OcDropzone/OcDropzone.vue | 8 +++++--- .../design-system/src/components/OcGrid/OcGrid.vue | 8 +++++--- .../components/OcHiddenAnnouncer/OcHiddenAnnouncer.vue | 7 ++++--- .../design-system/src/components/OcIcon/OcIcon.vue | 8 +++++--- .../design-system/src/components/OcImage/OcImage.vue | 8 +++++--- .../src/components/OcInfoDrop/OcInfoDrop.vue | 8 +++++--- .../design-system/src/components/OcLoader/OcLoader.vue | 8 +++++--- .../design-system/src/components/OcLogo/OcLogo.vue | 7 ++++--- .../design-system/src/components/OcModal/OcModal.vue | 7 ++++--- .../OcNotificationMessage/OcNotificationMessage.vue | 7 ++++--- .../src/components/OcNotifications/OcNotifications.vue | 8 +++++--- .../src/components/OcPageSize/OcPageSize.vue | 7 ++++--- .../src/components/OcPagination/OcPagination.vue | 7 ++++--- .../src/components/OcProgress/OcProgress.vue | 8 +++++--- .../src/components/OcProgressPie/OcProgressPie.vue | 8 +++++--- .../design-system/src/components/OcRadio/OcRadio.vue | 8 +++++--- .../src/components/OcRecipient/OcRecipient.vue | 8 +++++--- .../src/components/OcResource/OcResource.vue | 8 +++++--- .../src/components/OcResourceName/OcResourceName.vue | 8 +++++--- .../src/components/OcResourceSize/OcResourceSize.vue | 7 ++++--- .../src/components/OcSearchBar/OcSearchBar.vue | 8 +++++--- .../src/components/OcSpinner/OcSpinner.vue | 7 ++++--- .../OcStatusIndicators/OcStatusIndicators.vue | 7 ++++--- .../design-system/src/components/OcSwitch/OcSwitch.vue | 8 +++++--- .../src/components/OcTableSimple/OcTableSimple.vue | 8 +++++--- packages/design-system/src/components/OcTag/OcTag.vue | 8 +++++--- .../src/components/OcTextInput/OcTextInput.vue | 8 +++++--- .../src/components/OcTextarea/OcTextarea.vue | 7 ++++--- .../src/components/_OcGhostElement/_OcGhostElement.vue | 8 +++++--- .../src/components/_OcTableBody/_OcTableBody.vue | 7 ++++--- .../components/_OcTableCellData/_OcTableCellData.vue | 7 ++++--- .../components/_OcTableCellHead/_OcTableCellHead.vue | 7 ++++--- .../src/components/_OcTableFooter/_OcTableFooter.vue | 7 ++++--- .../src/components/_OcTableHeader/_OcTableHeader.vue | 7 ++++--- .../src/components/_OcTableRow/_OcTableRow.vue | 8 ++++---- .../src/components/Groups/CreateGroupModal.vue | 8 +++++--- .../src/components/Groups/DeleteGroupModal.vue | 2 +- .../src/components/Groups/GroupsList.vue | 7 ++++--- .../src/components/Groups/SideBar/DetailsPanel.vue | 8 +++++--- .../src/components/Groups/SideBar/EditPanel.vue | 7 ++++--- .../src/components/Users/CreateUserModal.vue | 7 ++++--- .../src/components/Users/DeleteUserModal.vue | 8 +++++--- .../src/components/Users/SideBar/DetailsPanel.vue | 7 ++++--- .../src/components/Users/SideBar/EditPanel.vue | 7 ++++--- .../components/Users/SideBar/GroupAssignmentsPanel.vue | 7 ++++--- .../src/components/Users/SideBar/UserInfoBox.vue | 7 ++++--- .../src/components/Users/UsersList.vue | 8 +++++--- .../web-app-external/src/components/ErrorScreen.vue | 7 ++++--- .../web-app-external/src/components/LoadingScreen.vue | 7 ++++--- .../src/components/AppBar/Upload/ResourceUpload.vue | 7 ++++--- .../src/components/FilesList/ListInfo.vue | 7 ++++--- .../src/components/FilesList/Pagination.vue | 8 +++++--- .../web-app-files/src/components/SideBar/FileInfo.vue | 8 +++++--- .../SideBar/Shares/Collaborators/EditDropdown.vue | 7 ++++--- .../SideBar/Shares/Links/CreateQuickLink.vue | 2 +- .../web-app-files/src/components/SideBar/SpaceInfo.vue | 8 +++++--- .../web-app-pdf-viewer/src/components/ErrorScreen.vue | 8 +++++--- .../src/components/LoadingScreen.vue | 8 +++++--- packages/web-app-search/src/App.vue | 8 +++++--- packages/web-app-search/src/views/List.vue | 8 +++++--- packages/web-app-skeleton/src/App.vue | 7 ++++--- packages/web-pkg/src/components/AppLoadingSpinner.vue | 8 +++++--- packages/web-pkg/src/components/NoContentMessage.vue | 8 +++++--- packages/web-pkg/src/components/SpaceQuota.vue | 8 +++++--- .../src/components/Spaces/ReadmeContentModal.vue | 8 +++++--- .../sideBar/Spaces/Details/SpaceDetailsMultiple.vue | 8 +++++--- .../src/components/sideBar/Spaces/SpaceNoSelection.vue | 7 ++++--- packages/web-runtime/src/components/Avatar.vue | 8 +++++--- .../web-runtime/src/components/EditPasswordModal.vue | 8 +++++--- packages/web-runtime/src/components/MessageBar.vue | 7 ++++--- .../src/components/SidebarNav/SidebarNav.vue | 7 ++++--- .../src/components/SidebarNav/SidebarNavItem.vue | 8 +++++--- packages/web-runtime/src/components/SkipTo.vue | 7 ++++--- .../src/components/Topbar/ApplicationsMenu.vue | 7 ++++--- .../web-runtime/src/components/Topbar/FeedbackLink.vue | 8 +++++--- .../src/components/Topbar/ThemeSwitcher.vue | 8 ++++---- .../web-runtime/src/components/Topbar/UserMenu.vue | 7 ++++--- packages/web-runtime/src/layouts/Loading.vue | 7 ++++--- 95 files changed, 414 insertions(+), 280 deletions(-) diff --git a/packages/design-system/docs/components/status/ComponentsList.vue b/packages/design-system/docs/components/status/ComponentsList.vue index e41b8d37c2a..ca1c62f5e5d 100644 --- a/packages/design-system/docs/components/status/ComponentsList.vue +++ b/packages/design-system/docs/components/status/ComponentsList.vue @@ -63,7 +63,7 @@ - diff --git a/packages/design-system/src/components/OcButton/OcButton.vue b/packages/design-system/src/components/OcButton/OcButton.vue index cebd4960ba4..88088ac92fd 100644 --- a/packages/design-system/src/components/OcButton/OcButton.vue +++ b/packages/design-system/src/components/OcButton/OcButton.vue @@ -12,7 +12,7 @@ - diff --git a/packages/design-system/src/components/OcButton/OcButton.vue b/packages/design-system/src/components/OcButton/OcButton.vue index 88088ac92fd..4d2c9e37e3a 100644 --- a/packages/design-system/src/components/OcButton/OcButton.vue +++ b/packages/design-system/src/components/OcButton/OcButton.vue @@ -13,9 +13,10 @@ - ```jsx + ``` ``` diff --git a/packages/design-system/docs/components/tokens/_HighlightedText.vue b/packages/design-system/docs/components/tokens/_HighlightedText.vue index 70308dbf2b9..035ccdeee36 100644 --- a/packages/design-system/docs/components/tokens/_HighlightedText.vue +++ b/packages/design-system/docs/components/tokens/_HighlightedText.vue @@ -22,8 +22,8 @@ -