Skip to content

Commit

Permalink
fix: import constants from @devfile/api
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <[email protected]>
  • Loading branch information
olexii4 committed Dec 17, 2024
1 parent 2f614a1 commit 47d7f6d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 47 deletions.
7 changes: 7 additions & 0 deletions packages/dashboard-backend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ module.exports = {
moduleNameMapper: {
// mapping for absolute imports (see tsconfig.json)
'^@/(.*)$': '<rootDir>/src/$1',

// not everything we need is exported from the package
// so we need to alias the rest
'@devfile/api/constants(.*)$': '<rootDir>/../../node_modules/@devfile/api/constants/$1.ts',
},
transformIgnorePatterns: [
'node_modules/(?!@devfile/api/constants/constants)',
],
collectCoverageFrom: [
...base.collectCoverageFrom,

Expand Down
19 changes: 0 additions & 19 deletions packages/dashboard-backend/src/constants/devfile.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@devfile/api/constants/constants';
import { api } from '@eclipse-che/common';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';
import { IncomingMessage } from 'http';

import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@/constants/devfile';
import { DevWorkspaceApiService } from '@/devworkspaceClient/services/devWorkspaceApi';

const namespace = 'user-che';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
*/

import { V1alpha2DevWorkspace } from '@devfile/api';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';

import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@/constants/devfile';
} from '@devfile/api/constants/constants';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';

import {
CheClusterCustomResource,
CustomResourceDefinitionList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { V1alpha2DevWorkspaceTemplate } from '@devfile/api';
import { api } from '@eclipse-che/common';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';

import {
devworkspacetemplateGroup,
devworkspacetemplateLatestVersion,
devworkspacetemplatePlural,
} from '@/constants/devfile';
} from '@devfile/api/constants/constants';
import { api } from '@eclipse-che/common';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';

import {
DevWorkspaceTemplateApiService,
DevWorkspaceTemplateList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
*/

import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@devfile/api/constants/constants';
import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';
import { V1Status } from '@kubernetes/client-node';
import http, { IncomingHttpHeaders } from 'http';

import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@/constants/devfile';
import { createError } from '@/devworkspaceClient/services/helpers/createError';
import {
CustomObjectAPI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
*/

import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@devfile/api/constants/constants';
import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';
import { V1Status } from '@kubernetes/client-node';
import http from 'http';

import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
} from '@/constants/devfile';
import { prepareCustomObjectWatch } from '@/devworkspaceClient/services/helpers/prepareCustomObjectWatch';
import { ServerConfigApiService } from '@/devworkspaceClient/services/serverConfigApi';
import { IDevWorkspaceClusterApi } from '@/devworkspaceClient/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
*/

import { V1alpha2DevWorkspaceTemplate } from '@devfile/api';
import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';

import {
devworkspacetemplateGroup,
devworkspacetemplateLatestVersion,
devworkspacetemplatePlural,
} from '@/constants/devfile';
} from '@devfile/api/constants/constants';
import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';

import { createError } from '@/devworkspaceClient/services/helpers/createError';
import {
CustomObjectAPI,
Expand Down
4 changes: 4 additions & 0 deletions packages/dashboard-backend/webpack.config.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ module.exports = () => {
alias: {
// alias for absolute imports (see tsconfig.json)
'@': path.resolve(__dirname, 'src/'),

// not everything we need is exported from the package
// so we need to alias the rest
'@devfile/api/constants/constants': path.resolve(__dirname, '../../node_modules/@devfile/api/constants/constants.ts'),
},
},
resolveLoader: {},
Expand Down

0 comments on commit 47d7f6d

Please sign in to comment.