@teambit/dependencies.fs.linked-dependencies
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,1 +0,7 @@ | ||
export declare function createLinks(rootDir: string, linkedDeps: Record<string, string>): Promise<void>; | ||
declare type CreateLinksOpts = { | ||
componentId?: string | null | undefined; | ||
avoidHardLink?: boolean; | ||
skipIfSymlinkValid?: boolean; | ||
}; | ||
export declare function createLinks(rootDir: string, linkedDeps: Record<string, string>, opts?: CreateLinksOpts): Promise<void>; | ||
export {}; |
@@ -18,6 +18,6 @@ "use strict"; | ||
const utils_1 = require("@teambit/legacy/dist/utils"); | ||
function createLinks(rootDir, linkedDeps) { | ||
function createLinks(rootDir, linkedDeps, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const modulesDir = path_1.default.join(rootDir, 'node_modules'); | ||
yield Promise.all(Object.entries(linkedDeps).map(([packageName, linkPath]) => (0, utils_1.createSymlinkOrCopy)(linkPath.substring(5), path_1.default.join(modulesDir, packageName)))); | ||
yield Promise.all(Object.entries(linkedDeps).map(([packageName, linkPath]) => (0, utils_1.createSymlinkOrCopy)(linkPath.substring(5), path_1.default.join(modulesDir, packageName), opts.componentId, opts.avoidHardLink, opts.skipIfSymlinkValid))); | ||
}); | ||
@@ -24,0 +24,0 @@ } |
import path from 'path'; | ||
import { createSymlinkOrCopy } from '@teambit/legacy/dist/utils'; | ||
export async function createLinks(rootDir: string, linkedDeps: Record<string, string>) { | ||
type CreateLinksOpts = { | ||
componentId?: string | null | undefined; | ||
avoidHardLink?: boolean; | ||
skipIfSymlinkValid?: boolean; | ||
}; | ||
export async function createLinks(rootDir: string, linkedDeps: Record<string, string>, opts: CreateLinksOpts = {}) { | ||
const modulesDir = path.join(rootDir, 'node_modules'); | ||
await Promise.all( | ||
Object.entries(linkedDeps).map(([packageName, linkPath]) => | ||
createSymlinkOrCopy(linkPath.substring(5), path.join(modulesDir, packageName)) | ||
createSymlinkOrCopy( | ||
linkPath.substring(5), | ||
path.join(modulesDir, packageName), | ||
opts.componentId, | ||
opts.avoidHardLink, | ||
opts.skipIfSymlinkValid | ||
) | ||
) | ||
); | ||
} |
{ | ||
"name": "@teambit/dependencies.fs.linked-dependencies", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://bit.cloud/teambit/dependencies/fs/linked-dependencies", | ||
"main": "dist/index.js", | ||
@@ -8,3 +9,3 @@ "componentId": { | ||
"name": "fs/linked-dependencies", | ||
"version": "0.0.1" | ||
"version": "0.0.2" | ||
}, | ||
@@ -11,0 +12,0 @@ "dependencies": {}, |
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
11425
18
190
1