@lerna/create-symlink
Advanced tools
Comparing version 3.13.0 to 3.14.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.14.0](https://github.com/lerna/lerna/compare/v3.13.4...v3.14.0) (2019-05-14) | ||
### Features | ||
* **link:** generate shims for missing 'bin' scripts ([#2059](https://github.com/lerna/lerna/issues/2059)) ([90acdde](https://github.com/lerna/lerna/commit/90acdde)), closes [#1444](https://github.com/lerna/lerna/issues/1444) | ||
# [3.13.0](https://github.com/lerna/lerna/compare/v3.12.1...v3.13.0) (2019-02-15) | ||
@@ -8,0 +19,0 @@ |
@@ -34,5 +34,16 @@ "use strict"; | ||
const type = _type === "exec" ? "file" : _type; | ||
const src = path.relative(path.dirname(dest), origin); | ||
const relativeSymlink = path.relative(path.dirname(dest), origin); | ||
return createSymbolicLink(src, dest, type); | ||
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 (exists) { | ||
return createSymbolicLink(relativeSymlink, dest, type).then(() => fs.chmod(origin, "755")); | ||
} | ||
return shShim(origin, dest, type).then(() => fs.chmod(dest, "755")); | ||
}); | ||
} | ||
return createSymbolicLink(relativeSymlink, dest, type); | ||
} | ||
@@ -55,1 +66,11 @@ | ||
} | ||
function shShim(target, script, type) { | ||
log.silly("shShim", [target, script, type]); | ||
const absTarget = path.resolve(path.dirname(script), target); | ||
const scriptLines = ["#!/bin/sh", `chmod +x ${absTarget} && exec ${absTarget} "$@"`]; | ||
return fs.writeFile(script, scriptLines.join("\n")); | ||
} |
{ | ||
"name": "@lerna/create-symlink", | ||
"version": "3.13.0", | ||
"version": "3.14.0", | ||
"description": "An internal Lerna tool", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9a47201f3fdd1df09cfb1922f26329d1dc4c8cc5" | ||
"gitHead": "39da145c67ea587457694f318f32f967b9d66ea9" | ||
} |
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
6127
58