Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@changesets/parse
Advanced tools
@changesets/parse is a utility for parsing changeset files in a JavaScript/TypeScript project. It helps in reading and interpreting changeset files, which are used to manage versioning and changelogs in a project.
Parsing a Changeset File
This feature allows you to parse a changeset file content and get a structured representation of the changeset. The `parseChangeset` function takes the raw content of a changeset file and returns an object with the parsed information.
const { parseChangeset } = require('@changesets/parse');
const changesetContent = `---
"package-a": patch
"package-b": minor
---
Some description of the changes.`;
const parsedChangeset = parseChangeset(changesetContent);
console.log(parsedChangeset);
Handling Invalid Changeset Content
This feature demonstrates how to handle errors when parsing invalid changeset content. The `parseChangeset` function will throw an error if the content is not valid, which can be caught and handled appropriately.
const { parseChangeset } = require('@changesets/parse');
try {
const invalidChangesetContent = `---
"package-a": unknown
---
Invalid changeset content.`;
const parsedChangeset = parseChangeset(invalidChangesetContent);
} catch (error) {
console.error('Failed to parse changeset:', error.message);
}
The `conventional-changelog` package is used to generate changelogs based on conventional commit messages. It provides a way to automate the process of creating changelogs and managing versioning. Unlike @changesets/parse, which focuses on parsing changeset files, `conventional-changelog` is more about generating changelogs from commit messages.
The `standard-version` package is a utility for versioning and changelog generation based on conventional commit messages. It automates the process of version bumping, changelog generation, and git tagging. While `standard-version` focuses on the entire release process, @changesets/parse is specifically for parsing changeset files.
Lerna is a tool for managing JavaScript projects with multiple packages. It optimizes the workflow around managing multi-package repositories. Lerna includes features for versioning and publishing packages, which can be compared to the functionality provided by changesets. However, Lerna is a more comprehensive tool for monorepo management, whereas @changesets/parse is focused on parsing changeset files.
Parses a changeset from its written format to a data object.
import parse from "@changesets/parse";
const changeset = `---
"@changesets/something": minor
"@changesets/something-else": patch
---
A description of a minor change`;
const parsedChangeset = parse(changeset);
For example, it can convert:
---
"@changesets/something": minor
"@changesets/something-else": patch
---
A description of a minor change
to
{
"summary": "A description of a minor change",
"releases": [
{ "name": "@changesets/something", "type": "minor" },
{ "name": "@changesets/something-else", "type": "patch" }
]
}
Note that this is not quite a complete Changeset for most tools as it lacks an id
.
For written changesets, the id is normally given as the file name, which parse is not aware of.
FAQs
Parse a changeset file's contents into a usable json object
We found that @changesets/parse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.