pnpm icon indicating copy to clipboard operation
pnpm copied to clipboard

Add pnpm installation methods using standard OS package managers

Open zkochan opened this issue 2 years ago • 44 comments

  • [x] dnf/yum
    • [x] https://github.com/pnpm/pnpm/pull/3622
  • [x] apt
    • [x] https://github.com/pnpm/pnpm/pull/3634
  • [x] brew
  • [x] chocolatey
  • [x] scoop
  • [ ] pacman

Related: https://github.com/pnpm/pnpm/issues/3624

For inspiration:

  • https://github.com/vercel/hyper (how does it update itself?)
  • https://github.com/yarnpkg/releases

zkochan avatar Jul 31 '21 13:07 zkochan

For Arch Linux, an AUR already exists, so you can safely remove the "pacman" entry.

KSXGitHub avatar Aug 01 '21 09:08 KSXGitHub

But it uses the plain js version of pnpm, not the one compiled to an executable

Khải @.***> ezt írta (időpont: 2021. aug. 1., V 12:51):

For Arch Linux, an AUR https://aur.archlinux.org/packages/pnpm/ already exists, so you can safely remove the "pacman" entry.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pnpm/pnpm/issues/3633#issuecomment-890486901, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOWTG6FTIIU6BI3PFGZPFDT2UKJBANCNFSM5BKAWMCQ .

zkochan avatar Aug 01 '21 10:08 zkochan

If you still find the pacman version necessary then go for it. What I was trying to say is if you don't want to maintain too many targets then feel free to remove "pacman" from the list (I don't think it's going to be a huge impact, because Arch Linux users prefer their system to be lightweight, i.e. use nodejs as a shared dependency instead of duplicating it).

KSXGitHub avatar Aug 01 '21 10:08 KSXGitHub

Actually, isn't it better to just create an AUR (called pnpm-standalone or pnpm-bundled or whatever) that downloads and installs pnpm executables? I also have a github action that publishes PKGBUILD and .SRCINFO to the AUR (you have to generate the PKGBUILD yourself, the action would then generate .SRCINFO from provided PKGBUILD).

KSXGitHub avatar Aug 01 '21 10:08 KSXGitHub

I want the executable version to be the default one starting from pnpm v7. If someone would love the plain js version, we may ship that separately.

zkochan avatar Aug 01 '21 11:08 zkochan

@zkochan silent installation of NodeJS is quite simple, I could help with Windows (I've built electric) so feel free to let me know what info you would need

suptejas avatar Aug 05 '21 18:08 suptejas

I was trying to build the deb/rpm packages automatically with GitHub actions but no luck for now.

First I tried to do it using these tools: pkg-deb and pkg-rpm

However, the artifact generated by pkg-deb via GitHub action doesn't work when I try to use it on Ubuntu. When I built the artifact locally, it worked.

Now I am looking into nFPM. It is not as convenient as the above tools (which reuse info from package.json) but it can build both deb and rpm with no additional dependencies installed. The deb artifact built with it seems to work.

zkochan avatar Aug 05 '21 19:08 zkochan

silent installation of NodeJS is quite simple

There is no need to install Node.js. pnpm is built into an executable together with Node.js. So just pnpm needs to be installed, and it will work even if there is no Node.js installed on the target system.

zkochan avatar Aug 05 '21 19:08 zkochan

I think for now it will be easier to use a standalone shell script to install pnpm (I already worked on it here).

And in the future we may add support for different system package managers, if needed.

zkochan avatar Aug 05 '21 20:08 zkochan

@zkochan I'm working on the pnpm Homebrew formula. Please help me. https://github.com/Homebrew/homebrew-core/pull/82892

umireon avatar Aug 08 '21 08:08 umireon

I can look into the PR later.

If you have some specific questions, feel free to ask here or in the chatroom.

Regarding shipping pnpm binaries as independent executables, the plan is to ship them by default from pnpm v7. If you want to use the binaries for brew, they are uploaded already to the release page: https://github.com/pnpm/pnpm/releases/tag/v6.12.1

I think I can add binaries for arm architecture as well.

zkochan avatar Aug 09 '21 11:08 zkochan

@zkochan Thanks for your kind responce! What I need now is the linuxstatic binary for Linuxbrew and the arm64 binary for M1 Mac.

Regarding shipping pnpm binaries as independent executables, the plan is to ship them by default from pnpm v7. If you want to use the binaries for brew, they are uploaded already to the release page: https://github.com/pnpm/pnpm/releases/tag/v6.12.1

Homebrew will never allow the prebuilt binaries for OSS. The binaries must be built from the Homebrew's definitions (formulae) and from their sources. (For example, the node's formula)

