Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support static seed publishing #7

Merged
merged 3 commits into from
Apr 14, 2020
Merged

Support static seed publishing #7

merged 3 commits into from
Apr 14, 2020

Conversation

rmg
Copy link
Member

@rmg rmg commented May 29, 2017

Rather than supporting npm publish, this feature allows a tarball to be fed as input when the container is started and have that package tarball (and associated metadata) overlayed on top of whatever metadata upstream is providing.

To test some local changes as a patch release:

$ npm info .dist-tags.latest
1.2.2
$ npm pack
my-package-1.2.3.tgz
$ cat my-package-1.2.3.tgz | docker run -i -p 4873:4873 strongloop/ephemeral-npm:nginx
...

elsewhere, in a package that depends on my-package@1.2.x

$ npm install --registry=http://127.0.0.1:4873/
my-app@1.2.2 /Users/ryan/work/my-app
└── my-package@1.2.3
...

We can now test unreleased changes as though they had been tested without introducing package linking as a test environment complication.

rmg added 3 commits May 29, 2017 13:55
Glob patterns expand to what they match, which makes them useless for
creating things that don't yet exist.
By putting a multi-version file at /tmp/npm/store/<pkgname>/package.json
you can effectively lock a package to a given selection of versions for
the lifetime of the npm registry.

This file should be analogous to what would normally be served up at
https://registry.npmjs.org/<pkgname>
Read input from STDIN on startup. If it is a tgz file, then assume it is
a node package as produced by `npm pack`. Read that tarball in and
extract the metadata from the 'package/package.json' contained in it.

Use this extracted metadata to fetch the upstream registry's metadata
for the given package and then augment the version-specific metadata for
version given in the tarball such that it looks like it was recently
published.

Use shasum to calculate the digest and then pre-seed the paths where
nginx will look for the package.json and package-X.Y.Z.tgz so that it
doesn't even bother looking upstream for them.
@jtary
Copy link

jtary commented May 29, 2017

LGTM

@rmg rmg merged commit 9a8b9b5 into nginx Apr 14, 2020
@delete-merged-branch delete-merged-branch bot deleted the nginx-preseed branch April 14, 2020 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants