diff --git a/package.json b/package.json index 56e3beed67..46bc11c607 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "compile": "env NODE_ENV=production concurrently yarn:compile:*", "compile:main": "yarn run webpack --config webpack/main.ts", "compile:renderer": "yarn run webpack --config webpack/renderer.ts", - "compile:extension-types": "yarn run webpack --config webpack/extensions.ts", + "compile:extension-types": "yarn run tsc --project tsconfig.extension-api.json", "npm:fix-build-version": "yarn run ts-node build/set_build_version.ts", "npm:fix-package-version": "yarn run ts-node build/set_npm_version.ts", "build:linux": "yarn run compile && electron-builder --linux --dir", diff --git a/src/common/k8s-api/kube-object.ts b/src/common/k8s-api/kube-object.ts index 97b17f5b40..2f32b50c62 100644 --- a/src/common/k8s-api/kube-object.ts +++ b/src/common/k8s-api/kube-object.ts @@ -42,7 +42,7 @@ export type KubeTemplateObjectMetadata = Pic namespace?: ScopedNamespace; }; -interface BaseKubeJsonApiObjectMetadata { +export interface BaseKubeJsonApiObjectMetadata { /** * Annotations is an unstructured key value map stored with a resource that may be set by * external tools to store and retrieve arbitrary metadata. They are not queryable and should be diff --git a/src/extensions/renderer-api/k8s-api.ts b/src/extensions/renderer-api/k8s-api.ts index 68673c4e01..fa0f210511 100644 --- a/src/extensions/renderer-api/k8s-api.ts +++ b/src/extensions/renderer-api/k8s-api.ts @@ -6,6 +6,7 @@ import type { KubeResource } from "../../common/rbac"; import isAllowedResourceInjectable from "../../common/utils/is-allowed-resource.injectable"; import { castArray } from "lodash/fp"; import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api"; +import type { BaseKubeJsonApiObjectMetadata } from "../../common/k8s-api/kube-object"; export function isAllowedResource(resource: KubeResource | KubeResource[]) { const resources = castArray(resource); @@ -20,6 +21,9 @@ export function isAllowedResource(resource: KubeResource | KubeResource[]) { }); } +export { + BaseKubeJsonApiObjectMetadata, +}; export { ResourceStack } from "../../common/k8s/resource-stack"; export { apiManager } from "../../common/k8s-api/api-manager"; export { KubeObjectStore } from "../../common/k8s-api/kube-object.store"; diff --git a/tsconfig.extension-api.json b/tsconfig.extension-api.json new file mode 100644 index 0000000000..f3c73d1ef7 --- /dev/null +++ b/tsconfig.extension-api.json @@ -0,0 +1,47 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "jsx": "react", + "target": "ES2019", + "module": "ESNext", + "lib": [ + "ESNext", + "DOM", + "DOM.Iterable" + ], + "moduleResolution": "Node", + "strict": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "isolatedModules": true, + "skipLibCheck": true, + "allowJs": false, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", + "traceResolution": false, + "resolveJsonModule": true, + "useDefineForClassFields": true, + "paths": { + "*": [ + "node_modules/*", + "types/*" + ] + }, + "plugins": [ + { + "name": "typescript-plugin-css-modules" + } + ], + "emitDeclarationOnly": true, + "noEmitOnError": true, + "declaration": true, + "declarationDir": "./src/extensions/npm/extensions/dist", + }, + "include": [ + "types/*.d.ts", + ], + "files": [ + "./src/extensions/extension-api.ts", + ], +}