Merge pull request #201937 from panda2134/master
netlify-cli: 6.13.2 -> 12.2.4, esbuild_netlify: 0.13.6 -> 0.14.39
This commit is contained in:
commit
d08a22c7ce
|
@ -1402,6 +1402,14 @@ services.github-runner.serviceOverrides.SupplementaryGroups = [
|
||||||
for more details.
|
for more details.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The <literal>netlify-cli</literal> package has been updated
|
||||||
|
from 6.13.2 to 12.2.4, see the
|
||||||
|
<link xlink:href="https://github.com/netlify/cli/releases">changelog</link>
|
||||||
|
for more details.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<literal>dockerTools.buildImage</literal> deprecates the
|
<literal>dockerTools.buildImage</literal> deprecates the
|
||||||
|
|
|
@ -452,6 +452,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
|
||||||
|
|
||||||
- The `guake` package has been updated from 3.6.3 to 3.9.0, see the [changelog](https://github.com/Guake/guake/releases) for more details.
|
- The `guake` package has been updated from 3.6.3 to 3.9.0, see the [changelog](https://github.com/Guake/guake/releases) for more details.
|
||||||
|
|
||||||
|
- The `netlify-cli` package has been updated from 6.13.2 to 12.2.4, see the [changelog](https://github.com/netlify/cli/releases) for more details.
|
||||||
|
|
||||||
- `dockerTools.buildImage` deprecates the misunderstood `contents` parameter, in favor of `copyToRoot`.
|
- `dockerTools.buildImage` deprecates the misunderstood `contents` parameter, in favor of `copyToRoot`.
|
||||||
Use `copyToRoot = buildEnv { ... };` or similar if you intend to add packages to `/bin`.
|
Use `copyToRoot = buildEnv { ... };` or similar if you intend to add packages to `/bin`.
|
||||||
|
|
||||||
|
|
|
@ -7,28 +7,16 @@
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "esbuild";
|
pname = "esbuild";
|
||||||
version = "0.13.6";
|
version = "0.14.39";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "netlify";
|
owner = "netlify";
|
||||||
repo = "esbuild";
|
repo = "esbuild";
|
||||||
rev = "v${version}";
|
rev = "5faa7ad54c99a953d05c06819298d2b6f8c82d80";
|
||||||
sha256 = "0asjmqfzdrpfx2hd5hkac1swp52qknyqavsm59j8xr4c1ixhc6n9";
|
sha256 = "pYiwGjgFMclPYTW0Qml7Pr/knT1gywUAGANra5aojYM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
vendorSha256 = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
vendorSha256 = "sha256-QPkBR+FscUc3jOvH7olcGUhM6OW4vxawmNJuRQxPuGs=";
|
||||||
|
|
||||||
patches = [
|
|
||||||
# Both upstream patches update the same dependency "x/sys". It's required for darwin compatibility.
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/evanw/esbuild/commit/2567e099fcc6959e630f100b2c737ca80e88ba82.patch";
|
|
||||||
hash = "sha256-KdX/Ru9TBX0mSDaS1ijxgzDI+2AoCvt6Wilhpca3VC0=";
|
|
||||||
})
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/evanw/esbuild/commit/fd13718c6195afb9e63682476a774fa6d4483be0.patch";
|
|
||||||
hash = "sha256-va/bXRBQf9qgE9LZXcKKAa0ZpMt/QG7BFClJ8bPWG1Y=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests = {
|
tests = {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# This file has been generated by node2nix 1.9.0. Do not edit!
|
# This file has been generated by node2nix 1.11.1. Do not edit!
|
||||||
|
|
||||||
{pkgs ? import <nixpkgs> {
|
{pkgs ? import <nixpkgs> {
|
||||||
inherit system;
|
inherit system;
|
||||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:
|
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x"}:
|
||||||
|
|
||||||
let
|
let
|
||||||
nodeEnv = import ./node-env.nix {
|
nodeEnv = import ./node-env.nix {
|
||||||
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
|
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
|
||||||
inherit pkgs nodejs;
|
inherit pkgs nodejs;
|
||||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
{ callPackage, fetchFromGitHub, lib, pkgs }:
|
{ callPackage, fetchFromGitHub, lib, pkgs }:
|
||||||
let
|
let
|
||||||
nodePackages = import ./composition.nix { inherit pkgs; };
|
nodePackages = import ./composition.nix { inherit pkgs; };
|
||||||
|
sourceInfo = (lib.importJSON ./netlify-cli.json);
|
||||||
in
|
in
|
||||||
nodePackages.package.override {
|
nodePackages.package.override {
|
||||||
preRebuild = ''
|
preRebuild = ''
|
||||||
export ESBUILD_BINARY_PATH="${pkgs.esbuild_netlify}/bin/esbuild"
|
export ESBUILD_BINARY_PATH="${pkgs.esbuild_netlify}/bin/esbuild"
|
||||||
'';
|
'';
|
||||||
src = fetchFromGitHub (lib.importJSON ./netlify-cli.json);
|
src = fetchFromGitHub {
|
||||||
|
inherit (sourceInfo) owner repo rev sha256;
|
||||||
|
};
|
||||||
bypassCache = true;
|
bypassCache = true;
|
||||||
reconstructLock = true;
|
reconstructLock = true;
|
||||||
passthru.tests.test = callPackage ./test.nix { };
|
passthru.tests.test = callPackage ./test.nix { };
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
||||||
rm -f ./node-env.nix
|
rm -f ./node-env.nix
|
||||||
src="$(nix-build --expr '(import ../../../.. {}).fetchFromGitHub (lib.importJSON ./netlify-cli.json)')"
|
src="$(nix-build --expr 'let pkgs = import ../../../.. {}; meta = (pkgs.lib.importJSON ./netlify-cli.json); in pkgs.fetchFromGitHub { inherit (meta) owner repo rev sha256; }')"
|
||||||
echo $src
|
echo $src
|
||||||
node2nix \
|
node2nix \
|
||||||
--input $src/package.json \
|
--input $src/package.json \
|
||||||
|
@ -10,5 +10,5 @@ node2nix \
|
||||||
--output node-packages.nix \
|
--output node-packages.nix \
|
||||||
--composition composition.nix \
|
--composition composition.nix \
|
||||||
--node-env node-env.nix \
|
--node-env node-env.nix \
|
||||||
--nodejs-14 \
|
--nodejs-16 \
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"owner": "netlify",
|
"owner": "netlify",
|
||||||
"repo": "cli",
|
"repo": "cli",
|
||||||
"rev": "a50e410fddda92d3f3f256321eddefb8cb8ba6e1",
|
"rev": "6c7e8c9a4db4e2e408f65e6098a194497944e306",
|
||||||
"sha256": "sisX58I5UxxEPGCh5JGtQHw72A4+pLuENpBB9WKRTZc=",
|
"sha256": "YMnQrurZDJtfeHBCIzy6vToGHnqtdRGvWFPX5RcWyPg=",
|
||||||
"fetchSubmodules": false
|
"fetchSubmodules": false,
|
||||||
|
"leaveDotGit": false,
|
||||||
|
"deepClone": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# This file originates from node2nix
|
# This file originates from node2nix
|
||||||
|
|
||||||
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}:
|
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
|
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
|
||||||
|
@ -40,36 +40,22 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
includeDependencies = {dependencies}:
|
# Common shell logic
|
||||||
lib.optionalString (dependencies != [])
|
installPackage = writeShellScript "install-package" ''
|
||||||
(lib.concatMapStrings (dependency:
|
installPackage() {
|
||||||
''
|
local packageName=$1 src=$2
|
||||||
# Bundle the dependencies of the package
|
|
||||||
mkdir -p node_modules
|
|
||||||
cd node_modules
|
|
||||||
|
|
||||||
# Only include dependencies if they don't exist. They may also be bundled in the package.
|
local strippedName
|
||||||
if [ ! -e "${dependency.name}" ]
|
|
||||||
then
|
|
||||||
${composePackage dependency}
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd ..
|
local DIR=$PWD
|
||||||
''
|
|
||||||
) dependencies);
|
|
||||||
|
|
||||||
# Recursively composes the dependencies of a package
|
|
||||||
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
|
|
||||||
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
|
|
||||||
DIR=$(pwd)
|
|
||||||
cd $TMPDIR
|
cd $TMPDIR
|
||||||
|
|
||||||
unpackFile ${src}
|
unpackFile $src
|
||||||
|
|
||||||
# Make the base dir in which the target dependency resides first
|
# Make the base dir in which the target dependency resides first
|
||||||
mkdir -p "$(dirname "$DIR/${packageName}")"
|
mkdir -p "$(dirname "$DIR/$packageName")"
|
||||||
|
|
||||||
if [ -f "${src}" ]
|
if [ -f "$src" ]
|
||||||
then
|
then
|
||||||
# Figure out what directory has been unpacked
|
# Figure out what directory has been unpacked
|
||||||
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
|
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
|
||||||
|
@ -79,28 +65,53 @@ let
|
||||||
chmod -R u+w "$packageDir"
|
chmod -R u+w "$packageDir"
|
||||||
|
|
||||||
# Move the extracted tarball into the output folder
|
# Move the extracted tarball into the output folder
|
||||||
mv "$packageDir" "$DIR/${packageName}"
|
mv "$packageDir" "$DIR/$packageName"
|
||||||
elif [ -d "${src}" ]
|
elif [ -d "$src" ]
|
||||||
then
|
then
|
||||||
# Get a stripped name (without hash) of the source directory.
|
# Get a stripped name (without hash) of the source directory.
|
||||||
# On old nixpkgs it's already set internally.
|
# On old nixpkgs it's already set internally.
|
||||||
if [ -z "$strippedName" ]
|
if [ -z "$strippedName" ]
|
||||||
then
|
then
|
||||||
strippedName="$(stripHash ${src})"
|
strippedName="$(stripHash $src)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore write permissions to make building work
|
# Restore write permissions to make building work
|
||||||
chmod -R u+w "$strippedName"
|
chmod -R u+w "$strippedName"
|
||||||
|
|
||||||
# Move the extracted directory into the output folder
|
# Move the extracted directory into the output folder
|
||||||
mv "$strippedName" "$DIR/${packageName}"
|
mv "$strippedName" "$DIR/$packageName"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unset the stripped name to not confuse the next unpack step
|
# Change to the package directory to install dependencies
|
||||||
unset strippedName
|
cd "$DIR/$packageName"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
# Include the dependencies of the package
|
# Bundle the dependencies of the package
|
||||||
cd "$DIR/${packageName}"
|
#
|
||||||
|
# Only include dependencies if they don't exist. They may also be bundled in the package.
|
||||||
|
includeDependencies = {dependencies}:
|
||||||
|
lib.optionalString (dependencies != []) (
|
||||||
|
''
|
||||||
|
mkdir -p node_modules
|
||||||
|
cd node_modules
|
||||||
|
''
|
||||||
|
+ (lib.concatMapStrings (dependency:
|
||||||
|
''
|
||||||
|
if [ ! -e "${dependency.packageName}" ]; then
|
||||||
|
${composePackage dependency}
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
) dependencies)
|
||||||
|
+ ''
|
||||||
|
cd ..
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
# Recursively composes the dependencies of a package
|
||||||
|
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
|
||||||
|
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
|
||||||
|
installPackage "${packageName}" "${src}"
|
||||||
${includeDependencies { inherit dependencies; }}
|
${includeDependencies { inherit dependencies; }}
|
||||||
cd ..
|
cd ..
|
||||||
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
|
||||||
|
@ -154,7 +165,11 @@ let
|
||||||
if(process.argv[2] == "development") {
|
if(process.argv[2] == "development") {
|
||||||
replaceDependencies(packageObj.devDependencies);
|
replaceDependencies(packageObj.devDependencies);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
packageObj.devDependencies = {};
|
||||||
|
}
|
||||||
replaceDependencies(packageObj.optionalDependencies);
|
replaceDependencies(packageObj.optionalDependencies);
|
||||||
|
replaceDependencies(packageObj.peerDependencies);
|
||||||
|
|
||||||
/* Write the fixed package.json file */
|
/* Write the fixed package.json file */
|
||||||
fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2));
|
fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2));
|
||||||
|
@ -246,8 +261,8 @@ let
|
||||||
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
|
var packageLock = JSON.parse(fs.readFileSync("./package-lock.json"));
|
||||||
|
|
||||||
if(![1, 2].includes(packageLock.lockfileVersion)) {
|
if(![1, 2].includes(packageLock.lockfileVersion)) {
|
||||||
process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");
|
process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packageLock.dependencies !== undefined) {
|
if(packageLock.dependencies !== undefined) {
|
||||||
|
@ -259,7 +274,7 @@ let
|
||||||
|
|
||||||
# Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes
|
# Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes
|
||||||
reconstructPackageLock = writeTextFile {
|
reconstructPackageLock = writeTextFile {
|
||||||
name = "addintegrityfields.js";
|
name = "reconstructpackagelock.js";
|
||||||
text = ''
|
text = ''
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
@ -269,25 +284,43 @@ let
|
||||||
var lockObj = {
|
var lockObj = {
|
||||||
name: packageObj.name,
|
name: packageObj.name,
|
||||||
version: packageObj.version,
|
version: packageObj.version,
|
||||||
lockfileVersion: 1,
|
lockfileVersion: 2,
|
||||||
requires: true,
|
requires: true,
|
||||||
|
packages: {
|
||||||
|
"": {
|
||||||
|
name: packageObj.name,
|
||||||
|
version: packageObj.version,
|
||||||
|
license: packageObj.license,
|
||||||
|
bin: packageObj.bin,
|
||||||
|
dependencies: packageObj.dependencies,
|
||||||
|
engines: packageObj.engines,
|
||||||
|
optionalDependencies: packageObj.optionalDependencies
|
||||||
|
}
|
||||||
|
},
|
||||||
dependencies: {}
|
dependencies: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
function augmentPackageJSON(filePath, dependencies) {
|
function augmentPackageJSON(filePath, packages, dependencies) {
|
||||||
var packageJSON = path.join(filePath, "package.json");
|
var packageJSON = path.join(filePath, "package.json");
|
||||||
if(fs.existsSync(packageJSON)) {
|
if(fs.existsSync(packageJSON)) {
|
||||||
var packageObj = JSON.parse(fs.readFileSync(packageJSON));
|
var packageObj = JSON.parse(fs.readFileSync(packageJSON));
|
||||||
|
packages[filePath] = {
|
||||||
|
version: packageObj.version,
|
||||||
|
integrity: "sha1-000000000000000000000000000=",
|
||||||
|
dependencies: packageObj.dependencies,
|
||||||
|
engines: packageObj.engines,
|
||||||
|
optionalDependencies: packageObj.optionalDependencies
|
||||||
|
};
|
||||||
dependencies[packageObj.name] = {
|
dependencies[packageObj.name] = {
|
||||||
version: packageObj.version,
|
version: packageObj.version,
|
||||||
integrity: "sha1-000000000000000000000000000=",
|
integrity: "sha1-000000000000000000000000000=",
|
||||||
dependencies: {}
|
dependencies: {}
|
||||||
};
|
};
|
||||||
processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies);
|
processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function processDependencies(dir, dependencies) {
|
function processDependencies(dir, packages, dependencies) {
|
||||||
if(fs.existsSync(dir)) {
|
if(fs.existsSync(dir)) {
|
||||||
var files = fs.readdirSync(dir);
|
var files = fs.readdirSync(dir);
|
||||||
|
|
||||||
|
@ -303,23 +336,84 @@ let
|
||||||
pkgFiles.forEach(function(entry) {
|
pkgFiles.forEach(function(entry) {
|
||||||
if(stats.isDirectory()) {
|
if(stats.isDirectory()) {
|
||||||
var pkgFilePath = path.join(filePath, entry);
|
var pkgFilePath = path.join(filePath, entry);
|
||||||
augmentPackageJSON(pkgFilePath, dependencies);
|
augmentPackageJSON(pkgFilePath, packages, dependencies);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
augmentPackageJSON(filePath, dependencies);
|
augmentPackageJSON(filePath, packages, dependencies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processDependencies("node_modules", lockObj.dependencies);
|
processDependencies("node_modules", lockObj.packages, lockObj.dependencies);
|
||||||
|
|
||||||
fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));
|
fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Script that links bins defined in package.json to the node_modules bin directory
|
||||||
|
# NPM does not do this for top-level packages itself anymore as of v7
|
||||||
|
linkBinsScript = writeTextFile {
|
||||||
|
name = "linkbins.js";
|
||||||
|
text = ''
|
||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
var packageObj = JSON.parse(fs.readFileSync("package.json"));
|
||||||
|
|
||||||
|
var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep);
|
||||||
|
|
||||||
|
if(packageObj.bin !== undefined) {
|
||||||
|
fs.mkdirSync(path.join(nodeModules, ".bin"))
|
||||||
|
|
||||||
|
if(typeof packageObj.bin == "object") {
|
||||||
|
Object.keys(packageObj.bin).forEach(function(exe) {
|
||||||
|
if(fs.existsSync(packageObj.bin[exe])) {
|
||||||
|
console.log("linking bin '" + exe + "'");
|
||||||
|
fs.symlinkSync(
|
||||||
|
path.join("..", packageObj.name, packageObj.bin[exe]),
|
||||||
|
path.join(nodeModules, ".bin", exe)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("skipping non-existent bin '" + exe + "'");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(fs.existsSync(packageObj.bin)) {
|
||||||
|
console.log("linking bin '" + packageObj.bin + "'");
|
||||||
|
fs.symlinkSync(
|
||||||
|
path.join("..", packageObj.name, packageObj.bin),
|
||||||
|
path.join(nodeModules, ".bin", packageObj.name.split("/").pop())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("skipping non-existent bin '" + packageObj.bin + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) {
|
||||||
|
fs.mkdirSync(path.join(nodeModules, ".bin"))
|
||||||
|
|
||||||
|
fs.readdirSync(packageObj.directories.bin).forEach(function(exe) {
|
||||||
|
if(fs.existsSync(path.join(packageObj.directories.bin, exe))) {
|
||||||
|
console.log("linking bin '" + exe + "'");
|
||||||
|
fs.symlinkSync(
|
||||||
|
path.join("..", packageObj.name, packageObj.directories.bin, exe),
|
||||||
|
path.join(nodeModules, ".bin", exe)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("skipping non-existent bin '" + exe + "'");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
|
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
|
||||||
let
|
let
|
||||||
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
|
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
|
||||||
|
@ -366,20 +460,25 @@ let
|
||||||
|
|
||||||
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
|
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
|
||||||
|
|
||||||
|
runHook postRebuild
|
||||||
|
|
||||||
if [ "''${dontNpmInstall-}" != "1" ]
|
if [ "''${dontNpmInstall-}" != "1" ]
|
||||||
then
|
then
|
||||||
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
||||||
rm -f npm-shrinkwrap.json
|
rm -f npm-shrinkwrap.json
|
||||||
|
|
||||||
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
|
npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Link executables defined in package.json
|
||||||
|
node ${linkBinsScript}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Builds and composes an NPM package including all its dependencies
|
# Builds and composes an NPM package including all its dependencies
|
||||||
buildNodePackage =
|
buildNodePackage =
|
||||||
{ name
|
{ name
|
||||||
, packageName
|
, packageName
|
||||||
, version
|
, version ? null
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
, production ? true
|
, production ? true
|
||||||
|
@ -398,7 +497,7 @@ let
|
||||||
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
|
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "${name}-${version}";
|
name = "${name}${if version == null then "" else "-${version}"}";
|
||||||
buildInputs = [ tarWrapper python nodejs ]
|
buildInputs = [ tarWrapper python nodejs ]
|
||||||
++ lib.optional (stdenv.isLinux) utillinux
|
++ lib.optional (stdenv.isLinux) utillinux
|
||||||
++ lib.optional (stdenv.isDarwin) libtool
|
++ lib.optional (stdenv.isDarwin) libtool
|
||||||
|
@ -415,6 +514,8 @@ let
|
||||||
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
|
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
source ${installPackage}
|
||||||
|
|
||||||
# Create and enter a root node_modules/ folder
|
# Create and enter a root node_modules/ folder
|
||||||
mkdir -p $out/lib/node_modules
|
mkdir -p $out/lib/node_modules
|
||||||
cd $out/lib/node_modules
|
cd $out/lib/node_modules
|
||||||
|
@ -428,6 +529,14 @@ let
|
||||||
if [ -d "$out/lib/node_modules/.bin" ]
|
if [ -d "$out/lib/node_modules/.bin" ]
|
||||||
then
|
then
|
||||||
ln -s $out/lib/node_modules/.bin $out/bin
|
ln -s $out/lib/node_modules/.bin $out/bin
|
||||||
|
|
||||||
|
# Patch the shebang lines of all the executables
|
||||||
|
ls $out/bin/* | while read i
|
||||||
|
do
|
||||||
|
file="$(readlink -f "$i")"
|
||||||
|
chmod u+rwx "$file"
|
||||||
|
patchShebangs "$file"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create symlinks to the deployed manual page folders, if applicable
|
# Create symlinks to the deployed manual page folders, if applicable
|
||||||
|
@ -458,7 +567,7 @@ let
|
||||||
buildNodeDependencies =
|
buildNodeDependencies =
|
||||||
{ name
|
{ name
|
||||||
, packageName
|
, packageName
|
||||||
, version
|
, version ? null
|
||||||
, src
|
, src
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
|
@ -476,7 +585,7 @@ let
|
||||||
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
|
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "node-dependencies-${name}-${version}";
|
name = "node-dependencies-${name}${if version == null then "" else "-${version}"}";
|
||||||
|
|
||||||
buildInputs = [ tarWrapper python nodejs ]
|
buildInputs = [ tarWrapper python nodejs ]
|
||||||
++ lib.optional (stdenv.isLinux) utillinux
|
++ lib.optional (stdenv.isLinux) utillinux
|
||||||
|
@ -492,6 +601,8 @@ let
|
||||||
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
|
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
source ${installPackage}
|
||||||
|
|
||||||
mkdir -p $out/${packageName}
|
mkdir -p $out/${packageName}
|
||||||
cd $out/${packageName}
|
cd $out/${packageName}
|
||||||
|
|
||||||
|
@ -504,6 +615,7 @@ let
|
||||||
if [ -f ${src}/package-lock.json ]
|
if [ -f ${src}/package-lock.json ]
|
||||||
then
|
then
|
||||||
cp ${src}/package-lock.json .
|
cp ${src}/package-lock.json .
|
||||||
|
chmod 644 package-lock.json
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
@ -526,7 +638,7 @@ let
|
||||||
buildNodeShell =
|
buildNodeShell =
|
||||||
{ name
|
{ name
|
||||||
, packageName
|
, packageName
|
||||||
, version
|
, version ? null
|
||||||
, src
|
, src
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
|
@ -542,9 +654,10 @@ let
|
||||||
|
|
||||||
let
|
let
|
||||||
nodeDependencies = buildNodeDependencies args;
|
nodeDependencies = buildNodeDependencies args;
|
||||||
|
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ];
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation ({
|
||||||
name = "node-shell-${name}-${version}";
|
name = "node-shell-${name}${if version == null then "" else "-${version}"}";
|
||||||
|
|
||||||
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
|
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
|
@ -563,7 +676,7 @@ let
|
||||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||||
export PATH="${nodeDependencies}/bin:$PATH"
|
export PATH="${nodeDependencies}/bin:$PATH"
|
||||||
'';
|
'';
|
||||||
};
|
} // extraArgs);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
|
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;
|
||||||
|
|
7223
pkgs/development/web/netlify-cli/node-packages.nix
generated
7223
pkgs/development/web/netlify-cli/node-packages.nix
generated
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,18 @@
|
||||||
{
|
{
|
||||||
curl,
|
curl,
|
||||||
|
darwin,
|
||||||
|
lib,
|
||||||
netlify-cli,
|
netlify-cli,
|
||||||
runCommand,
|
runCommand,
|
||||||
|
stdenv,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
runCommand "netlify-cli-test" {
|
runCommand "netlify-cli-test" {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
netlify-cli
|
netlify-cli
|
||||||
curl
|
curl
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
darwin.ps
|
||||||
];
|
];
|
||||||
meta.timeout = 600;
|
meta.timeout = 600;
|
||||||
} ''
|
} ''
|
||||||
|
|
Loading…
Reference in a new issue