Skip to content

Commit 6cd7a80

Browse files
authored
Merge pull request #56 from nodenv/workflows
Use shared nodenv workflows
2 parents 26a1652 + 9bf59ba commit 6cd7a80

16 files changed

+240
-168
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_size = 2
9+
indent_style = space

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ updates:
77
directory: "/"
88
schedule: { interval: weekly }
99
cooldown: { default-days: 15 }
10-
groups:
11-
dev-deps: { dependency-type: development }
1210

1311
- package-ecosystem: github-actions
1412
directory: "/"
1513
schedule: { interval: weekly }
1614
cooldown: { default-days: 15 }
17-
groups:
18-
gh-actions: { patterns: ["*"] }

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Release
2+
on:
3+
push: { tags: "v[0-9]+.[0-9]+.[0-9]+*" }
4+
5+
permissions: {}
6+
jobs:
7+
release:
8+
permissions: { contents: write, id-token: write }
9+
uses: nodenv/.github/.github/workflows/release.yml@v6
10+
secrets: inherit

.github/workflows/sync-default-branch.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ permissions: {}
66

77
jobs:
88
sync:
9-
permissions: {contents: write}
9+
permissions: { contents: write }
1010
uses: nodenv/.github/.github/workflows/sync-default-branch.yml@v5
11-
1211
# One-time commands for users to switch-over:
1312
#
1413
# ```console

.github/workflows/test.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
name: Test
2-
on: [push, pull_request]
3-
4-
permissions:
5-
contents: read
2+
on:
3+
push:
4+
pull_request:
5+
schedule: [{ cron: "0 0 10 * *" }] # monthly https://crontab.guru/#0_0_10_*_*
6+
workflow_dispatch:
67

8+
permissions: {}
79
jobs:
810
test:
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Harden the runner (Audit all outbound calls)
13-
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
14-
with:
15-
egress-policy: audit
16-
17-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18-
- run: npm cit
11+
uses: nodenv/.github/.github/workflows/test.yml@v6
12+
permissions:
13+
contents: read
14+
packages: read
15+
id-token: write
16+
security-events: write
17+
statuses: write

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/node_modules
2-
/nodenv-nodenv-default-packages-*.tgz
2+
/package*/
3+
/tmp
34
/test/tmp
5+
6+
/nodenv-nodenv-default-packages-*.tgz

README.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Forked from the excellent [`rbenv-default-gems`][rbenv-default-gems] plugin from
1212
<!-- toc -->
1313

1414
- [Installation](#installation)
15-
* [Installing as a nodenv plugin](#installing-as-a-nodenv-plugin)
16-
* [Installing with Homebrew (for OS X users)](#installing-with-homebrew-for-os-x-users)
15+
- [Installing as a nodenv plugin](#installing-as-a-nodenv-plugin)
16+
- [Installing with Homebrew (for macOS users)](#installing-with-homebrew-for-macos-users)
1717
- [Usage](#usage)
18-
* [default-packages Files](#default-packages-files)
19-
* [Updating Default Packages](#updating-default-packages)
18+
- [default-packages Files](#default-packages-files)
19+
- [Updating Default Packages](#updating-default-packages)
2020
- [Credits](#credits)
2121

2222
<!-- tocstop -->
@@ -27,36 +27,40 @@ Forked from the excellent [`rbenv-default-gems`][rbenv-default-gems] plugin from
2727

2828
Make sure you have the latest nodenv and node-build versions, then run:
2929

30-
git clone https://github.com/nodenv/nodenv-default-packages.git $(nodenv root)/plugins/nodenv-default-packages
30+
```sh
31+
git clone https://github.com/nodenv/nodenv-default-packages.git $(nodenv root)/plugins/nodenv-default-packages
32+
```
3133

32-
### Installing with Homebrew (for OS X users)
34+
### Installing with Homebrew (for macOS users)
3335

34-
Mac OS X users can install nodenv-default-packages with the [Homebrew](http://brew.sh) package manager.
36+
MacOS users can install nodenv-default-packages with the [Homebrew](http://brew.sh) package manager.
3537

36-
*This is the recommended method of installation if you installed nodenv with Homebrew.*
38+
_This is the recommended method of installation if you installed nodenv with Homebrew._
3739

38-
```
39-
$ brew install nodenv/nodenv/nodenv-default-packages
40+
```sh
41+
brew install nodenv/nodenv/nodenv-default-packages
4042
```
4143

4244
Or, if you would like to install the latest development release:
4345

44-
```
45-
$ brew install --HEAD nodenv/nodenv/nodenv-default-packages
46+
```sh
47+
brew install --HEAD nodenv/nodenv/nodenv-default-packages
4648
```
4749

4850
## Usage
4951

5052
nodenv-default-packages automatically installs the packages listed in the [default-packages file(s)](#default-packages-files) file every time you successfully install a new version of Node with `nodenv install`.
5153

5254
Specify packages in `default-packages` by name, one per line.
53-
You may optionally specify a semver version spec after the name. For example:
55+
You may optionally specify a SemVer version spec after the name. For example:
5456

55-
grunt-cli
56-
jshint ~2.6.3
57-
csslint >= 0.9.0 < 0.10.0
57+
```txt
58+
grunt-cli
59+
jshint ~2.6.3
60+
csslint >= 0.9.0 < 0.10.0
61+
```
5862

59-
Blank lines and lines beginning with a `#` are ignored.
63+
Empty lines and lines beginning with a `#` are ignored.
6064

6165
### default-packages Files
6266

@@ -67,11 +71,16 @@ The XDG config directories searched are `$XDG_CONFIG_HOME` (`$HOME/.config` if u
6771

6872
if you update your `$(nodenv root)/default-packages` and want to refresh some or all of your existing node installations you can use commands like this:
6973

70-
nodenv default-packages install 8.8.1 # Reinstall default packages on Node version 8.8.1
74+
```sh
75+
nodenv default-packages install 8.8.1 # Reinstall default packages on Node version 8.8.1
76+
```
7177

72-
nodenv default-packages install --all # Reinstall default packages on _all_ installed Node versions
78+
```sh
79+
nodenv default-packages install --all # Reinstall default packages on _all_ installed Node versions
80+
```
7381

74-
*NOTE:* This may take some time.
82+
> [!NOTE]
83+
> This may take some time.
7584
7685
## Credits
7786

bin/nodenv-default-packages

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ fi
3232

3333
versions() {
3434
case "$1" in
35-
"") nodenv-version-name ;; # list active version
36-
--all) nodenv-versions --skip-aliases --bare ;; # list all installed versions
37-
*) echo "$@" ;; # list specified versions
35+
"") nodenv-version-name ;; # list active version
36+
--all) nodenv-versions --skip-aliases --bare ;; # list all installed versions
37+
*) echo "$@" ;; # list specified versions
3838
esac
3939
}
4040

@@ -50,23 +50,23 @@ for_versions() {
5050
# Read package names and versions from $NODENV_ROOT/default-packages
5151
list_default_packages() {
5252
default_packages_files |
53-
tr '\n' '\0' | # replace newlines with nullchar so we can use xargs
54-
xargs -0 sed -e 's/#.*$//g' -e '/^[[:space:]]*$/d' | # strip comments and empty lines
55-
while IFS=" " read -r pkg_name pkg_version; do
56-
# shellcheck disable=SC2016
57-
echo "${pkg_name}${pkg_version:+@'$pkg_version'}"
58-
done
53+
tr '\n' '\0' | # replace newlines with nullchar so we can use xargs
54+
xargs -0 sed -e 's/#.*$//g' -e '/^[[:space:]]*$/d' | # strip comments and empty lines
55+
while IFS=" " read -r pkg_name pkg_version; do
56+
# shellcheck disable=SC2016
57+
echo "${pkg_name}${pkg_version:+@'$pkg_version'}"
58+
done
5959
}
6060

6161
install_default_packages() {
6262
list_default_packages |
63-
NODENV_VERSION="$1" xargs nodenv-exec npm install -g
63+
NODENV_VERSION="$1" xargs nodenv-exec npm install -g
6464
}
6565

6666
default_packages_files() {
6767
local file_found
6868

69-
IFS=: read -ra xdg_dirs <<< "${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}"
69+
IFS=: read -ra xdg_dirs <<<"${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}"
7070

7171
for dir in "$NODENV_ROOT" "${xdg_dirs[@]/%//nodenv}"; do
7272
if test -r "$dir/default-packages"; then
@@ -83,13 +83,16 @@ default_packages_files() {
8383
unset cmd
8484

8585
case "$1" in
86-
install ) for_versions install_default_packages "${@:2}" ;;
86+
install) for_versions install_default_packages "${@:2}" ;;
8787

88-
list ) list_default_packages ;;
88+
list) list_default_packages ;;
8989

90-
files ) default_packages_files ;;
90+
files) default_packages_files ;;
9191

92-
-h | --help ) nodenv-help ;;
92+
-h | --help) nodenv-help ;;
9393

94-
*) nodenv-help --usage default-packages; exit 1 ;;
94+
*)
95+
nodenv-help --usage default-packages
96+
exit 1
97+
;;
9598
esac

package-lock.json

Lines changed: 78 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)