Reputation: 4097
I've been trying to work out how to push historical NPM packages to Github.
My company wants to move it's package hosting/management from a private package manager to Github Packages. So, we have a whole history of versions, going back several years and we want to move them all across.
The instructions in the Github document only seems to deal with the situation of the current state of the source code. For example, you configure your .npmrc
and packages.json
and do an npm publish
. That creates a package and publishes it.
But there's nothing about posting an existing/historical package. Not even in the Github REST API.
With nuget, this was simple. You just pushed each .nuget
file with the relevant dotnet
command. I can't seem to find an equivalent with NPM.
So how do I get my whole history of npm tgz
files from my current package manager to Github packages?
Upvotes: 0
Views: 133
Reputation: 4097
The command to run is:
npm publish -file nameOfPackage-1.0.2.tgz
This the tgz file does not even need to be in the same directory as the package. But you do need an .npmrc
file in the same directory with the url of Github packages and the auth token stuff. The dodo sets this out, but it looks something like this:
//npm.pkg.github.com/:_authToken=ghp_Nb8UPJfEkigtZaGxRhNroyIKBRbAke17rT6o
(not a real Personal Access Token)
Upvotes: 0