@lerna/create-symlink
Advanced tools
+13
-0
@@ -6,2 +6,15 @@ # Change Log | ||
| ## [3.16.2](https://github.com/lerna/lerna/compare/v3.16.1...v3.16.2) (2019-07-22) | ||
| ### Bug Fixes | ||
| * **create-symlink:** Generate shims for missing bin scripts for Windows ([c3f7998](https://github.com/lerna/lerna/commit/c3f7998)) | ||
| * **create-symlink:** Use octal notation for chmod values ([03f80b7](https://github.com/lerna/lerna/commit/03f80b7)) | ||
| * **deps:** Switch to actively-maintained `@zkochan/cmd-shim` ([60d1100](https://github.com/lerna/lerna/commit/60d1100)) | ||
| # [3.16.0](https://github.com/lerna/lerna/compare/v3.15.0...v3.16.0) (2019-07-18) | ||
@@ -8,0 +21,0 @@ |
+32
-21
| "use strict"; | ||
| const cmdShim = require("cmd-shim"); | ||
| const cmdShim = require("@zkochan/cmd-shim"); | ||
| const fs = require("fs-extra"); | ||
@@ -32,14 +32,15 @@ const log = require("npmlog"); | ||
| function createPosixSymlink(origin, dest, _type) { | ||
| function createPosixSymlink(src, dest, _type) { | ||
| const type = _type === "exec" ? "file" : _type; | ||
| const relativeSymlink = path.relative(path.dirname(dest), origin); | ||
| const relativeSymlink = path.relative(path.dirname(dest), src); | ||
| if (_type === "exec") { | ||
| // If the target exists, create real symlink. If the target doesn't exist yet, | ||
| // create a shim shell script. | ||
| return fs.pathExists(origin).then(exists => { | ||
| // If the src exists, create a real symlink. | ||
| // If the src doesn't exist yet, create a shim shell script. | ||
| return fs.pathExists(src).then(exists => { | ||
| if (exists) { | ||
| return createSymbolicLink(relativeSymlink, dest, type).then(() => fs.chmod(origin, "755")); | ||
| return createSymbolicLink(relativeSymlink, dest, type).then(() => fs.chmod(src, 0o755)); | ||
| } | ||
| return shShim(origin, dest, type).then(() => fs.chmod(dest, "755")); | ||
| return shShim(src, dest, type).then(() => fs.chmod(dest, 0o755)); | ||
| }); | ||
@@ -53,10 +54,21 @@ } | ||
| if (type === "exec") { | ||
| return new Promise((resolve, reject) => { | ||
| cmdShim(src, dest, err => { | ||
| if (err) { | ||
| reject(err); | ||
| } else { | ||
| resolve(); | ||
| } | ||
| }); | ||
| // If the src exists, shim directly. | ||
| // If the src doesn't exist yet, create a temp src so cmd-shim doesn't explode. | ||
| return fs.pathExists(src).then(exists => { | ||
| if (exists) { | ||
| return cmdShim(src, dest); | ||
| } | ||
| return fs | ||
| .outputFile(src, "") | ||
| .then(() => cmdShim(src, dest)) | ||
| .then( | ||
| // fs.remove() never rejects | ||
| () => fs.remove(src), | ||
| err => | ||
| fs.remove(src).then(() => { | ||
| // clean up, but don't swallow error | ||
| throw err; | ||
| }) | ||
| ); | ||
| }); | ||
@@ -68,10 +80,9 @@ } | ||
| function shShim(target, script, type) { | ||
| log.silly("shShim", [target, script, type]); | ||
| function shShim(src, dest, type) { | ||
| log.silly("shShim", [src, dest, type]); | ||
| const absTarget = path.resolve(path.dirname(script), target); | ||
| const absTarget = path.resolve(path.dirname(dest), src); | ||
| const scriptLines = ["#!/bin/sh", `chmod +x ${absTarget} && exec ${absTarget} "$@"`]; | ||
| return fs.writeFile(script, scriptLines.join("\n")); | ||
| return fs.writeFile(dest, scriptLines.join("\n")); | ||
| } |
+3
-3
| { | ||
| "name": "@lerna/create-symlink", | ||
| "version": "3.16.0", | ||
| "version": "3.16.2", | ||
| "description": "An internal Lerna tool", | ||
@@ -34,7 +34,7 @@ "keywords": [ | ||
| "dependencies": { | ||
| "cmd-shim": "^2.0.2", | ||
| "@zkochan/cmd-shim": "^3.1.0", | ||
| "fs-extra": "^8.1.0", | ||
| "npmlog": "^4.1.2" | ||
| }, | ||
| "gitHead": "8ca18bedecf4f141c6242a099086e84b2ced72de" | ||
| "gitHead": "d4b1a0e48d1ff241fafa268dbe57256e10f2cdc8" | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
7162
13.34%68
17.24%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed