diff --git a/.bash_profile b/.bash_profile index 16f9b1b..5166ad2 100644 --- a/.bash_profile +++ b/.bash_profile @@ -7,4 +7,4 @@ fi # User specific environment and startup programs -PATH="$PATH:$HOME/.cargo/bin:$HOME/.npm-global/bin" +PATH="$HOME/.npm-global/bin:$PATH:$HOME/.cargo/bin" diff --git a/.config/kitty/up.session b/.config/kitty/up.session index 397306a..d92904b 100644 --- a/.config/kitty/up.session +++ b/.config/kitty/up.session @@ -4,4 +4,5 @@ launch fish -c "python ~/.scripts/update.py rpm-ostree" launch fish -c "python ~/.scripts/update.py flatpak" launch fish -c "python ~/.scripts/update.py pipx" launch fish -c "python ~/.scripts/update.py cargo" +launch fish -c "python ~/.scripts/update.py npm" launch fish -c "python ~/.scripts/update.py nvim" diff --git a/.scripts/fetch_installed_packages.py b/.scripts/fetch_installed_packages.py index d4384da..d7a9e7d 100644 --- a/.scripts/fetch_installed_packages.py +++ b/.scripts/fetch_installed_packages.py @@ -49,6 +49,17 @@ def cargo_packages(output_dir): f.write(crate + "\n") +def npm_packages(output_dir): + out = cap_run("npm list --json --location=global") + json_out = json.loads(out) + deps = json_out["dependencies"].keys() + + file = output_dir / "npm.txt" + with file.open("w") as f: + for dep in deps: + f.write(dep + "\n") + + def pipx_packages(output_dir): out = cap_run("pipx list --json") json_out = json.loads(out) @@ -82,6 +93,8 @@ def main(): cargo_packages(output_dir) + npm_packages(output_dir) + if __name__ == "__main__": main() diff --git a/.scripts/update.py b/.scripts/update.py index b1a2db0..6b88c34 100644 --- a/.scripts/update.py +++ b/.scripts/update.py @@ -58,6 +58,10 @@ def update_nvim(): run('nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"') +def update_npm(): + run("npm update --location=global") + + def main(input): if input == "rpm-ostree": update_rpm_ostree() @@ -69,6 +73,8 @@ def main(input): update_pipx() elif input == "nvim": update_nvim() + elif input == "npm": + update_npm() else: print(f"Input {input} not valid!")