Skip to content

Commit

Permalink
fix: import constants from @devfile/api (#1280) (#1292)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <oorel@redhat.com>
Co-authored-by: Oleksii Orel <oorel@redhat.com>
  • Loading branch information
vinokurig and olexii4 authored Jan 14, 2025
1 parent 7e58557 commit 6636a3f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 28 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

/* eslint-disable @typescript-eslint/no-unused-vars */

import { api } from '@eclipse-che/common';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';
import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
V1alpha2DevWorkspace,
} from 'devfile-api';
} 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 { DevWorkspaceApiService } from '@/devworkspaceClient/services/devWorkspaceApi';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
* Red Hat, Inc. - initial API and implementation
*/

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

import {
CheClusterCustomResource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

/* eslint-disable @typescript-eslint/no-unused-vars */

import { api } from '@eclipse-che/common';
import * as mockClient from '@kubernetes/client-node';
import { CustomObjectsApi } from '@kubernetes/client-node';
import { V1alpha2DevWorkspaceTemplate } from '@devfile/api';
import {
devworkspacetemplateGroup,
devworkspacetemplateLatestVersion,
devworkspacetemplatePlural,
V1alpha2DevWorkspaceTemplate,
} from 'devfile-api';
} 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
* Red Hat, Inc. - initial API and implementation
*/

import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';
import { V1Status } from '@kubernetes/client-node';
import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
V1alpha2DevWorkspace,
} from 'devfile-api';
} 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 { createError } from '@/devworkspaceClient/services/helpers/createError';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
* Red Hat, Inc. - initial API and implementation
*/

import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';
import { V1Status } from '@kubernetes/client-node';
import { V1alpha2DevWorkspace } from '@devfile/api';
import {
devworkspaceGroup,
devworkspaceLatestVersion,
devworkspacePlural,
V1alpha2DevWorkspace,
} from 'devfile-api';
} 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 { prepareCustomObjectWatch } from '@/devworkspaceClient/services/helpers/prepareCustomObjectWatch';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
* Red Hat, Inc. - initial API and implementation
*/

import { api } from '@eclipse-che/common';
import * as k8s from '@kubernetes/client-node';
import { V1alpha2DevWorkspaceTemplate } from '@devfile/api';
import {
devworkspacetemplateGroup,
devworkspacetemplateLatestVersion,
devworkspacetemplatePlural,
V1alpha2DevWorkspaceTemplate,
} from 'devfile-api';
} 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 {
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 6636a3f

Please sign in to comment.