Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alias-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Schniz committed May 27, 2024
2 parents 0653f8a + 1b86087 commit 9868a12
Show file tree
Hide file tree
Showing 70 changed files with 4,290 additions and 3,108 deletions.
5 changes: 1 addition & 4 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@svitejs/changesets-changelog-github-compact",
{ "repo": "Schniz/fnm" }
],
"changelog": ["@changesets/changelog-github", { "repo": "Schniz/fnm" }],
"commit": false,
"fixed": [],
"linked": [],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/disable-unused-chrono-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

Disable unused chrono features (#1014)
5 changes: 5 additions & 0 deletions .changeset/fifty-emus-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": minor
---

feat: add remote version sorting and filtering
5 changes: 5 additions & 0 deletions .changeset/many-paws-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

Fix `cd /D` on windows with `--use-on-cd`
5 changes: 5 additions & 0 deletions .changeset/poor-otters-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

support `x64-musl` arch by adding a `--arch x64-musl` to fnm env
5 changes: 5 additions & 0 deletions .changeset/poor-poets-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

make nicer styling in progress bar (add newline, make it unicode)
5 changes: 5 additions & 0 deletions .changeset/rotten-pumpkins-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

fix: return default version if canonicalize fails
5 changes: 5 additions & 0 deletions .changeset/show-download-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": minor
---

Show a progress bar when downloading and extracting node
5 changes: 5 additions & 0 deletions .changeset/violet-rice-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

Fixes a bug when running `eval $(fnm env)` in sh when there a spaces in the $PATH
60 changes: 34 additions & 26 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
RELEASE="latest"
OS="$(uname -s)"

case "${OS}" in
MINGW* | Win*) OS="Windows" ;;
esac

if [ -d "$HOME/.fnm" ]; then
INSTALL_DIR="$HOME/.fnm"
elif [ -n "$XDG_DATA_HOME" ]; then
Expand Down Expand Up @@ -70,6 +74,9 @@ set_filename() {
elif [ "$OS" = "Darwin" ]; then
USE_HOMEBREW="true"
echo "Downloading fnm using Homebrew..."
elif [ "$OS" = "Windows" ] ; then
FILENAME="fnm-windows"
echo "Downloading the latest fnm binary from GitHub..."
else
echo "OS $OS is not supported."
echo "If you think that's a bug - please file an issue to https://github.com/Schniz/fnm/issues"
Expand Down Expand Up @@ -161,28 +168,29 @@ setup_shell() {
CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Zsh. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' export PATH="'"$INSTALL_DIR"':$PATH"'
echo ' eval "`fnm env`"'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'export PATH="'$INSTALL_DIR':$PATH"' >>$CONF_FILE
echo 'eval "`fnm env`"' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="'$INSTALL_DIR':$PATH"'
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"

elif [ "$CURRENT_SHELL" = "fish" ]; then
CONF_FILE=$HOME/.config/fish/conf.d/fnm.fish
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Fish. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' set PATH "'"$INSTALL_DIR"'" $PATH'
echo ' fnm env | source'

echo '# fnm' >>$CONF_FILE
echo 'set PATH "'"$INSTALL_DIR"'" $PATH' >>$CONF_FILE
echo 'fnm env | source' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'set FNM_PATH "'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]'
echo ' set PATH "$FNM_PATH" $PATH'
echo ' fnm env | source'
echo 'end'
} | tee -a "$CONF_FILE"

elif [ "$CURRENT_SHELL" = "bash" ]; then
if [ "$OS" = "Darwin" ]; then
Expand All @@ -192,15 +200,15 @@ setup_shell() {
fi
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Bash. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
echo ' export PATH="'"$INSTALL_DIR"':$PATH"'
echo ' eval "`fnm env`"'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'export PATH="'"$INSTALL_DIR"':$PATH"' >>$CONF_FILE
echo 'eval "`fnm env`"' >>$CONF_FILE
{
echo ''
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="$FNM_PATH:$PATH"'
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"

else
echo "Could not infer shell type. Please set up manually."
Expand Down
7 changes: 5 additions & 2 deletions .ci/print-command-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ async function getCommandHelp(fnmPath, command) {
const result = await run(fnmPath, [...cmdArg, "--help"])
const text = result.stdout
const rows = text.split("\n")
const headerIndex = rows.findIndex((x) => x.includes("SUBCOMMANDS"))
const headerIndex = rows.findIndex((x) => x.includes("Commands:"))
/** @type {string[]} */
const subcommands = []
if (!command) {
for (const row of rows.slice(headerIndex + 1)) {
for (const row of rows.slice(
headerIndex + 1,
rows.indexOf("", headerIndex + 1)
)) {
const [, word] = row.split(/\s+/)
if (word && word[0].toLowerCase() === word[0]) {
subcommands.push(word)
Expand Down
6 changes: 5 additions & 1 deletion .ci/record_screen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ RECORDING_PATH=$DIRECTORY/screen_recording

(rm -rf "$RECORDING_PATH" &> /dev/null || true)

asciinema rec -c "$DIRECTORY/recorded_screen_script.sh" "$RECORDING_PATH"
asciinema rec \
--command "$DIRECTORY/recorded_screen_script.sh" \
--cols 70 \
--rows 17 \
"$RECORDING_PATH"
sed "s@$TEMP_DIR@~@g" "$RECORDING_PATH" | \
svg-term \
--window \
Expand Down
94 changes: 46 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,52 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:

create_pull_request:
runs-on: ubuntu-latest
steps:
# set up
- uses: actions/checkout@v3

- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- uses: Swatinem/rust-cache@v2

- uses: pnpm/[email protected]
with:
run_install: false

# pnpm
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install script dependencies
run: |
sudo apt-get update
sudo apt-get install -y asciinema
- name: Install Node.js project dependencies
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: "pnpm version:prepare"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm
# set up
- uses: actions/checkout@v3

- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- uses: Swatinem/rust-cache@v2

- uses: pnpm/[email protected]
with:
run_install: false

# pnpm
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Asciinema
run: |
pipx install asciinema
- name: Install Node.js project dependencies
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: "pnpm version:prepare"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm
Loading

0 comments on commit 9868a12

Please sign in to comment.