Publish old versions without touching latest tag#472
Publish old versions without touching latest tag#472jablko wants to merge 7 commits intomicrosoft:mainfrom
Conversation
d36ff5b to
8ce850e
Compare
1d54b72 to
383193f
Compare
| "@types/tar": "^6.1.9", | ||
| "@types/tar-stream": "^3.1.3", | ||
| "@types/which": "^3.0.2", | ||
| "@qiwi/npm-types": "^1.0.3" |
There was a problem hiding this comment.
wait, wasn't this PR supposed to get rid of the @qiwi dep?
There was a problem hiding this comment.
This is one step, I have more changes I was building on this PR; probably I'll send a new one instead that includes this one.
| const tarData = await pacote.tarball(packageDir); | ||
| // Make sure we never assign the latest tag to an old version. | ||
| if (!dry) | ||
| await libpub.publish(manifest ? { ...manifest, bundledDependencies: undefined } : manifest, tarData, { |
There was a problem hiding this comment.
why might manifest be undefined? Should we publish if it's missing?
I noticed this because I'd prefer to pull out a manifest.bundledDependencies = undefined instead of a spread, but that doesn't work if it's possibly undefined.
| "@definitelytyped/header-parser": "workspace:*", | ||
| "@definitelytyped/retag": "workspace:*", | ||
| "@definitelytyped/utils": "workspace:*", | ||
| "libnpmpublish": "^9.0.3", |
There was a problem hiding this comment.
I thought this change would let us stop depending on npm-registry-publish, but it just adds the new dependency.
There was a problem hiding this comment.
Yeah, it's half a change; this PR removed some of the registry dep but not all.
|
|
||
| type NeedToFixNpmRegistryClientTypings = any; | ||
|
|
||
| export class NpmPublishClient { |
There was a problem hiding this comment.
this only tags and deprecates now. I'd rename to NpmTagger or something
and we seem to mostly create it on-demand, so maybe callers should switch to calling tag/deprecate directly.
| const token = await getSecret(Secret.NPM_TYPES_TOKEN); | ||
| const client = new NpmPublishClient(token); |
There was a problem hiding this comment.
splitting this statement seems unnecessary
Use the
defaultTagoption when publishing old versions to avoid changing thelatesttag and then having to undo and retag the latest version:DefinitelyTyped-tools/packages/types-publisher/src/lib/package-publisher.ts
Lines 23 to 26 in 5ccbffd
I switched to using libnpmpublish because I couldn't pass the
defaultTagoption to npm-registry-client's publish() method. libnpmpublish is what the npm CLI's publish command now uses.