Skip to content

Commit

Permalink
separate npm from nodejs, and update npm/pnpm deps
Browse files Browse the repository at this point in the history
Signed-off-by: sunrisepeak <[email protected]>
  • Loading branch information
Sunrisepeak committed Jan 23, 2025
1 parent 1c3a3ea commit 21ffb31
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
59 changes: 58 additions & 1 deletion pkgs/n/npm.lua
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
package = { ref = "[email protected]" }
package = {
homepage = "https://www.npmjs.com",
name = "npm",
description = "The package manager for JavaScript",
licenses = "Artistic License 2.0",
repo = "https://github.com/npm/cli",
docs = "https://docs.npmjs.com/cli",

-- xim pkg info
archs = {"x86_64"},
status = "stable", -- dev, stable, deprecated
categories = {"package-manager", "javascript"},

xpm = {
windows = {
deps = { "nodejs" },
["latest"] = { ref = "11.0.0" },
["11.0.0"] = { },
["10.9.2"] = { },
},
linux = {
deps = { "nodejs" },
["latest"] = { ref = "11.0.0" },
["11.0.0"] = { },
["10.9.2"] = { },
},
debian = { ref = "linux" },
ubuntu = { ref = "linux" },
archlinux = { ref = "linux" },
manjaro = { ref = "linux" },
},
}

import("xim.base.runtime")

local pkginfo = runtime.get_pkginfo()

function installed()
return os.iorun("xvm list npm")
end

function install()
local npm_installcmd_template = "npm install -g npm@%s --prefix %s"
os.iorun(string.format(npm_installcmd_template, pkginfo.version, pkginfo.install_dir))
return true
end

function config()
print("config xvm...")
local xvm_npm_template = "xvm add npm %s --path %s/bin"
os.exec(string.format(xvm_npm_template, pkginfo.version, pkginfo.install_dir))
return true
end

function uninstall()
os.exec("xvm remove npm " .. pkginfo.version)
return true
end
4 changes: 2 additions & 2 deletions pkgs/p/pnpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ package = {

xpm = {
windows = {
deps = { "nodejs@22.12.0" },
deps = { "nodejs" },
["latest"] = { ref = "9.15.0"},
["9.15.0"] = { },
},
linux = {
deps = { "nodejs@22.12.0" },
deps = { "nodejs" },
["latest"] = { ref = "9.15.0"},
["9.15.0"] = { },
},
Expand Down

0 comments on commit 21ffb31

Please sign in to comment.