mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Extract computed channel to own NPM package for clear dependencies
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
5943a21671
commit
26e9ecb148
32
package-lock.json
generated
32
package-lock.json
generated
@ -4685,6 +4685,10 @@
|
||||
"resolved": "packages/bump-version-for-cron",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@k8slens/computed-channel": {
|
||||
"resolved": "packages/technical-features/messaging/computed-channel",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@k8slens/core": {
|
||||
"resolved": "packages/core",
|
||||
"link": true
|
||||
@ -6187,6 +6191,7 @@
|
||||
"version": "15.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@ogre-tools/test-utils/-/test-utils-15.1.2.tgz",
|
||||
"integrity": "sha512-WGuJoHgFJCt0u5ok9BnQKSkF0J1MYPrRlr0naNUUywZgNSrPy64TqlY8AEEIe2cquUZMwe2wsv9esg+KDRUnrA==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"lodash": "^4.17.21"
|
||||
}
|
||||
@ -34438,6 +34443,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "1.6.4",
|
||||
"@k8slens/messaging-fake-bridge": "^1.0.0-alpha.1",
|
||||
"@material-ui/core": "^4.12.3",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
@ -37216,20 +37222,37 @@
|
||||
"version": "1.0.0-alpha.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.7.0"
|
||||
}
|
||||
},
|
||||
"packages/technical-features/messaging/computed-channel": {
|
||||
"version": "1.0.0-alpha.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.1",
|
||||
"@k8slens/messaging-fake-bridge": "^1.0.0-alpha.1",
|
||||
"type-fest": "^2.14.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/fp": "^15.1.2",
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
||||
"@ogre-tools/test-utils": "^15.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.7.0"
|
||||
"mobx": "^6.8.0"
|
||||
}
|
||||
},
|
||||
"packages/technical-features/messaging/main": {
|
||||
@ -37250,6 +37273,7 @@
|
||||
}
|
||||
},
|
||||
"packages/technical-features/messaging/message-bridge-fake": {
|
||||
"name": "@k8slens/messaging-fake-bridge",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
||||
@ -28,19 +28,16 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/fp": "^15.1.2",
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
||||
"@ogre-tools/test-utils": "^15.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.7.0"
|
||||
},
|
||||
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.1",
|
||||
"type-fest": "^2.14.0"
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,19 +4,6 @@ export { messagingFeature } from "./feature";
|
||||
export { getRequestChannel } from "./request/get-request-channel";
|
||||
export { getMessageChannel } from "./message/get-message-channel";
|
||||
|
||||
export {
|
||||
computedChannelInjectionToken,
|
||||
computedChannelObserverInjectionToken,
|
||||
} from "./computed-channel/computed-channel.injectable";
|
||||
|
||||
export type {
|
||||
ChannelObserver,
|
||||
ComputedChannelFactory,
|
||||
JsonifiableObject,
|
||||
JsonifiableArray,
|
||||
Jsonifiable,
|
||||
} from "./computed-channel/computed-channel.injectable";
|
||||
|
||||
export { requestFromChannelInjectionToken } from "./request/request-from-channel-injection-token";
|
||||
|
||||
export type { Channel } from "./channel.no-coverage";
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@k8slens/eslint-config/eslint",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
"@k8slens/eslint-config/prettier"
|
||||
@ -0,0 +1,12 @@
|
||||
export {
|
||||
computedChannelInjectionToken,
|
||||
computedChannelObserverInjectionToken,
|
||||
} from "./src/computed-channel/computed-channel.injectable";
|
||||
|
||||
export type {
|
||||
ChannelObserver,
|
||||
ComputedChannelFactory,
|
||||
JsonifiableObject,
|
||||
JsonifiableArray,
|
||||
Jsonifiable,
|
||||
} from "./src/computed-channel/computed-channel.injectable";
|
||||
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact;
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@k8slens/computed-channel",
|
||||
"private": false,
|
||||
"version": "1.0.0-alpha.1",
|
||||
"description": "MobX-like computed between channels",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": {
|
||||
"name": "OpenLens Authors",
|
||||
"email": "info@k8slens.dev"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"dev": "webpack --mode=development --watch",
|
||||
"test:unit": "jest --coverage --runInBand",
|
||||
"lint": "lens-lint",
|
||||
"lint:fix": "lens-lint --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/fp": "^15.1.2",
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@k8slens/eslint-config": "^6.5.0-alpha.1",
|
||||
"@k8slens/messaging-fake-bridge": "^1.0.0-alpha.1",
|
||||
"type-fest": "^2.14.0"
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
import { reaction } from "mobx";
|
||||
|
||||
import { getMessageChannelListenerInjectable } from "../message/message-channel-listener-injection-token";
|
||||
import { sendMessageToChannelInjectionToken } from "../message/message-to-channel-injection-token";
|
||||
import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
|
||||
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
|
||||
import type { JsonPrimitive } from "type-fest";
|
||||
import { computedChannelObserverInjectionToken } from "./computed-channel.injectable";
|
||||
import { getMessageChannel } from "../message/get-message-channel";
|
||||
import { getMessageChannel } from "@k8slens/messaging";
|
||||
|
||||
export type JsonifiableObject = { [Key in string]?: Jsonifiable } | { toJSON: () => Jsonifiable };
|
||||
export type JsonifiableArray = readonly Jsonifiable[];
|
||||
@ -10,9 +10,9 @@ import {
|
||||
runInAction,
|
||||
} from "mobx";
|
||||
|
||||
import type { MessageChannel } from "../message/message-channel-listener-injection-token";
|
||||
import { getMessageChannelListenerInjectable } from "../message/message-channel-listener-injection-token";
|
||||
import { sendMessageToChannelInjectionToken } from "../message/message-to-channel-injection-token";
|
||||
import type { MessageChannel } from "@k8slens/messaging";
|
||||
import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
|
||||
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
|
||||
import type { JsonPrimitive } from "type-fest";
|
||||
import { computedChannelAdministrationChannel } from "./computed-channel-administration-channel.injectable";
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
import React from "react";
|
||||
import { act } from "@testing-library/react";
|
||||
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
||||
import {
|
||||
getMessageBridgeFake,
|
||||
MessageBridgeFake,
|
||||
} from "@k8slens/messaging-fake-bridge";
|
||||
import { getMessageBridgeFake, MessageBridgeFake } from "@k8slens/messaging-fake-bridge";
|
||||
import { startApplicationInjectionToken } from "@k8slens/application";
|
||||
import {
|
||||
computed,
|
||||
@ -14,11 +11,11 @@ import {
|
||||
reaction,
|
||||
runInAction,
|
||||
} from "mobx";
|
||||
import type { MessageChannel } from "../message/message-channel-listener-injection-token";
|
||||
import { getMessageChannelListenerInjectable } from "../message/message-channel-listener-injection-token";
|
||||
import type { MessageChannel } from "@k8slens/messaging";
|
||||
import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { registerFeature } from "@k8slens/feature-core";
|
||||
import { messagingFeatureForUnitTesting } from "../../unit-testing";
|
||||
import { testUtils } from "@k8slens/messaging";
|
||||
import {
|
||||
computedChannelInjectionToken,
|
||||
computedChannelObserverInjectionToken,
|
||||
@ -29,6 +26,7 @@ import {
|
||||
computedChannelAdministrationChannel,
|
||||
ComputedChannelAdminMessage,
|
||||
} from "./computed-channel-administration-channel.injectable";
|
||||
import { computedChannelFeature } from "../feature";
|
||||
|
||||
const testChannel: MessageChannel<string> = { id: "some-channel-id" };
|
||||
const testChannel2: MessageChannel<string> = { id: "some-other-channel-id" };
|
||||
@ -76,8 +74,10 @@ const TestComponent = observer(({ someComputed }: { someComputed: IComputedValue
|
||||
});
|
||||
|
||||
runInAction(() => {
|
||||
registerFeature(di1, messagingFeatureForUnitTesting);
|
||||
registerFeature(di2, messagingFeatureForUnitTesting);
|
||||
const messagingFeature = testUtils.messagingFeatureForUnitTesting;
|
||||
|
||||
registerFeature(di1, messagingFeature, computedChannelFeature);
|
||||
registerFeature(di2, messagingFeature, computedChannelFeature);
|
||||
|
||||
di1.register(channelValueTestListenerInjectable);
|
||||
di2.register(administrationChannelTestListenerInjectable);
|
||||
@ -0,0 +1,18 @@
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
import { getFeature } from "@k8slens/feature-core";
|
||||
import { messagingFeature } from "@k8slens/messaging";
|
||||
|
||||
export const computedChannelFeature = getFeature({
|
||||
id: "computed-channel",
|
||||
|
||||
dependencies: [messagingFeature],
|
||||
|
||||
register: (di) => {
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
|
||||
getRequireContexts: () => [require.context("./", true, /\.injectable\.(ts|tsx)$/)],
|
||||
});
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts", "**/*.tsx"]
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForNode;
|
||||
Loading…
Reference in New Issue
Block a user