1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Move run-many and run-many-sync to separate package

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-03-02 09:41:36 -05:00
parent 4fe106610a
commit 3a2e436933
12 changed files with 50 additions and 7 deletions

View File

@ -0,0 +1,3 @@
# @k8slens/run-many
This package contains the functions `runMany` and `runManySync`

View File

@ -0,0 +1,2 @@
export * from "./src/run-many-for";
export * from "./src/run-many-sync-for";

View File

@ -0,0 +1,2 @@
module.exports =
require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact;

View File

@ -0,0 +1,33 @@
{
"name": "@k8slens/run-many",
"version": "1.0.0",
"type": "commonjs",
"description": "A package containing runMany and runManySync",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"private": false,
"files": [
"dist"
],
"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": "jest --coverage --runInBand"
},
"peerDependencies": {
"@k8slens/test-utils": "^1.0.0",
"@k8slens/utilities": "^1.0.0",
"@ogre-tools/fp": "^15.1.1",
"@ogre-tools/injectable": "^15.1.1"
}
}

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainerForInjection, InjectionInstanceWithMeta } from "@ogre-tools/injectable";
import { getOrInsertSetFor, isDefined } from "../utils";
import { getOrInsertSetFor, isDefined } from "@k8slens/utilities";
import * as uuid from "uuid";
import assert from "assert";
import type { Runnable, RunnableSync, RunnableSyncWithId, RunnableWithId } from "./types";

View File

@ -7,9 +7,8 @@ import asyncFn from "@async-fn/jest";
import { createContainer, getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import type { Runnable } from "./types";
import { runManyFor } from "./run-many-for";
import { getPromiseStatus } from "../test-utils/get-promise-status";
import { getPromiseStatus, flushPromises } from "@k8slens/test-utils";
import { runInAction } from "mobx";
import { flushPromises } from "../test-utils/flush-promises";
describe("runManyFor", () => {
describe("given no hierarchy, when running many", () => {

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainerForInjection, InjectionToken } from "@ogre-tools/injectable";
import { getOrInsert } from "../utils";
import { getOrInsert } from "@k8slens/utilities";
import type TypedEventEmitter from "typed-emitter";
import EventEmitter from "events";
import { convertToWithIdWith, verifyRunnablesAreDAG } from "./helpers";
@ -21,7 +21,7 @@ class DynamicBarrier {
private readonly events: TypedEventEmitter<BarrierEvent> = new EventEmitter();
private initFinishingPromise(id: string): Promise<void> {
return getOrInsert(this.finishedIds, id, new Promise(resolve => {
return getOrInsert(this.finishedIds, id, new Promise<void>(resolve => {
const handler = (finishedId: string) => {
if (finishedId === id) {
resolve();

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { DiContainerForInjection, InjectionToken } from "@ogre-tools/injectable";
import type { Disposer } from "../utils";
import type { Disposer } from "@k8slens/utilities";
import type { RunnableSync, RunSync, RunnableSyncWithId } from "./types";
import { convertToWithIdWith, verifyRunnablesAreDAG } from "./helpers";
import type TypedEventEmitter from "typed-emitter";

View File

@ -4,7 +4,7 @@
*/
import type { Injectable } from "@ogre-tools/injectable";
import type { SingleOrMany } from "../utils";
import type { SingleOrMany } from "@k8slens/utilities";
export type Run<Param> = (parameter: Param) => Promise<void> | void;

View File

@ -0,0 +1,3 @@
{
"extends": "@k8slens/typescript/config/base.json"
}

View File

@ -0,0 +1 @@
module.exports = require("@k8slens/webpack").configForNode;