1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/infrastructure/lens-link/src/get-missing-package-jsons-for.ts
Janne Savolainen 3c9abdb015 feat: Implement first draft of better NPM-linking script
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>
2023-04-21 09:11:11 +03:00

14 lines
506 B
TypeScript

import type { Exists } from "./lens-link";
import { pipeline } from "@ogre-tools/fp";
import { map, filter } from "lodash/fp";
import { awaitAll } from "./await-all";
export const getMissingPackageJsonsFor = (exists: Exists) => async (packageJsonPaths: string[]) =>
pipeline(
packageJsonPaths,
map(async (packageJsonPath) => ({ packageJsonPath, exists: await exists(packageJsonPath) })),
awaitAll,
filter(({ exists }) => !exists),
map(({ packageJsonPath }) => packageJsonPath),
);