mirror of
https://codeberg.org/Mo8it/dotfiles.git
synced 2024-10-17 20:52:40 +00:00
Add npm, again
This commit is contained in:
parent
484bb00c1d
commit
a0d594e49e
4 changed files with 21 additions and 1 deletions
|
@ -7,4 +7,4 @@ fi
|
||||||
|
|
||||||
# User specific environment and startup programs
|
# User specific environment and startup programs
|
||||||
|
|
||||||
PATH="$PATH:$HOME/.cargo/bin:$HOME/.npm-global/bin"
|
PATH="$HOME/.npm-global/bin:$PATH:$HOME/.cargo/bin"
|
||||||
|
|
|
@ -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 flatpak"
|
||||||
launch fish -c "python ~/.scripts/update.py pipx"
|
launch fish -c "python ~/.scripts/update.py pipx"
|
||||||
launch fish -c "python ~/.scripts/update.py cargo"
|
launch fish -c "python ~/.scripts/update.py cargo"
|
||||||
|
launch fish -c "python ~/.scripts/update.py npm"
|
||||||
launch fish -c "python ~/.scripts/update.py nvim"
|
launch fish -c "python ~/.scripts/update.py nvim"
|
||||||
|
|
|
@ -49,6 +49,17 @@ def cargo_packages(output_dir):
|
||||||
f.write(crate + "\n")
|
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):
|
def pipx_packages(output_dir):
|
||||||
out = cap_run("pipx list --json")
|
out = cap_run("pipx list --json")
|
||||||
json_out = json.loads(out)
|
json_out = json.loads(out)
|
||||||
|
@ -82,6 +93,8 @@ def main():
|
||||||
|
|
||||||
cargo_packages(output_dir)
|
cargo_packages(output_dir)
|
||||||
|
|
||||||
|
npm_packages(output_dir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -58,6 +58,10 @@ def update_nvim():
|
||||||
run('nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"')
|
run('nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"')
|
||||||
|
|
||||||
|
|
||||||
|
def update_npm():
|
||||||
|
run("npm update --location=global")
|
||||||
|
|
||||||
|
|
||||||
def main(input):
|
def main(input):
|
||||||
if input == "rpm-ostree":
|
if input == "rpm-ostree":
|
||||||
update_rpm_ostree()
|
update_rpm_ostree()
|
||||||
|
@ -69,6 +73,8 @@ def main(input):
|
||||||
update_pipx()
|
update_pipx()
|
||||||
elif input == "nvim":
|
elif input == "nvim":
|
||||||
update_nvim()
|
update_nvim()
|
||||||
|
elif input == "npm":
|
||||||
|
update_npm()
|
||||||
else:
|
else:
|
||||||
print(f"Input {input} not valid!")
|
print(f"Input {input} not valid!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue