Socket
Socket
Sign inDemoInstall

@lerna/create-symlink

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/create-symlink - npm Package Compare versions

Comparing version 3.16.0 to 3.16.2

13

CHANGELOG.md

@@ -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 @@

53

create-symlink.js
"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"));
}
{
"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"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc