1
0
Fork 0

improved node setup

This commit is contained in:
Kim, Jimin 2022-05-06 12:26:10 +09:00
parent 12d0f7b55a
commit ec6793db2f
3 changed files with 31 additions and 9 deletions

View file

@ -2,6 +2,9 @@
# this variable may be altered by the script
# most notably by `src/interface/choose_action.py`
from os import system
content_dir = "/tmp/com.developomp.setup"
tmp_dir = content_dir
home_dir = "/home/pomp"
is_zsh_available: bool = system("command -v zsh &> /dev/null") == 0

View file

@ -1,6 +1,10 @@
from src.util import paru_install
from os import system
from os.path import isdir
from src.constants import home_dir, is_zsh_available
from src.util import paru_install, zsh_system
from src.setup.system import zsh
from src import log
name = "node"
@ -11,17 +15,25 @@ def setup():
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
nodejs: Javascript on servers!
nvm: NodejS version manager
npm: node package manager
yarn: better node package manager
check .zshrc for bin path stuff
nvm: NodejS version manager
pnpm: better node package manager
yarn: better node package manager
"""
# Install zsh if it's not installed already
if not is_zsh_available:
zsh.setup()
paru_install("nvm")
system("nvm install --lts")
log.log("Installing Node.JS LTS")
zsh_system("source /usr/share/nvm/init-nvm.sh; nvm install --lts")
log.log("Installing npm")
system("npm install --global npm")
log.log("Installing pnpm")
system("npm install --global pnpm")
log.log("Installing yarn")
system("npm install --global yarn")

View file

@ -107,6 +107,13 @@ def import_file(name, path):
return SourceFileLoader(name, path).load_module()
def zsh_system(command: str):
"""os.system but uses zsh.
The command should not contain a single quote (') that's not escaped."""
system(f"/usr/bin/zsh -c '{command}'")
"""
def setup_essentials():
setup_fstab