@lerna/symlink-dependencies
Advanced tools
Comparing version 3.17.0 to 4.0.0
@@ -6,2 +6,34 @@ # Change Log | ||
# [4.0.0](https://github.com/lerna/lerna/compare/v3.22.1...v4.0.0) (2021-02-10) | ||
### Features | ||
* **deps:** Bump dependencies ([affed1c](https://github.com/lerna/lerna/commit/affed1ce0fce91f01b0a9eafe357db2d985b974f)) | ||
* Consume named exports of sibling modules ([63499e3](https://github.com/lerna/lerna/commit/63499e33652bc78fe23751875d74017e2f16a689)) | ||
* Expose named export ([c1303f1](https://github.com/lerna/lerna/commit/c1303f13adc4cf15f96ff25889b52149f8224c0e)) | ||
* Remove default export ([e2f1ec3](https://github.com/lerna/lerna/commit/e2f1ec3dd049d2a89880029908a2aa7c66f15082)) | ||
* **deps:** fs-extra@^9.0.1 ([2f6f4e0](https://github.com/lerna/lerna/commit/2f6f4e066d5a41b4cd508b3405ac1d0a342932dc)) | ||
* **deps:** p-finally -> Promise.prototype.finally() ([028db04](https://github.com/lerna/lerna/commit/028db045b1221df000a2b98c5dceb1e4915a7806)) | ||
* **deps:** p-finally@^2.0.1 ([165e47e](https://github.com/lerna/lerna/commit/165e47e722acf6462cf0b4e3a7d0e14d3971e7fb)) | ||
* **deps:** p-map-series@^2.1.0 ([7f68076](https://github.com/lerna/lerna/commit/7f680767e0b3c7a15f951c51d4975150fb6e9112)) | ||
* **deps:** p-map@^4.0.0 ([92b1364](https://github.com/lerna/lerna/commit/92b1364735e1f2cf379cf1047c60c4fb897d55f5)) | ||
* Drop support for Node v6.x & v8.x ([ff4bb4d](https://github.com/lerna/lerna/commit/ff4bb4da215555e3bb136f5af09b5cbc631e57bb)) | ||
### BREAKING CHANGES | ||
* The default export has been removed, please use a named export instead. | ||
* Node v6.x & v8.x are no longer supported. Please upgrade to the latest LTS release. | ||
Here's the gnarly one-liner I used to make these changes: | ||
``` | ||
npx lerna exec --concurrency 1 --stream -- 'json -I -f package.json -e '"'"'this.engines=this.engines||{};this.engines.node=">= 10.18.0"'"'" | ||
``` | ||
(requires `npm i -g json` beforehand) | ||
# [3.17.0](https://github.com/lerna/lerna/compare/v3.16.5...v3.17.0) (2019-10-10) | ||
@@ -8,0 +40,0 @@ |
{ | ||
"name": "@lerna/symlink-dependencies", | ||
"version": "3.17.0", | ||
"version": "4.0.0", | ||
"description": "Lerna's internal symlinking tool", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">= 6.9.0" | ||
"node": ">= 10.18.0" | ||
}, | ||
@@ -35,11 +35,10 @@ "publishConfig": { | ||
"dependencies": { | ||
"@lerna/create-symlink": "3.16.2", | ||
"@lerna/resolve-symlink": "3.16.0", | ||
"@lerna/symlink-binary": "3.17.0", | ||
"fs-extra": "^8.1.0", | ||
"p-finally": "^1.0.0", | ||
"p-map": "^2.1.0", | ||
"p-map-series": "^1.0.0" | ||
"@lerna/create-symlink": "4.0.0", | ||
"@lerna/resolve-symlink": "4.0.0", | ||
"@lerna/symlink-binary": "4.0.0", | ||
"fs-extra": "^9.1.0", | ||
"p-map": "^4.0.0", | ||
"p-map-series": "^2.1.0" | ||
}, | ||
"gitHead": "bffa7f228fd5acd240dfea8d3e757040dbe4ca1b" | ||
"gitHead": "4582c476e07dddddd6b2e3ab6e7f52c1f9eed59a" | ||
} |
"use strict"; | ||
const fs = require("fs-extra"); | ||
const pFinally = require("p-finally"); | ||
const pMap = require("p-map"); | ||
@@ -9,7 +8,7 @@ const pMapSeries = require("p-map-series"); | ||
const createSymlink = require("@lerna/create-symlink"); | ||
const resolveSymlink = require("@lerna/resolve-symlink"); | ||
const symlinkBinary = require("@lerna/symlink-binary"); | ||
const { createSymlink } = require("@lerna/create-symlink"); | ||
const { resolveSymlink } = require("@lerna/resolve-symlink"); | ||
const { symlinkBinary } = require("@lerna/symlink-binary"); | ||
module.exports = symlinkDependencies; | ||
module.exports.symlinkDependencies = symlinkDependencies; | ||
@@ -33,66 +32,63 @@ /** | ||
return pFinally( | ||
pMapSeries(nodes, currentNode => { | ||
const currentName = currentNode.name; | ||
const currentNodeModules = currentNode.pkg.nodeModulesLocation; | ||
return pMapSeries(nodes, (currentNode) => { | ||
const currentName = currentNode.name; | ||
const currentNodeModules = currentNode.pkg.nodeModulesLocation; | ||
return pMap(currentNode.localDependencies, ([dependencyName, resolved]) => { | ||
if (resolved.type === "directory") { | ||
// a local file: specifier is already a symlink | ||
return; | ||
} | ||
return pMap(currentNode.localDependencies, ([dependencyName, resolved]) => { | ||
if (resolved.type === "directory") { | ||
// a local file: specifier is already a symlink | ||
return; | ||
} | ||
// get PackageGraphNode of dependency | ||
// const dependencyName = resolved.name; | ||
const dependencyNode = packageGraph.get(dependencyName); | ||
const targetDirectory = path.join(currentNodeModules, dependencyName); | ||
// get PackageGraphNode of dependency | ||
// const dependencyName = resolved.name; | ||
const dependencyNode = packageGraph.get(dependencyName); | ||
const targetDirectory = path.join(currentNodeModules, dependencyName); | ||
let chain = Promise.resolve(); | ||
let chain = Promise.resolve(); | ||
// check if dependency is already installed | ||
chain = chain.then(() => fs.pathExists(targetDirectory)); | ||
chain = chain.then(dirExists => { | ||
if (dirExists) { | ||
const isDepSymlink = resolveSymlink(targetDirectory); | ||
// check if dependency is already installed | ||
chain = chain.then(() => fs.pathExists(targetDirectory)); | ||
chain = chain.then((dirExists) => { | ||
if (dirExists) { | ||
const isDepSymlink = resolveSymlink(targetDirectory); | ||
if (isDepSymlink !== false && isDepSymlink !== dependencyNode.location) { | ||
// installed dependency is a symlink pointing to a different location | ||
tracker.warn( | ||
"EREPLACE_OTHER", | ||
`Symlink already exists for ${dependencyName} dependency of ${currentName}, ` + | ||
"but links to different location. Replacing with updated symlink..." | ||
); | ||
} else if (isDepSymlink === false) { | ||
// installed dependency is not a symlink | ||
tracker.warn( | ||
"EREPLACE_EXIST", | ||
`${dependencyName} is already installed for ${currentName}. Replacing with symlink...` | ||
); | ||
if (isDepSymlink !== false && isDepSymlink !== dependencyNode.location) { | ||
// installed dependency is a symlink pointing to a different location | ||
tracker.warn( | ||
"EREPLACE_OTHER", | ||
`Symlink already exists for ${dependencyName} dependency of ${currentName}, ` + | ||
"but links to different location. Replacing with updated symlink..." | ||
); | ||
} else if (isDepSymlink === false) { | ||
// installed dependency is not a symlink | ||
tracker.warn( | ||
"EREPLACE_EXIST", | ||
`${dependencyName} is already installed for ${currentName}. Replacing with symlink...` | ||
); | ||
// remove installed dependency | ||
return fs.remove(targetDirectory); | ||
} | ||
} else { | ||
// ensure destination directory exists (dealing with scoped subdirs) | ||
return fs.ensureDir(path.dirname(targetDirectory)); | ||
// remove installed dependency | ||
return fs.remove(targetDirectory); | ||
} | ||
}); | ||
} else { | ||
// ensure destination directory exists (dealing with scoped subdirs) | ||
return fs.ensureDir(path.dirname(targetDirectory)); | ||
} | ||
}); | ||
// create package symlink | ||
const dependencyLocation = dependencyNode.pkg.contents | ||
? path.resolve(dependencyNode.location, dependencyNode.pkg.contents) | ||
: dependencyNode.location; | ||
chain = chain.then(() => createSymlink(dependencyLocation, targetDirectory, "junction")); | ||
// create package symlink | ||
const dependencyLocation = dependencyNode.pkg.contents | ||
? path.resolve(dependencyNode.location, dependencyNode.pkg.contents) | ||
: dependencyNode.location; | ||
chain = chain.then(() => createSymlink(dependencyLocation, targetDirectory, "junction")); | ||
// TODO: pass PackageGraphNodes directly instead of Packages | ||
chain = chain.then(() => symlinkBinary(dependencyNode.pkg, currentNode.pkg)); | ||
// TODO: pass PackageGraphNodes directly instead of Packages | ||
chain = chain.then(() => symlinkBinary(dependencyNode.pkg, currentNode.pkg)); | ||
return chain; | ||
}).then(() => { | ||
tracker.silly("actions", "finished", currentName); | ||
tracker.completeWork(1); | ||
}); | ||
}), | ||
() => tracker.finish() | ||
); | ||
return chain; | ||
}).then(() => { | ||
tracker.silly("actions", "finished", currentName); | ||
tracker.completeWork(1); | ||
}); | ||
}).finally(() => tracker.finish()); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11764
6
77
+ Added@babel/code-frame@7.24.7(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/highlight@7.24.7(transitive)
+ Added@lerna/create-symlink@4.0.0(transitive)
+ Added@lerna/package@4.0.0(transitive)
+ Added@lerna/resolve-symlink@4.0.0(transitive)
+ Added@lerna/symlink-binary@4.0.0(transitive)
+ Addedaggregate-error@3.1.0(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedclean-stack@2.2.0(transitive)
+ Addedcmd-shim@4.1.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhosted-git-info@4.1.0(transitive)
+ Addedindent-string@4.0.0(transitive)
+ Addedinfer-owner@1.0.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedload-json-file@6.2.0(transitive)
+ Addedlru-cache@6.0.0(transitive)
+ Addedmake-dir@2.1.0(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedmkdirp-infer-owner@2.0.0(transitive)
+ Addednpm-package-arg@8.1.5(transitive)
+ Addedp-map@4.0.0(transitive)
+ Addedp-map-series@2.1.0(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpicocolors@1.1.0(transitive)
+ Addedread-cmd-shim@2.0.0(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedstrip-bom@4.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedtype-fest@0.4.10.6.0(transitive)
+ Addeduniversalify@2.0.1(transitive)
+ Addedwrite-json-file@3.2.0(transitive)
+ Addedwrite-pkg@4.0.0(transitive)
+ Addedyallist@4.0.0(transitive)
- Removedp-finally@^1.0.0
- Removed@lerna/create-symlink@3.16.2(transitive)
- Removed@lerna/package@3.16.0(transitive)
- Removed@lerna/resolve-symlink@3.16.0(transitive)
- Removed@lerna/symlink-binary@3.17.0(transitive)
- Removed@zkochan/cmd-shim@3.1.0(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedjson-parse-better-errors@1.0.2(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedload-json-file@5.3.0(transitive)
- Removedmake-dir@1.3.0(transitive)
- Removedmkdirp@3.0.1(transitive)
- Removedmkdirp-promise@5.0.1(transitive)
- Removedmz@2.7.0(transitive)
- Removednpm-package-arg@6.1.1(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-map@2.1.0(transitive)
- Removedp-map-series@1.0.0(transitive)
- Removedp-reduce@1.0.0(transitive)
- Removedparse-json@4.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedread-cmd-shim@1.0.5(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedtype-fest@0.3.1(transitive)
- Removeduniversalify@0.1.2(transitive)
- Removedwrite-json-file@2.3.0(transitive)
- Removedwrite-pkg@3.2.0(transitive)
Updated@lerna/create-symlink@4.0.0
Updated@lerna/resolve-symlink@4.0.0
Updated@lerna/symlink-binary@4.0.0
Updatedfs-extra@^9.1.0
Updatedp-map@^4.0.0
Updatedp-map-series@^2.1.0