mongosh: 1.6.2 -> 1.8.0, use buildNpmPackage

This commit is contained in:
undefined 2023-02-21 17:45:43 +08:00 committed by Nick Cao
parent f6f9829f50
commit 2c02d0ba11
No known key found for this signature in database
8 changed files with 3886 additions and 2246 deletions

View file

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x"}:
let
nodeEnv = import ../../node-packages/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}

View file

@ -1,15 +1,38 @@
{ pkgs, stdenv, lib, testers, mongosh }:
{ lib
, buildNpmPackage
, fetchurl
, testers
, mongosh
}:
let
nodePackages = import ./composition.nix {
inherit pkgs;
inherit (stdenv.hostPlatform) system;
};
source = builtins.fromJSON (builtins.readFile ./source.json);
in
nodePackages.mongosh.override {
passthru.tests.version = testers.testVersion {
buildNpmPackage {
pname = "mongosh";
inherit (source) version;
src = fetchurl {
url = "https://registry.npmjs.org/mongosh/-/${source.filename}";
hash = source.integrity;
};
postPatch = ''
ln -s ${./package-lock.json} package-lock.json
'';
npmDepsHash = source.deps;
makeCacheWritable = true;
dontNpmBuild = true;
npmFlags = [ "--omit=optional" ];
passthru = {
tests.version = testers.testVersion {
package = mongosh;
};
updateScript = ./update.sh;
};
meta = with lib; {
homepage = "https://www.mongodb.com/try/download/shell";

View file

@ -1,13 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p node2nix
cd "$(dirname "$0")"
node2nix \
--no-copy-node-env \
--node-env ../../node-packages/node-env.nix \
--input packages.json \
--output packages.nix \
--composition composition.nix \
--strip-optional-dependencies \
--nodejs-16

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
[
"mongosh"
]

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
{
"version": "1.8.0",
"integrity": "sha512-9pHLqfYMWwP1L2t83TK5k6ho1faz+jFD9zXxnTtgnyu0c/uC39nx+tJT9AsxNZpY+GlhshDu1YcJm45f8l3gIw==",
"filename": "mongosh-1.8.0.tgz",
"deps": "sha256-8v4E9wNv3+JCGm7mUEA+z+g/4X37ACwVsn+9Cv7N+4o="
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodejs libarchive prefetch-npm-deps moreutils
# shellcheck shell=bash
set -exuo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
TMPDIR="$(mktemp -d)"
trap 'rm -r -- "$TMPDIR"' EXIT
pushd -- "$TMPDIR"
npm pack mongosh --json | jq '.[0] | { version, integrity, filename }' > source.json
bsdtar -x -f "$(jq -r .filename source.json)"
pushd package
npm install --omit=optional --package-lock-only
popd
DEPS="$(prefetch-npm-deps package/package-lock.json)"
jq ".deps = \"$DEPS\"" source.json | sponge source.json
popd
cp -t . -- "$TMPDIR/source.json" "$TMPDIR/package/package-lock.json"