diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7782dcc211..e01aa0412e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,14 @@ repos: entry: yarn run lint-frontend:format language: system files: \.(js|vue|scss|css)$ +- repo: local + hooks: + - id: core-js-api + name: Rebuild kolibri package + description: Rebuilds kolibri package on changes to core js api + entry: yarn run build-kolibri-tools + language: system + files: ^packages/kolibri/.*\.(js|vue)$ - repo: local hooks: - id: no-auto-migrations @@ -75,6 +83,12 @@ repos: entry: settings\.AUTH_USER_MODEL language: pygrep files: migrations/.*\.py$ + - id: no-kolibri-common-imports + name: No imports from kolibri-common (which is unpublished) in any other packages + entry: kolibri-common + language: pygrep + exclude: (^packages/kolibri-common/|moduleMapping\.js|test/fixtures) + files: ^packages/.*\.(js|vue)$ - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: diff --git a/kolibri/plugins/device/assets/src/views/DeviceInfoPage.vue b/kolibri/plugins/device/assets/src/views/DeviceInfoPage.vue index 7e058809359..0ca95550775 100644 --- a/kolibri/plugins/device/assets/src/views/DeviceInfoPage.vue +++ b/kolibri/plugins/device/assets/src/views/DeviceInfoPage.vue @@ -81,7 +81,7 @@ - - - diff --git a/packages/kolibri-common/components/CoreMenu/__tests__/CoreMenuDivider.spec.js b/packages/kolibri-common/components/CoreMenu/__tests__/CoreMenuDivider.spec.js deleted file mode 100644 index 650b1feb9b4..00000000000 --- a/packages/kolibri-common/components/CoreMenu/__tests__/CoreMenuDivider.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -import { render, screen } from '@testing-library/vue'; -import CoreMenuDivider from '../CoreMenuDivider.vue'; - -describe('CoreMenuDivider', () => { - test('renders the component', () => { - render(CoreMenuDivider); - - expect(screen.getByRole('listitem')).toBeInTheDocument(); - }); -}); diff --git a/packages/kolibri-common/components/SidePanelModal/index.vue b/packages/kolibri-common/components/SidePanelModal/index.vue index 6dfd0da30cd..978faf87e51 100644 --- a/packages/kolibri-common/components/SidePanelModal/index.vue +++ b/packages/kolibri-common/components/SidePanelModal/index.vue @@ -67,7 +67,7 @@ - + diff --git a/packages/kolibri/components/pages/NotificationsRoot/index.vue b/packages/kolibri/components/pages/NotificationsRoot/index.vue index 19189f95ce6..e99d96d6297 100644 --- a/packages/kolibri/components/pages/NotificationsRoot/index.vue +++ b/packages/kolibri/components/pages/NotificationsRoot/index.vue @@ -44,15 +44,15 @@ import { mapState } from 'vuex'; import Lockr from 'lockr'; - import PingbackNotificationResource from 'kolibri-common/apiResources/PingbackNotificationResource'; - import PingbackNotificationDismissedResource from 'kolibri-common/apiResources/PingbackNotificationDismissedResource'; import { UPDATE_MODAL_DISMISSED } from 'kolibri/constants'; import { currentLanguage, defaultLanguage } from 'kolibri/utils/i18n'; import AuthMessage from 'kolibri/components/AuthMessage'; import AppBarPage from 'kolibri/components/pages/AppBarPage'; - import AppError from 'kolibri-common/components/AppError'; - import GlobalSnackbar from 'kolibri-common/components/GlobalSnackbar'; + import AppError from 'kolibri/components/error/AppError'; + import GlobalSnackbar from 'kolibri/components/GlobalSnackbar'; import useUser from 'kolibri/composables/useUser'; + import PingbackNotificationDismissedResource from './internal/PingbackNotificationDismissedResource'; + import PingbackNotificationResource from './internal/PingbackNotificationResource'; import UpdateNotification from './internal/UpdateNotification'; export default { diff --git a/packages/kolibri-common/apiResources/PingbackNotificationDismissedResource.js b/packages/kolibri/components/pages/NotificationsRoot/internal/PingbackNotificationDismissedResource.js similarity index 100% rename from packages/kolibri-common/apiResources/PingbackNotificationDismissedResource.js rename to packages/kolibri/components/pages/NotificationsRoot/internal/PingbackNotificationDismissedResource.js diff --git a/packages/kolibri-common/apiResources/PingbackNotificationResource.js b/packages/kolibri/components/pages/NotificationsRoot/internal/PingbackNotificationResource.js similarity index 100% rename from packages/kolibri-common/apiResources/PingbackNotificationResource.js rename to packages/kolibri/components/pages/NotificationsRoot/internal/PingbackNotificationResource.js diff --git a/packages/kolibri/components/pages/__tests__/NotificationsRoot.spec.js b/packages/kolibri/components/pages/__tests__/NotificationsRoot.spec.js index e56b26a2c56..080c6d2e292 100644 --- a/packages/kolibri/components/pages/__tests__/NotificationsRoot.spec.js +++ b/packages/kolibri/components/pages/__tests__/NotificationsRoot.spec.js @@ -6,8 +6,8 @@ import { coreStoreFactory as makeStore } from '../../../store'; import coreModule from '../../../../../kolibri/core/assets/src/state/modules/core'; jest.mock('kolibri/composables/useUser'); -jest.mock('kolibri-common/apiResources/PingbackNotificationResource'); -jest.mock('kolibri-common/apiResources/PingbackNotificationDismissedResource'); +jest.mock('../NotificationsRoot/internal/PingbackNotificationResource'); +jest.mock('../NotificationsRoot/internal/PingbackNotificationDismissedResource'); function makeWrapper(useUserMockObj = null) { const store = makeStore(); diff --git a/packages/kolibri-common/apiResources/UserProgressResource.js b/packages/kolibri/composables/internal/UserProgressResource.js similarity index 100% rename from packages/kolibri-common/apiResources/UserProgressResource.js rename to packages/kolibri/composables/internal/UserProgressResource.js diff --git a/packages/kolibri/composables/useTotalProgress.js b/packages/kolibri/composables/useTotalProgress.js index a5abc46fc57..b44276f09d5 100644 --- a/packages/kolibri/composables/useTotalProgress.js +++ b/packages/kolibri/composables/useTotalProgress.js @@ -1,8 +1,8 @@ import { ref, computed } from 'vue'; import { get, set } from '@vueuse/core'; import useUser from 'kolibri/composables/useUser'; -import UserProgressResource from 'kolibri-common/apiResources/UserProgressResource'; import { MaxPointsPerContent } from 'kolibri/constants'; +import UserProgressResource from './internal/UserProgressResource'; const totalProgress = ref(null); diff --git a/packages/kolibri-common/composables/useUserSyncStatus.js b/packages/kolibri/composables/useUserSyncStatus.js similarity index 95% rename from packages/kolibri-common/composables/useUserSyncStatus.js rename to packages/kolibri/composables/useUserSyncStatus.js index 3869c21f2c9..953ccb539da 100644 --- a/packages/kolibri-common/composables/useUserSyncStatus.js +++ b/packages/kolibri/composables/useUserSyncStatus.js @@ -1,10 +1,14 @@ import { ref, onMounted, onUnmounted, computed } from 'vue'; -import UserSyncStatusResource from 'kolibri-common/apiResources/UserSyncStatusResource'; +import { Resource } from 'kolibri/apiResource'; import store from 'kolibri/store'; import { SyncStatus } from 'kolibri/constants'; import { get, useTimeoutPoll } from '@vueuse/core'; import useUser from 'kolibri/composables/useUser'; +const UserSyncStatusResource = new Resource({ + name: 'usersyncstatus', +}); + const { isLearnerOnlyImport, isUserLoggedIn, currentUserId } = useUser(); const status = ref(SyncStatus.NOT_CONNECTED); diff --git a/packages/kolibri/internal/apiSpec.js b/packages/kolibri/internal/apiSpec.js index 1748254f346..47cb0d762bd 100644 --- a/packages/kolibri/internal/apiSpec.js +++ b/packages/kolibri/internal/apiSpec.js @@ -9,12 +9,21 @@ export default { 'kolibri/apiResources/TaskResource': require('kolibri/apiResources/TaskResource'), 'kolibri/client': require('kolibri/client'), 'kolibri/components/AuthMessage': require('kolibri/components/AuthMessage'), + 'kolibri/components/Backdrop': require('kolibri/components/Backdrop'), 'kolibri/components/BottomAppBar': require('kolibri/components/BottomAppBar'), 'kolibri/components/CoreLogo': require('kolibri/components/CoreLogo'), + 'kolibri/components/CoreMenu': require('kolibri/components/CoreMenu'), + 'kolibri/components/CoreMenu/CoreMenuOption': require('kolibri/components/CoreMenu/CoreMenuOption'), 'kolibri/components/CoreTable': require('kolibri/components/CoreTable'), + 'kolibri/components/DownloadButton': require('kolibri/components/DownloadButton'), 'kolibri/components/FilterTextbox': require('kolibri/components/FilterTextbox'), + 'kolibri/components/GlobalSnackbar': require('kolibri/components/GlobalSnackbar'), + 'kolibri/components/PrivacyInfoModal': require('kolibri/components/PrivacyInfoModal'), 'kolibri/components/SkipNavigationLink': require('kolibri/components/SkipNavigationLink'), 'kolibri/components/SyncStatusDisplay': require('kolibri/components/SyncStatusDisplay'), + 'kolibri/components/error/AppError': require('kolibri/components/error/AppError'), + 'kolibri/components/error/ReportErrorModal': require('kolibri/components/error/ReportErrorModal'), + 'kolibri/components/error/TechnicalTextBlock': require('kolibri/components/error/TechnicalTextBlock'), 'kolibri/components/language-switcher/LanguageSwitcherList': require('kolibri/components/language-switcher/LanguageSwitcherList'), 'kolibri/components/language-switcher/LanguageSwitcherModal': require('kolibri/components/language-switcher/LanguageSwitcherModal'), 'kolibri/components/pages/AppBarPage': require('kolibri/components/pages/AppBarPage'), @@ -27,6 +36,7 @@ export default { 'kolibri/composables/useSnackbar': require('kolibri/composables/useSnackbar'), 'kolibri/composables/useTotalProgress': require('kolibri/composables/useTotalProgress'), 'kolibri/composables/useUser': require('kolibri/composables/useUser'), + 'kolibri/composables/useUserSyncStatus': require('kolibri/composables/useUserSyncStatus'), 'kolibri/constants': require('kolibri/constants'), 'kolibri/heartbeat': require('kolibri/heartbeat'), 'kolibri/router': require('kolibri/router'), @@ -44,6 +54,7 @@ export default { 'kolibri/utils/i18n': require('kolibri/utils/i18n'), 'kolibri/utils/objectSpecs': require('kolibri/utils/objectSpecs'), 'kolibri/utils/redirectBrowser': require('kolibri/utils/redirectBrowser'), + 'kolibri/utils/scriptLoader': require('kolibri/utils/scriptLoader'), 'kolibri/utils/serverClock': require('kolibri/utils/serverClock'), 'kolibri/utils/validators': require('kolibri/utils/validators'), 'kolibri-logging': require('kolibri-logging'), diff --git a/packages/kolibri/internal/pluginMediator.js b/packages/kolibri/internal/pluginMediator.js index a5dd4b6dd96..c4303716515 100644 --- a/packages/kolibri/internal/pluginMediator.js +++ b/packages/kolibri/internal/pluginMediator.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import logging from 'kolibri-logging'; -import scriptLoader from 'kolibri-common/utils/scriptLoader'; +import scriptLoader from 'kolibri/utils/scriptLoader'; import { RENDERER_SUFFIX } from 'kolibri/constants'; import { languageDirection, languageDirections, currentLanguage } from 'kolibri/utils/i18n'; import contentRendererMixin from '../components/internal/ContentRenderer/mixin'; diff --git a/packages/kolibri/package.json b/packages/kolibri/package.json index 24c118272af..c00f0ff1a58 100644 --- a/packages/kolibri/package.json +++ b/packages/kolibri/package.json @@ -16,12 +16,21 @@ "./apiResources/TaskResource": "./apiResources/TaskResource", "./client": "./client", "./components/AuthMessage": "./components/AuthMessage", + "./components/Backdrop": "./components/Backdrop", "./components/BottomAppBar": "./components/BottomAppBar", "./components/CoreLogo": "./components/CoreLogo", + "./components/CoreMenu": "./components/CoreMenu", + "./components/CoreMenu/CoreMenuOption": "./components/CoreMenu/CoreMenuOption", "./components/CoreTable": "./components/CoreTable", + "./components/DownloadButton": "./components/DownloadButton", "./components/FilterTextbox": "./components/FilterTextbox", + "./components/GlobalSnackbar": "./components/GlobalSnackbar", + "./components/PrivacyInfoModal": "./components/PrivacyInfoModal", "./components/SkipNavigationLink": "./components/SkipNavigationLink", "./components/SyncStatusDisplay": "./components/SyncStatusDisplay", + "./components/error/AppError": "./components/error/AppError", + "./components/error/ReportErrorModal": "./components/error/ReportErrorModal", + "./components/error/TechnicalTextBlock": "./components/error/TechnicalTextBlock", "./components/language-switcher/LanguageSwitcherList": "./components/language-switcher/LanguageSwitcherList", "./components/language-switcher/LanguageSwitcherModal": "./components/language-switcher/LanguageSwitcherModal", "./components/pages/AppBarPage": "./components/pages/AppBarPage", @@ -34,6 +43,7 @@ "./composables/useSnackbar": "./composables/useSnackbar", "./composables/useTotalProgress": "./composables/useTotalProgress", "./composables/useUser": "./composables/useUser", + "./composables/useUserSyncStatus": "./composables/useUserSyncStatus", "./constants": "./constants", "./heartbeat": "./heartbeat", "./router": "./router", @@ -51,6 +61,7 @@ "./utils/i18n": "./utils/i18n", "./utils/objectSpecs": "./utils/objectSpecs", "./utils/redirectBrowser": "./utils/redirectBrowser", + "./utils/scriptLoader": "./utils/scriptLoader", "./utils/serverClock": "./utils/serverClock", "./utils/validators": "./utils/validators" }, diff --git a/packages/kolibri-common/utils/scriptLoader.js b/packages/kolibri/utils/scriptLoader.js similarity index 100% rename from packages/kolibri-common/utils/scriptLoader.js rename to packages/kolibri/utils/scriptLoader.js