mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
It's better because it doesn't suffer from npm link's habit of bringing in node_modules of link target, which breaks peer dependencies. Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
20 lines
743 B
TypeScript
20 lines
743 B
TypeScript
import { awaitAll } from "./await-all";
|
|
import type { GetLensLinkDirectory } from "./get-lens-link-directory";
|
|
import type { EnsureDirectory } from "./lens-link";
|
|
import { pipeline } from "@ogre-tools/fp";
|
|
import { map } from "lodash/fp";
|
|
import type { PackageJsonAndPath } from "./package-json-and-path";
|
|
|
|
export type CreateLensLinkDirectories = (packageJsons: PackageJsonAndPath[]) => Promise<void>;
|
|
|
|
export const createLensLinkDirectoriesFor =
|
|
(getLensLinkDirectory: GetLensLinkDirectory, ensureDirectory: EnsureDirectory) =>
|
|
async (packageJsons: PackageJsonAndPath[]) => {
|
|
await pipeline(
|
|
packageJsons,
|
|
map(({ content: { name } }) => getLensLinkDirectory(name)),
|
|
map(ensureDirectory),
|
|
awaitAll,
|
|
);
|
|
};
|