Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardfoyle committed Apr 4, 2024
1 parent 72679d6 commit 2480023
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/components/npm_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class NpmClient {
deprecationMessage: string
) => {
await this
.execWithIO`npm deprecate ${packageVersionSpecifier} "${deprecationMessage}"`;
.execWithIO`npm deprecate ${packageVersionSpecifier} ${deprecationMessage}`;
};

unDeprecatePackage = async (packageVersionSpecifier: string) => {
Expand Down
22 changes: 17 additions & 5 deletions scripts/components/release_lifecycle_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { runVersion } from '../version_runner.js';
import { runPublish } from '../publish_runner.js';
import { ReleaseLifecycleManager } from './release_lifecycle_manager.js';
import { GithubClient } from './github_client.js';
import assert from 'node:assert';

/**
* This test suite is more of an integration test than a unit test.
Expand Down Expand Up @@ -41,11 +42,17 @@ void describe('ReleaseLifecycleManager', async () => {
* It seeds the local npm proxy with a few releases of these packages.
* When its done, the state of the git refs npm dist-tags should be as follows:
*
* minor bump of cantaloupe only ● <- HEAD, cantaloupe@1.3.0, cantaloupe@latest
* third release commit ● <- HEAD, cantaloupe@1.3.0, cantaloupe@latest
* |
* minor bump of cantaloupe and platypus ● <- cantaloupe@1.2.0, platypus@1.2.0, platypus@latest
* minor bump of cantaloupe only ●
* |
* minor bump of cantaloupe and platypus ● <- cantaloupe@1.1.0, platypus@1.1.0
* second release commit ● <- cantaloupe@1.2.0, platypus@1.2.0, platypus@latest
* |
* minor bump of cantaloupe and platypus ●
* |
* first release commit ● <- cantaloupe@1.1.0, platypus@1.1.0
* |
* minor bump of cantaloupe and platypus ●
* |
* initial commit ● <- cantaloupe@1.0.0, platypus@1.0.0
*
Expand Down Expand Up @@ -136,10 +143,15 @@ void describe('ReleaseLifecycleManager', async () => {
npmClient
);
await releaseLifecycleManager.deprecateRelease('cantaloupe is rotten');
// switch back to the original branch
await gitClient.switchToBranch('main');

// expect latest of cantaloupe to point back to 1.2.0 and 1.3.0 to be marked deprecated
// platypus should not be modified
// const await npmClient.getPackageInfo(cantaloupePackageName);

const { 'dist-tags': distTags, deprecated } =
await npmClient.getPackageInfo(`${cantaloupePackageName}@1.3.0`);
assert.equal(distTags.latest, '1.2.0');
assert.equal(deprecated, 'cantaloupe is rotten');
});
});

Expand Down
2 changes: 1 addition & 1 deletion scripts/components/release_lifecycle_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class ReleaseLifecycleManager {
)!, // this is safe because gitClient.getPreviousReleaseTags already ensures that we have found a previous version for all packages
distTagsToMove: [],
};
const { ['dist-tags']: distTags } = await this.npmClient.getPackageInfo(
const { 'dist-tags': distTags } = await this.npmClient.getPackageInfo(
releaseTag
);
Object.entries(distTags).forEach(([tagName, versionAtTag]) => {
Expand Down

0 comments on commit 2480023

Please sign in to comment.