WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a0b77ba

Browse files
authored
refactor: adopt withProject typing
2 parents da30824 + e9cc50a commit a0b77ba

File tree

1 file changed

+8
-9
lines changed
  • packages/node-cli-testing/cli-project/src/lib

1 file changed

+8
-9
lines changed

packages/node-cli-testing/cli-project/src/lib/utils.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as fs from 'fs';
2-
import { ProcessParams, ProjectConfig } from './types';
2+
import {ProcessParams, ProjectConfig} from './types';
33
import * as path from 'path';
44
import {CliProjectFactory} from "./factory";
55
import {CliProject} from "./cli";
@@ -48,13 +48,12 @@ export function processParamsToParamsArray(params: ProcessParams): string[] {
4848
}
4949

5050
export function withProject<T extends {}>(
51-
cfg: any,
52-
fn: (prj: unknown) => Promise<void>,
53-
factory: Record<'create', (cfg: ProjectConfig<T>) => Promise<CliProject<T>>> = CliProjectFactory
51+
cfg: ProjectConfig<T>,
52+
fn: (prj: CliProject<T>) => Promise<void>,
53+
factory: (cfg: ProjectConfig<T>) => Promise<CliProject<T>> = CliProjectFactory.create
5454
): () => Promise<void> { return async () => {
55-
let prj = await factory.create(cfg);
56-
await prj.setup();
57-
await fn(prj).finally(() => prj.teardown());
58-
}
55+
let prj = await factory(cfg);
56+
await prj.setup();
57+
await fn(prj).finally(() => prj.teardown());
58+
}
5959
}
60-

0 commit comments

Comments
 (0)