Merge pull request #108138 from Lassulus/yarn2nix_move

yarn2nix: updates from nix-community/yarn2nix
This commit is contained in:
Lassulus 2021-05-20 08:54:08 +02:00 committed by GitHub
commit c03bb4d812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1499 additions and 1233 deletions

View file

@ -1,10 +0,0 @@
{ pkgs ? (import ../../../../. {})
, fetchFromGitHub ? pkgs.fetchFromGitHub
}:
fetchFromGitHub {
owner = "moretea";
repo = "yarn2nix";
rev = "9e7279edde2a4e0f5ec04c53f5cd64440a27a1ae";
sha256 = "0zz2lrwn3y3rb8gzaiwxgz02dvy3s552zc70zvfqc0zh5dhydgn7";
}

View file

@ -1,40 +0,0 @@
#!/usr/bin/env bash
###
### This script runs 'nix-build' with ./fetch-source.nix and copies a subset
### of the resulting store path into the current working directory.
###
### To disable running chmod, you may set the environment
### variable "FIX_RIGHTS" to "no".
###
set -euo pipefail
# 'nix-build' command
NIX_BUILD_BIN="${NIX_BUILD_BIN:-"/usr/bin/env nix-build"}"
# where to place the yarn2nix source
TARGET_DIR="${TARGET_DIR:-"./yarn2nix"}"
# whether to run 'chmod -R u=rwX,g=rX,o-rwx' on copied files in $TARGET_DIR
FIX_RIGHTS="${FIX_RIGHTS:-"yes"}"
fetch_git_source() {
[[ -f ./fetch-source.nix ]] && ret="$($NIX_BUILD_BIN --no-out-link ./fetch-source.nix)" && ec="$?" || ec="$?"
if [[ "$ec" == "0" ]]; then
echo "$ret"
else
printf "error: failed at 'fetch_git_source()' with '%s'" "$ret"
fi
}
result="$(fetch_git_source)"
if [[ "$result" == "/nix/store"* ]]; then
mkdir -p "$TARGET_DIR"
cp -Rv \
"${result}/"{bin,internal,lib,nix,default.nix,package.json,yarn.nix,yarn.lock,LICENSE.txt} \
"$TARGET_DIR"
[[ "$FIX_RIGHTS" = "yes" ]] \
&& chmod -v "u=rwX,g=rX,o-rwx" -R \
"$TARGET_DIR/"{bin,internal,lib,nix,default.nix,package.json,yarn.nix,yarn.lock,LICENSE.txt}
fi

View file

@ -22,8 +22,8 @@ function urlToName(url) {
}
return url
.replace('https://registry.yarnpkg.com/', '') // prevents having long directory names
.replace(/[@/:-]/g, '_') // replace @ and : and - characters with underscore
.replace(/https:\/\/(.)*(.com)\//g, '') // prevents having long directory names
.replace(/[@/%:-]/g, '_') // replace @ and : and - and % characters with underscore
}
module.exports = urlToName

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff