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:
parent
4fe106610a
commit
3a2e436933
3
packages/utility-features/run-many/README.md
Normal file
3
packages/utility-features/run-many/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# @k8slens/run-many
|
||||
|
||||
This package contains the functions `runMany` and `runManySync`
|
||||
2
packages/utility-features/run-many/index.ts
Normal file
2
packages/utility-features/run-many/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./src/run-many-for";
|
||||
export * from "./src/run-many-sync-for";
|
||||
2
packages/utility-features/run-many/jest.config.js
Normal file
2
packages/utility-features/run-many/jest.config.js
Normal file
@ -0,0 +1,2 @@
|
||||
module.exports =
|
||||
require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact;
|
||||
33
packages/utility-features/run-many/package.json
Normal file
33
packages/utility-features/run-many/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
@ -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";
|
||||
@ -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", () => {
|
||||
@ -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();
|
||||
@ -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";
|
||||
@ -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;
|
||||
|
||||
3
packages/utility-features/run-many/tsconfig.json
Normal file
3
packages/utility-features/run-many/tsconfig.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json"
|
||||
}
|
||||
1
packages/utility-features/run-many/webpack.config.js
Normal file
1
packages/utility-features/run-many/webpack.config.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForNode;
|
||||
Loading…
Reference in New Issue
Block a user