umireon avatar Aug 09 '21 11:08 umireon

Is MacPorts going to be supported as well?

hronro avatar Aug 15 '21 10:08 hronro

Is MacPorts going to be supported as well?

We will accept contributions that add support for any package managers and/or systems.

But for now I want to concentrate on creating a cross-platform shell script for installing pnpm on any system. As I mentioned above, I already have one in progress: https://github.com/pnpm/get/blob/main/beta-install.sh

However, we started to use the XDG desktop standard, so finding the right location is a bit hard. I think I will use the following steps to install pnpm using the standalone script:

  1. Download the latest tarball of pnpm
  2. Unpack it
  3. Run pnpm setup. pnpm setup will:
    1. Find the correct location for the pnpm home directory
    2. Add the pnpm home directory to the PATH (by modifying shell bootstrap scripts)
    3. Move (or copy and remove) the pnpm binary to the home directory

zkochan avatar Aug 17 '21 16:08 zkochan

@zkochan Will the preferred global bin be changed from writable /usr/local/bin by respecting XDG standard? This is essential for Homebrew.

umireon avatar Aug 17 '21 17:08 umireon

But for now I want to concentrate on creating a cross-platform shell script for installing pnpm on any system. As I mentioned above, I already have one in progress: https://github.com/pnpm/get/blob/main/beta-install.sh

Shellcheck will help you very much. https://github.com/pnpm/get/pull/3

umireon avatar Aug 17 '21 17:08 umireon

The XDG standard is for Linux. What should be the preferred home direrory location for pnpm on macOS?

zkochan avatar Aug 17 '21 18:08 zkochan

@zkochan

The XDG standard is for Linux. What should be the preferred home direrory location for pnpm on macOS?

I suggest ~/Library/Application Support/pnpm.

umireon avatar Aug 18 '21 04:08 umireon

Im patiently waiting for this to be complete! (fingers crossed) as I would prefer to get the pnpm cli fully compatible with alpine and able to use pnpm env to install nodejs on alpine linux.

