Skip to content

Commit

Permalink
Add pre-commit hook to prevent references to kolibri-common package i…
Browse files Browse the repository at this point in the history
…n published packages.

Add pre-commit hook to rebuild kolibri package.
Fix all flagged issues.
  • Loading branch information
rtibbles committed Dec 2, 2024
1 parent 7a44415 commit 805c2e5
Show file tree
Hide file tree
Showing 57 changed files with 115 additions and 116 deletions.
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/device/assets/src/views/DeviceInfoPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<script>
import { mapGetters, mapState } from 'vuex';
import TechnicalTextBlock from 'kolibri-common/components/AppError/TechnicalTextBlock';
import TechnicalTextBlock from 'kolibri/components/error/TechnicalTextBlock';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import useSnackbar from 'kolibri/composables/useSnackbar';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
import TaskResource from 'kolibri/apiResources/TaskResource';
import FacilityResource from 'kolibri-common/apiResources/FacilityResource';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import CoreMenu from 'kolibri-common/components/CoreMenu';
import CoreMenuOption from 'kolibri-common/components/CoreMenu/CoreMenuOption';
import CoreMenu from 'kolibri/components/CoreMenu';
import CoreMenuOption from 'kolibri/components/CoreMenu/CoreMenuOption';
import { TaskStatuses } from 'kolibri-common/utils/syncTaskUtils';
import { SyncPageNames } from 'kolibri-common/components/SyncSchedule/constants';
import PrivacyModal from './PrivacyModal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import camelCase from 'lodash/camelCase';
import { ContentLevels } from 'kolibri/constants';
import DownloadButton from 'kolibri-common/components/DownloadButton';
import DownloadButton from 'kolibri/components/DownloadButton';
import get from 'lodash/get';
import {
licenseShortName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<script>
import KToolbar from 'kolibri-design-system/lib/KToolbar';
import Backdrop from 'kolibri-common/components/Backdrop';
import Backdrop from 'kolibri/components/Backdrop';
import ContentItem from './ContentItem';
export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
import camelCase from 'lodash/camelCase';
import LearnerNeeds from 'kolibri-constants/labels/Needs';
import DownloadButton from 'kolibri-common/components/DownloadButton';
import DownloadButton from 'kolibri/components/DownloadButton';
import TimeDuration from 'kolibri-common/components/TimeDuration';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import get from 'lodash/get';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
import CoachContentLabel from 'kolibri-common/components/labels/CoachContentLabel';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import CoreMenu from 'kolibri-common/components/CoreMenu';
import CoreMenuOption from 'kolibri-common/components/CoreMenu/CoreMenuOption';
import CoreMenu from 'kolibri/components/CoreMenu';
import CoreMenuOption from 'kolibri/components/CoreMenu/CoreMenuOption';
import useUser from 'kolibri/composables/useUser';
import ProgressBar from '../ProgressBar';
import commonLearnStrings from '../commonLearnStrings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import CoachContentLabel from 'kolibri-common/components/labels/CoachContentLabel';
import CoreMenu from 'kolibri-common/components/CoreMenu';
import CoreMenu from 'kolibri/components/CoreMenu';
import { ContentNodeKinds } from 'kolibri/constants';
import CoreMenuOption from 'kolibri-common/components/CoreMenu/CoreMenuOption';
import CoreMenuOption from 'kolibri/components/CoreMenu/CoreMenuOption';
import ProgressIcon from 'kolibri-common/components/labels/ProgressIcon';
import KToolbar from 'kolibri-design-system/lib/KToolbar';
import { validateLearningActivity } from 'kolibri/utils/validators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { get } from '@vueuse/core';
import { computed, watch } from '@vue/composition-api';
import MissingResourceAlert from 'kolibri-common/components/MissingResourceAlert.vue';
import useUserSyncStatus from 'kolibri-common/composables/useUserSyncStatus';
import useUserSyncStatus from 'kolibri/composables/useUserSyncStatus';
import { SyncStatus } from 'kolibri/constants';
import { createTranslator } from 'kolibri/utils/i18n';
import useUser from 'kolibri/composables/useUser';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
import { LearnerDeviceStatus } from 'kolibri/constants';
import urls from 'kolibri/urls';
import redirectBrowser from 'kolibri/utils/redirectBrowser';
import useUserSyncStatus from 'kolibri-common/composables/useUserSyncStatus';
import useUserSyncStatus from 'kolibri/composables/useUserSyncStatus';
export default {
name: 'StorageNotification',
Expand Down
4 changes: 2 additions & 2 deletions kolibri/plugins/learn/assets/src/views/TopicsContentPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
import samePageCheckGenerator from 'kolibri-common/utils/samePageCheckGenerator';
import client from 'kolibri/client';
import urls from 'kolibri/urls';
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 LearningActivityChip from 'kolibri-common/components/ResourceDisplayAndSearch/LearningActivityChip.vue';
import SidePanelModal from 'kolibri-common/components/SidePanelModal';
import useChannels from 'kolibri-common/composables/useChannels';
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/perseus_viewer/assets/src/views/Tex.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import PropTypes from 'prop-types';
import katex from 'katex';
import katexA11y from 'katex/dist/contrib/render-a11y-string';
import createReactClass from 'create-react-class';
import scriptLoader from 'kolibri-common/utils/scriptLoader';
import scriptLoader from 'kolibri/utils/scriptLoader';
import urls from 'kolibri/urls';

let pendingScripts = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
import CoreLogo from 'kolibri/components/CoreLogo';
import LanguageSwitcherModal from 'kolibri/components/language-switcher/LanguageSwitcherModal';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import AppError from 'kolibri-common/components/AppError';
import AppError from 'kolibri/components/error/AppError';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import { availableLanguages, currentLanguage } from 'kolibri/utils/i18n';
import { FooterMessageTypes } from '../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<script>
import PrivacyInfoModal from 'kolibri-common/components/PrivacyInfoModal';
import PrivacyInfoModal from 'kolibri/components/PrivacyInfoModal';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import OnboardingStepBase from '../OnboardingStepBase';
import { FooterMessageTypes } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import omitBy from 'lodash/omitBy';
import get from 'lodash/get';
import AppError from 'kolibri-common/components/AppError';
import AppError from 'kolibri/components/error/AppError';
import { currentLanguage } from 'kolibri/utils/i18n';
import { checkCapability } from 'kolibri/utils/appCapabilities';
import redirectBrowser from 'kolibri/utils/redirectBrowser';
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/user_auth/assets/src/views/AuthBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
import { mapGetters } from 'vuex';
import CoreLogo from 'kolibri/components/CoreLogo';
import PrivacyInfoModal from 'kolibri-common/components/PrivacyInfoModal';
import PrivacyInfoModal from 'kolibri/components/PrivacyInfoModal';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import useUser from 'kolibri/composables/useUser';
import themeConfig from 'kolibri/styles/themeConfig';
Expand Down
4 changes: 2 additions & 2 deletions kolibri/plugins/user_auth/assets/src/views/UserAuthLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
import AuthMessage from 'kolibri/components/AuthMessage';
import coreBannerContent from 'kolibri-common/utils/coreBannerContent';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
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 { ComponentMap } from '../constants';
import CoreBanner from './CoreBanner';
Expand Down
33 changes: 0 additions & 33 deletions packages/kolibri-common/components/CoreMenu/CoreMenuDivider.vue

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<script>
import { get } from '@vueuse/core';
import Backdrop from 'kolibri-common/components/Backdrop';
import Backdrop from 'kolibri/components/Backdrop';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<script>
import PrivacyInfoModal from 'kolibri-common/components/PrivacyInfoModal';
import PrivacyInfoModal from 'kolibri/components/PrivacyInfoModal';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
export default {
Expand Down
13 changes: 6 additions & 7 deletions packages/kolibri-tools/lib/moduleMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
'kolibri.coreVue.components.Backdrop': 'kolibri-common/components/Backdrop',
'kolibri.coreVue.components.CoachContentLabel':
'kolibri-common/components/labels/CoachContentLabel',
'kolibri.coreVue.components.DownloadButton': 'kolibri-common/components/DownloadButton',
'kolibri.coreVue.components.DownloadButton': 'kolibri/components/DownloadButton',
'kolibri.coreVue.components.ProgressBar': null, // Not used
'kolibri.coreVue.components.ContentIcon': 'kolibri-common/components/labels/ContentIcon',
'kolibri.coreVue.components.ProgressIcon': 'kolibri-common/components/labels/ProgressIcon',
Expand All @@ -41,10 +41,9 @@ module.exports = {
'kolibri.coreVue.components.AuthMessage': 'kolibri/components/AuthMessage',
'kolibri.coreVue.components.FilterTextbox': 'kolibri/components/FilterTextbox',
'kolibri.coreVue.components.CoreSnackbar': null, // Only used in GlobalSnackbar
'kolibri.coreVue.components.CoreMenu': 'kolibri-common/components/CoreMenu',
'kolibri.coreVue.components.CoreMenuDivider':
'kolibri-common/components/CoreMenu/CoreMenuDivider',
'kolibri.coreVue.components.CoreMenuOption': 'kolibri-common/components/CoreMenu/CoreMenuOption',
'kolibri.coreVue.components.CoreMenu': 'kolibri/components/CoreMenu',
'kolibri.coreVue.components.CoreMenuDivider': null,
'kolibri.coreVue.components.CoreMenuOption': 'kolibri/components/CoreMenu/CoreMenuOption',
'kolibri.coreVue.components.CoreTable': 'kolibri/components/CoreTable',
'kolibri.coreVue.components.UserTable': 'kolibri-common/components/UserTable',
'kolibri.coreVue.components.CoreInfoIcon': 'kolibri-common/components/labels/CoreInfoIcon',
Expand All @@ -58,7 +57,7 @@ module.exports = {
'kolibri.coreVue.components.UiAlert': 'kolibri-design-system/lib/keen/UiAlert',
'kolibri.coreVue.components.UiIconButton': 'kolibri-design-system/lib/keen/UiIconButton',
'kolibri.coreVue.components.UiToolbar': 'kolibri-design-system/lib/KToolbar',
'kolibri.coreVue.components.PrivacyInfoModal': 'kolibri-common/components/PrivacyInfoModal',
'kolibri.coreVue.components.PrivacyInfoModal': 'kolibri/components/PrivacyInfoModal',
'kolibri.coreVue.components.UserTypeDisplay': 'kolibri-common/components/UserTypeDisplay',
'kolibri.coreVue.components.Draggable': 'kolibri-common/components/sortable/Draggable',
'kolibri.coreVue.components.DragHandle': 'kolibri-common/components/sortable/DragHandle',
Expand Down Expand Up @@ -130,7 +129,7 @@ module.exports = {
'kolibri/composables/useMinimumKolibriVersion',
'kolibri.coreVue.composables.useSnackbar': 'kolibri/composables/useSnackbar',
'kolibri.coreVue.composables.useUser': 'kolibri/composables/useUser',
'kolibri.coreVue.composables.useUserSyncStatus': 'kolibri-common/composables/useUserSyncStatus',
'kolibri.coreVue.composables.useUserSyncStatus': 'kolibri/composables/useUserSyncStatus',
'kolibri.coreVue.composables.useNow': 'kolibri/composables/useNow',
'kolibri.coreVue.composables.useTotalProgress': 'kolibri/composables/useTotalProgress',
'kolibri.resources': {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<script>
import useUser from 'kolibri/composables/useUser';
import { getFilePresetString } from '../uiText/filePresetStrings';
import { getRenderableFiles } from '../utils/contentViewer';
import { getRenderableFiles } from 'kolibri/components/internal/ContentRenderer/utils';
import { getFilePresetString } from './internal/filePresetStrings';
export default {
name: 'DownloadButton',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script>
import useSnackbar from 'kolibri/composables/useSnackbar';
import CoreSnackbar from './CoreSnackbar';
import CoreSnackbar from './internal/CoreSnackbar';
export default {
name: 'GlobalSnackbar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<script>
import UiSnackbar from 'kolibri-design-system/lib/keen/UiSnackbar.vue';
import Backdrop from 'kolibri-common/components/Backdrop';
import Backdrop from 'kolibri/components/Backdrop';
import useSnackbar from 'kolibri/composables/useSnackbar';
/* Snackbars are used to display notification. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mount } from '@vue/test-utils';
import { coreStoreFactory as makeStore } from 'kolibri/store';
import AppError from '../index.vue';
import AppError from '../AppError';
import coreModule from '../../../../../kolibri/core/assets/src/state/modules/core';

function makeWrapper() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import { crossComponentTranslator } from 'kolibri/utils/i18n';
import UiAlert from 'kolibri-design-system/lib/keen/UiAlert';
import AppError from 'kolibri-common/components/AppError';
import ReportErrorModal from 'kolibri-common/components/AppError/ReportErrorModal';
import DownloadButton from 'kolibri-common/components/DownloadButton';
import AppError from 'kolibri/components/error/AppError';
import ReportErrorModal from 'kolibri/components/error/ReportErrorModal';
import DownloadButton from 'kolibri/components/DownloadButton';
export default {
name: 'ContentRendererError',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import Vue from 'vue';
import { RENDERER_SUFFIX } from 'kolibri/constants';
import {
canRenderContent,
getRenderableFiles,
getDefaultFile,
getFilePreset,
} from '../contentViewer';
import { canRenderContent, getRenderableFiles, getDefaultFile, getFilePreset } from '../utils';

// Add a component to the Vue instance that can be used to test the utility functions
const addRegisterableComponents = (...presets) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { RENDERER_SUFFIX } from 'kolibri/constants';
import {
canRenderContent,
getRenderableFiles,
getDefaultFile,
getFilePreset,
} from 'kolibri-common/utils/contentViewer';
import { canRenderContent, getRenderableFiles, getDefaultFile, getFilePreset } from './utils';
import ContentRendererError from './ContentRendererError';

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getContentLangDir,
languageDirections,
} from 'kolibri/utils/i18n';
import { getRenderableFiles, getDefaultFile } from 'kolibri-common/utils/contentViewer';
import { getRenderableFiles, getDefaultFile } from './utils';
import ContentRendererError from './ContentRendererError';

const logging = logger.getLogger(__filename);
Expand Down
2 changes: 1 addition & 1 deletion packages/kolibri/components/pages/AppBarPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import { isTouchDevice } from 'kolibri/utils/browserInfo';
import useUserSyncStatus from 'kolibri-common/composables/useUserSyncStatus';
import useUserSyncStatus from 'kolibri/composables/useUserSyncStatus';
import useUser from 'kolibri/composables/useUser';
import ScrollingHeader from '../ScrollingHeader';
import AppBar from './internal/AppBar';
Expand Down
Loading

0 comments on commit 805c2e5

Please sign in to comment.