Socket
Socket
Sign inDemoInstall

turbo

Package Overview
Dependencies
Maintainers
3
Versions
506
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turbo - npm Package Compare versions

Comparing version 1.10.6 to 1.10.12

72

install.js

@@ -7,3 +7,2 @@ // Most of this file is ripped from esbuild

const fs = require("fs");
const os = require("os");
const path = require("path");

@@ -21,3 +20,2 @@ const zlib = require("zlib");

const toPath = path.join(__dirname, "bin", "turbo");
const goToPath = path.join(__dirname, "bin", "go-turbo");
let isToPathJS = true;

@@ -55,10 +53,2 @@

function isYarn() {
const { npm_config_user_agent } = process.env;
if (npm_config_user_agent) {
return /\byarn\//.test(npm_config_user_agent);
}
return false;
}
function fetch(url) {

@@ -174,62 +164,2 @@ return new Promise((resolve, reject) => {

function maybeOptimizePackage(binPath) {
// Everything else that this installation does is fine, but the optimization
// step rewrites existing files. We need to make sure that this does not
// happen during development. We determine that by looking for a file in
// the package that is not published in the `npm` registry.
if (fs.existsSync(path.join(__dirname, ".dev-mode"))) {
return;
}
// This package contains a "bin/turbo" JavaScript file that finds and runs
// the appropriate binary executable. However, this means that running the
// "turbo" command runs another instance of "node" which is way slower than
// just running the binary executable directly.
//
// Here we optimize for this by replacing the JavaScript file with the binary
// executable at install time. This optimization does not work on Windows
// because on Windows the binary executable must be called "turbo.exe"
// instead of "turbo".
//
// This also doesn't work with Yarn both because of lack of support for binary
// files in Yarn 2+ (see https://github.com/yarnpkg/berry/issues/882) and
// because Yarn (even Yarn 1?) may run the same install scripts in the same
// place multiple times from different platforms, especially when people use
// Docker. Avoid idempotency issues by just not optimizing when using Yarn.
//
// This optimization also doesn't apply when npm's "--ignore-scripts" flag is
// used since in that case this install script will not be run.
if (os.platform() !== "win32" && !isYarn()) {
const optimizeBin = (from, to, temp) => {
const tempPath = path.join(__dirname, temp);
try {
// First link the binary with a temporary file. If this fails and throws an
// error, then we'll just end up doing nothing. This uses a hard link to
// avoid taking up additional space on the file system.
fs.linkSync(from, tempPath);
// Then use rename to atomically replace the target file with the temporary
// file. If this fails and throws an error, then we'll just end up leaving
// the temporary file there, which is harmless.
fs.renameSync(tempPath, to);
// If we get here, then we know that the target location is now a binary
// executable instead of a JavaScript file.
isToPathJS = false;
// If this install script is being re-run, then "renameSync" will fail
// since the underlying inode is the same (it just returns without doing
// anything, and without throwing an error). In that case we should remove
// the file manually.
fs.unlinkSync(tempPath);
} catch {
// Ignore errors here since this optimization is optional
}
};
const goBinPath = path.join(path.dirname(binPath), "go-turbo");
optimizeBin(goBinPath, goToPath, "bin-go-turbo");
optimizeBin(binPath, toPath, "bin-turbo");
}
}
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {

@@ -310,4 +240,2 @@ // If that fails, the user could have npm configured incorrectly or could not

}
maybeOptimizePackage(binPath);
}

@@ -314,0 +242,0 @@

14

package.json
{
"name": "turbo",
"version": "1.10.6",
"version": "1.10.12",
"description": "Turborepo is a high-performance build system for JavaScript and TypeScript codebases.",

@@ -19,8 +19,8 @@ "repository": "https://github.com/vercel/turbo",

"optionalDependencies": {
"turbo-darwin-64": "1.10.6",
"turbo-darwin-arm64": "1.10.6",
"turbo-linux-64": "1.10.6",
"turbo-linux-arm64": "1.10.6",
"turbo-windows-64": "1.10.6",
"turbo-windows-arm64": "1.10.6"
"turbo-darwin-64": "1.10.12",
"turbo-darwin-arm64": "1.10.12",
"turbo-linux-64": "1.10.12",
"turbo-linux-arm64": "1.10.12",
"turbo-windows-64": "1.10.12",
"turbo-windows-arm64": "1.10.12"
},

@@ -27,0 +27,0 @@ "scripts": {

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