I am currenlty resorting to nodejs-current apack in my repo :(

noahehall avatar Oct 15 '21 15:10 noahehall

We already ship all the necessary assets. I don't have experience with any of these system package managers but it shouldn't be hard to add support for them as the assets are present

zkochan avatar Oct 15 '21 16:10 zkochan

@zkochan i've resorted to installing the pnpm cli separately from the nodejs binary (using the one available in alpine contributing repo)

but i do plan on addressing this later as i use pnpm env to manage my entire node setup when on baremetal and its fkn awesome

noahehall avatar Oct 16 '21 01:10 noahehall

@zkochan I think we should have our own repository dedicated to the latest pnpm binary. All the OS standard repositories of package managers cannot catch up with the development speed of pnpm (except Homebrew afaik). Do you know what apt install nodejs in the latest Debian distribution installs?

_人人人人人_ > 12.22.5 <  ̄Y^Y^Y^Y^Y^ ̄

This is why Docker and Yarn have their own repository. At least with my experiences of Debian packages, pnpm needs its own repository in Debian and Ubuntu.

Building the repository would be hard but once it establishes users can use it easily because there is plenty of third-party repositories and tools to register such repositories.

umireon avatar Oct 20 '21 16:10 umireon

I don't have objections

zkochan avatar Oct 20 '21 16:10 zkochan

I will investigate how we can have our own repository in Debian and Ubuntu. We would need some hosting. Of course, I will make my best effort in the brew as you know 😉

umireon avatar Oct 20 '21 16:10 umireon

we have a hosting on netlify

zkochan avatar Oct 20 '21 16:10 zkochan

How much bandwidth do we have?

umireon avatar Oct 20 '21 16:10 umireon

image

we also have cloudflare, so I am not sure why so much bandwidth is consumed.

zkochan avatar Oct 20 '21 16:10 zkochan

400 GB / mo might not be enough for production but we can try. I think aptly is what we need for Debian and Ubuntu. It can publish to AWS S3.

umireon avatar Oct 20 '21 16:10 umireon

Can we have S3-compatible cloud storage or AWS S3 as a backend of Netlify or CloudFlare? We need to find a corresponding tool to aptly in the dnf/yum world if that is true. https://www.aptly.info/doc/feature/s3/

umireon avatar Oct 20 '21 17:10 umireon

can't we just commit to a git repo?

zkochan avatar Oct 20 '21 17:10 zkochan

That cannot (I know this is technically possible but would go very messy) be automated and the size of the git repo grows rapidly. Ideally, the repository would have a new deb package on each release, and this requires automation. If that the binary version from the standard package manager is old and not the latest is acceptable, I think a git repo is a good solution.

umireon avatar Oct 20 '21 19:10 umireon

Well, we should use a free solution if possible. S3 is not free and I would be afraid to use my card.

zkochan avatar Oct 20 '21 20:10 zkochan

Many big distros provide a way to host a custom repository. Ubuntu has PPAs, Fedora has Copr, etc. I'm guessing we could benefit from them.

BasixKOR avatar Oct 25 '21 17:10 BasixKOR

From searching around, you may be able to use GitHub Pages for this, for free. I found a guide that might help. The same concept likely applies for Cloudflare Pages, Netlify, etc.

bompus avatar Oct 26 '21 17:10 bompus

@zkochan your wrong here you can make it easy if you like https://snapcraft.io/ and https://appimage.org/

frank-dspeed avatar Mar 28 '22 05:03 frank-dspeed

If you host in a GitHub repo, you could amend the first commit every time, so the repo size stays completely under control, and will only ever have 1 commit.

JJRcop avatar Mar 28 '22 13:03 JJRcop

Might be worth to investigate https://build.opensuse.org/ which lets you build for many linux distributions.

millette avatar Mar 29 '22 02:03 millette

i still think the final solution is to port the algos in a way that npm can execute them we do not need a extra package manager. while sure why not but at last it should be compatible.

frank-dspeed avatar Mar 29 '22 12:03 frank-dspeed

we do not need a extra package manager

Respectfully, this is off-topic and doesn't belong in this discussion

JJRcop avatar Mar 29 '22 13:03 JJRcop

@JJRcop ok package-manager is off topic for a package-manager that has pn in its name got it even if this is also offtopic what kind of philosophie is that? Is that the mind set of all contributors here?

frank-dspeed avatar Apr 01 '22 01:04 frank-dspeed

@frank-dspeed what makes you think that pnpm is not installable by npm?

These work:

npm i -g pnpm
# or
npm i -g @pnpm/exe

zkochan avatar Apr 01 '22 02:04 zkochan

@zkochan no you got me wrong my frind sorry sure it is install able per npm no question about that my proposal was again to make the people aware that it would be clever to split the pnpm algos a bit and offer some extra cli tools as interface to maintain existing npm installs with that algos as the new workspace features in npm 8.4 + is better then the one in pnpm

and verdaccio as a proxy is nothing complex to configure for npm also

i simply want do dedup the ecosystem a bit i am working on my own coding lang and i spotted a lot of cluttered dedup able projects in the NPM Ecosystem

pnpm is one of it it is a cli for verdaccio with some defaults and extra tooling and so on as also that cli

and i see clear out of my high level view that we create the same tools over and over with diffrent defaults and all share the same packages as sub dependencies that leads to the final conclusion that all this projects would be better merged together so that they can take care of the sub dependencies that they already got.

PNPM shares issues and problems with YARN Typescript Rollup NPM VERDACCIO and all the sub dependencies and dev dependencies that all this projects inhire. And there are a lot of real urgent problems.

PNPM was a good tool and the patterns are still good but the next step is to drop none needed code and the package-manager and is not needed Maintaining existing lockfiles and some verdaccio tooling would be the ideal successor in long term.

frank-dspeed avatar Apr 01 '22 02:04 frank-dspeed

Packaging status

It looks like scoop and choco are already supported.

kecrily avatar May 25 '22 13:05 kecrily

The XDG standard is for Linux. What should be the preferred home direrory location for pnpm on macOS?

Would like to mention (a bit late) that I believe there are programs that follow the XDG standard on macos too

meadowsys avatar Jun 18 '22 04:06 meadowsys