@nodenv/node-build 4.11.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/node-build CHANGED
@@ -10,11 +10,12 @@
10
10
  # -v/--verbose Verbose mode: print compilation status to stdout
11
11
  # -4/--ipv4 Resolve names to IPv4 addresses only
12
12
  # -6/--ipv6 Resolve names to IPv6 addresses only
13
- # --definitions List all built-in definitions
13
+ # --definitions List all local definitions
14
+ # -l/--list List latest stable releases for each Node
14
15
  # --version Show version of node-build
15
16
  #
16
17
 
17
- NODE_BUILD_VERSION=4.11.0
18
+ NODE_BUILD_VERSION=5.0.1
18
19
 
19
20
  OLDIFS="$IFS"
20
21
 
@@ -837,6 +838,7 @@ usage() {
837
838
  [ -z "$1" ] || exit "$1"
838
839
  }
839
840
 
841
+ # list all versions
840
842
  list_definitions() {
841
843
  { for DEFINITION_DIR in "${NODE_BUILD_DEFINITIONS[@]}"; do
842
844
  [ -d "$DEFINITION_DIR" ] && ls "$DEFINITION_DIR"
@@ -844,6 +846,27 @@ list_definitions() {
844
846
  } | sort_versions | uniq
845
847
  }
846
848
 
849
+ # list only latest stable versions excluding RC, preview, dev and EoL'ed
850
+ list_maintained_versions() {
851
+ { for DEFINITION_DIR in "${NODE_BUILD_DEFINITIONS[@]}"; do
852
+ [ -d "$DEFINITION_DIR" ] && \
853
+ grep -L -e warn_eol "$DEFINITION_DIR"/* 2>/dev/null | \
854
+ sed 's|.*/||'
855
+ done
856
+ } | exclude_prereleases | extract_latest_versions | sort_versions | uniq
857
+ }
858
+
859
+ exclude_prereleases() {
860
+ grep -vE -e'-(dev|next|rc|nightly)'
861
+ }
862
+
863
+ extract_latest_versions() {
864
+ sort_versions |
865
+ sed -E 'h; s/$/.z/; G; s/\n/ /' | # create 'index' for each major version
866
+ sed -E 's/([0-9]+).*z/\1/' | # truncate to major from first column
867
+ awk '{ latest[$1] =$2 } END{ for(key in latest) { print latest[key] } }'
868
+ }
869
+
847
870
  sort_versions() {
848
871
  sed -E 'h; s/[~^<>=[:space:]]//g; s/^([[:digit:]])/a.\1/g; s/[+-]/./g; s/$/.0.0.0.0/; G; s/\n/ /' \
849
872
  | LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n \
@@ -879,6 +902,10 @@ for option in "${OPTIONS[@]}"; do
879
902
  "c" | "compile" )
880
903
  SKIP_BINARY=true
881
904
  ;;
905
+ "l" | "list")
906
+ list_maintained_versions
907
+ exit 0
908
+ ;;
882
909
  "k" | "keep" )
883
910
  KEEP_BUILD_PATH=true
884
911
  ;;
@@ -7,7 +7,8 @@
7
7
  # nodenv install -l|--list
8
8
  # nodenv install --version
9
9
  #
10
- # -l/--list List all available versions
10
+ # -l/--list List latest stable versions for each Node
11
+ # -L/--list-all List all local versions
11
12
  # -f/--force Install even if the version appears to be installed already
12
13
  # -s/--skip-existing Skip if the version appears to be installed already
13
14
  #
@@ -39,6 +40,7 @@ shopt -u nullglob
39
40
  # Provide nodenv completions
40
41
  if [ "$1" = "--complete" ]; then
41
42
  echo --list
43
+ echo --list-all
42
44
  echo --force
43
45
  echo --skip-existing
44
46
  echo --compile
@@ -83,7 +85,17 @@ for option in "${OPTIONS[@]}"; do
83
85
  SKIP_BINARY="-c"
84
86
  ;;
85
87
  "l" | "list" )
86
- exec node-build --definitions
88
+ node-build --list
89
+ {
90
+ echo
91
+ echo "Only latest stable releases for each Node implementation are shown."
92
+ echo "Use 'nodenv install --list-all' to show all local versions."
93
+ } 1>&2
94
+ exit
95
+ ;;
96
+ "L" | "list-all" )
97
+ node-build --definitions
98
+ exit
87
99
  ;;
88
100
  "f" | "force" )
89
101
  FORCE=true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodenv/node-build",
3
- "version": "4.11.0",
3
+ "version": "5.0.1",
4
4
  "description": "Install NodeJS versions",
5
5
  "homepage": "https://github.com/nodenv/node-build#readme",
6
6
  "license": "MIT",