Skip to content

Commit

Permalink
chore: release beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ghusse authored Jan 7, 2022
2 parents d6e386b + a2992f3 commit 8cd981d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 3 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
## [1.3.2-beta.3](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.3.2-beta.2...v1.3.2-beta.3) (2022-01-07)


### Bug Fixes

* :bug: don't quotes versions, only ignore 400 errors ([#40](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/issues/40)) ([1c14322](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/1c143220c4b7fb9899b40debb0d01caf10c2c868))

## [1.3.2-beta.2](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.3.2-beta.1...v1.3.2-beta.2) (2022-01-07)


### Bug Fixes

* :bug: don't quotes versions, only ignore 400 errors ([#39](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/issues/39)) ([638dbba](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/638dbba62e7eb7a47c0b2417c31a790f23503c00))

## [1.3.2-beta.1](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.3.1...v1.3.2-beta.1) (2022-01-07)


### Bug Fixes

* :bug: quote the version number to deprecate to avoid errors 400 returned by npm ([#36](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/issues/36)) ([85a3fd7](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/85a3fd73225f771cf10f7e8f9a2b6c03a015b58b))

## [1.3.2-alpha.1](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.3.1...v1.3.2-alpha.1) (2022-01-07)


### Bug Fixes

* :bug: quote the version number to deprecate to avoid errors 400 returned by npm ([#36](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/issues/36)) ([85a3fd7](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/85a3fd73225f771cf10f7e8f9a2b6c03a015b58b))

## [1.3.1](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.3.0...v1.3.1) (2022-01-03)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "semantic-release-npm-deprecate-old-versions",
"version": "1.3.1",
"version": "1.3.2-beta.3",
"description": "A plugin for semantic-release, to automatically deprecate old versions on npm, based on a custom configuration",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
42 changes: 42 additions & 0 deletions src/deprecier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,48 @@ describe("Deprecier", () => {
verifyAll();
});

it("should log a message when a 400 is thrown", async () => {
const { deprecier, npm } = setup();

const packageInfo: PackageInfo = {
name: "name",
versions: {
"1.0.0": {
version: "1.0.0",
name: "name",
},
},
};

const context = mock<Context & Config>();

const logger = mock<Logger>();
when(
logger.log(
"Version 1.0.0 could not be deprecated, it has not been found. It could be a bug of the registry."
)
).thenReturn(undefined);

when(context.logger).thenReturn(instance(logger));

const reason = "reason";

when(
npm.deprecate(
{ name: "name", version: "1.0.0", reason },
instance(context)
)
).thenReject(new NpmError("E400", "", new Error()));

await deprecier.deprecate(
packageInfo,
{ version: new SemVer("1.0.0"), reason },
instance(context)
);

verifyAll();
});

it("should log and rethrow unexpected errors", async () => {
const { deprecier, npm } = setup();

Expand Down
2 changes: 1 addition & 1 deletion src/deprecier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Deprecier {
context.logger.log(
`Version ${version.format()} could not be deprecated, is it already deprecated?`
);
} else if (npmError.code === "E404") {
} else if (["E404", "E400"].includes(npmError.code)) {
context.logger.log(
`Version ${version.format()} could not be deprecated, it has not been found. It could be a bug of the registry.`
);
Expand Down

0 comments on commit 8cd981d

Please sign in to comment.