Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@metamask/auto-changelog

Package Overview
Dependencies
Maintainers
8
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/auto-changelog - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

50

dist/cli.js

@@ -91,3 +91,3 @@ #!/usr/bin/env node

const changelogContent = await readChangelog(changelogPath);
const newChangelogContent = await update_changelog_1.updateChangelog({
const newChangelogContent = await (0, update_changelog_1.updateChangelog)({
changelogContent,

@@ -121,3 +121,3 @@ currentVersion,

try {
validate_changelog_1.validateChangelog({
(0, validate_changelog_1.validateChangelog)({
changelogContent,

@@ -134,3 +134,3 @@ currentVersion,

const { validChangelog, invalidChangelog } = error.data;
const diff = generate_diff_1.generateDiff(validChangelog, invalidChangelog);
const diff = (0, generate_diff_1.generateDiff)(validChangelog, invalidChangelog);
return exitWithError(`Changelog not well-formatted. Diff:\n\n${diff}`);

@@ -145,2 +145,12 @@ }

/**
* Returns whether an error has an error code or not.
*
* @param error - The error to check.
* @returns True if the error is a real error and has a code property, false otherwise.
*/
function hasErrorCode(error) {
return (error instanceof Error &&
Object.prototype.hasOwnProperty.call(error, 'code'));
}
/**
* Create a new empty changelog.

@@ -154,3 +164,3 @@ *

async function init({ changelogPath, repoUrl, tagPrefix }) {
const changelogContent = await init_1.createEmptyChangelog({ repoUrl, tagPrefix });
const changelogContent = await (0, init_1.createEmptyChangelog)({ repoUrl, tagPrefix });
await saveChangelog(changelogPath, changelogContent);

@@ -176,3 +186,3 @@ }

.option('repo', {
default: repo_1.getRepositoryUrl(),
default: (0, repo_1.getRepositoryUrl)(),
description: `The GitHub repository URL`,

@@ -195,3 +205,3 @@ type: 'string',

async function main() {
const { argv } = yargs_1.default(helpers_1.hideBin(process.argv))
const { argv } = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
.command('update', 'Update CHANGELOG.md with any changes made since the most recent release.\nUsage: $0 update [options]', (_yargs) => configureCommonCommandOptions(_yargs)

@@ -236,8 +246,10 @@ .option('rc', {

catch (error) {
if (error.code === 'ENOENT') {
return exitWithError(`Root directory specified does not exist: '${projectRootDirectory}'`);
if (hasErrorCode(error)) {
if (error.code === 'ENOENT') {
return exitWithError(`Root directory specified does not exist: '${projectRootDirectory}'`);
}
else if (error.code === 'EACCES') {
return exitWithError(`Access to root directory is forbidden by file access permissions: '${projectRootDirectory}'`);
}
}
else if (error.code === 'EACCES') {
return exitWithError(`Access to root directory is forbidden by file access permissions: '${projectRootDirectory}'`);
}
throw error;

@@ -258,9 +270,11 @@ }

catch (error) {
if (error.code === 'ENOENT') {
return exitWithError(`Package manifest not found at path: '${manifestPath}'\nRun this script from the project root directory, or set the project directory using the '--root' flag.`);
if (hasErrorCode(error)) {
if (error.code === 'ENOENT') {
return exitWithError(`Package manifest not found at path: '${manifestPath}'\nRun this script from the project root directory, or set the project directory using the '--root' flag.`);
}
else if (error.code === 'EACCES') {
return exitWithError(`Access to package manifest is forbidden by file access permissions: '${manifestPath}'`);
}
}
else if (error.code === 'EACCES') {
return exitWithError(`Access to package manifest is forbidden by file access permissions: '${manifestPath}'`);
}
else if (error.name === 'SyntaxError') {
if (error instanceof Error && error.name === 'SyntaxError') {
return exitWithError(`Package manifest cannot be parsed as JSON: '${manifestPath}'`);

@@ -297,3 +311,3 @@ }

catch (error) {
if (error.code === 'ENOENT') {
if (hasErrorCode(error) && error.code === 'ENOENT') {
return exitWithError(`File does not exist: '${changelogPath}'`);

@@ -300,0 +314,0 @@ }

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -7,2 +7,3 @@ "use strict";

exports.parseChangelog = void 0;
const semver_1 = __importDefault(require("semver"));
const changelog_1 = __importDefault(require("./changelog"));

@@ -87,6 +88,9 @@ const constants_1 = require("./constants");

if (line.startsWith('## [')) {
const results = line.match(/^## \[(\d+\.\d+\.\d+)\](?: - (\d\d\d\d-\d\d-\d\d))?(?: \[(\w+)\])?/u);
const results = line.match(/^## \[([^[\]]+)\](?: - (\d\d\d\d-\d\d-\d\d))?(?: \[(\w+)\])?/u);
if (results === null) {
throw new Error(`Malformed release header: '${truncated(line)}'`);
}
if (semver_1.default.valid(results[1]) === null) {
throw new Error(`Invalid SemVer version in release header: '${truncated(line)}'`);
}
// Trailing newline removed because the release section is expected to

@@ -93,0 +97,0 @@ // be prefixed by a newline.

@@ -161,3 +161,3 @@ "use strict";

}
const changelog = parse_changelog_1.parseChangelog({
const changelog = (0, parse_changelog_1.parseChangelog)({
changelogContent,

@@ -226,3 +226,3 @@ repoUrl,

async function runCommand(command, args) {
return (await execa_1.default(command, [...args])).stdout
return (await (0, execa_1.default)(command, [...args])).stdout
.trim()

@@ -229,0 +229,0 @@ .split('\n')

@@ -89,3 +89,3 @@ "use strict";

var _a, _b;
const changelog = parse_changelog_1.parseChangelog({ changelogContent, repoUrl, tagPrefix });
const changelog = (0, parse_changelog_1.parseChangelog)({ changelogContent, repoUrl, tagPrefix });
const hasUnreleasedChanges = Object.keys(changelog.getUnreleasedChanges()).length !== 0;

@@ -92,0 +92,0 @@ const releaseChanges = currentVersion

{
"name": "@metamask/auto-changelog",
"version": "3.0.0",
"version": "3.1.0",
"description": "Utilities for validating and updating \"Keep a Changelog\" formatted changelogs",

@@ -30,3 +30,3 @@ "publishConfig": {

"build:clean": "rimraf dist && yarn build",
"build": "tsc --project .",
"build": "tsc --project tsconfig.build.json",
"changelog": "node dist/cli.js"

@@ -65,3 +65,3 @@ },

"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
"typescript": "~4.8.4"
},

@@ -68,0 +68,0 @@ "lavamoat": {

@@ -135,4 +135,4 @@ # @metamask/auto-changelog

- Be very careful to use a clean local environment to publish the release, and follow exactly the same steps used during CI.
- Use `npm publish --dry-run` to examine the release contents to ensure the correct files are included. Compare to previous releases if necessary (e.g. using `https://unpkg.com/browse/[package name]@[package version]/`).
- Once you are confident the release contents are correct, publish the release using `npm publish`.
- Wait for the `publish-release` GitHub Action workflow to finish. This should trigger a second job (`publish-npm`), which will wait for a run approval by the [`npm publishers`](https://github.com/orgs/MetaMask/teams/npm-publishers) team.
- Approve the `publish-npm` job (or ask somebody on the npm publishers team to approve it for you).
- Once the `publish-npm` job has finished, check npm to verify that it has been published.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc