New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

beachball

Package Overview
Dependencies
Maintainers
1
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beachball - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

11

CHANGELOG.md
# Changelog - beachball
This log was last generated on Sun, 23 Jun 2019 00:40:30 GMT and should not be manually modified.
This log was last generated on Thu, 27 Jun 2019 17:50:27 GMT and should not be manually modified.
## 1.8.0
Thu, 27 Jun 2019 17:50:27 GMT
### Minor
- Also writes out json for changelogs while fixing the sitemap (kchau@microsoft.com)
## 1.7.0
Sun, 23 Jun 2019 00:40:30 GMT
Sun, 23 Jun 2019 00:40:35 GMT

@@ -8,0 +15,0 @@ ### Minor

@@ -5,2 +5,3 @@ import { PackageInfo } from './bump';

email: string;
author?: string;
commit: string;

@@ -7,0 +8,0 @@ }

@@ -33,6 +33,16 @@ "use strict";

Object.keys(changelogs).forEach(pkg => {
const changelogFile = path_1.default.join(path_1.default.dirname(packageInfos[pkg].packageJsonPath), 'CHANGELOG.md');
const packagePath = path_1.default.dirname(packageInfos[pkg].packageJsonPath);
const changelogFile = path_1.default.join(packagePath, 'CHANGELOG.md');
const previousContent = fs_1.default.existsSync(changelogFile) ? fs_1.default.readFileSync(changelogFile).toString() : '';
const nextContent = renderChangelog(previousContent, changelogs[pkg], changelogFile);
const nextContent = renderChangelog(previousContent, changelogs[pkg]);
fs_1.default.writeFileSync(changelogFile, nextContent);
try {
const changelogJsonFile = path_1.default.join(packagePath, 'CHANGELOG.json');
const previousJson = fs_1.default.existsSync(changelogJsonFile) ? JSON.parse(fs_1.default.readFileSync(changelogJsonFile).toString()) : {};
const nextJson = renderJsonChangelog(previousJson, changelogs[pkg]);
fs_1.default.writeFileSync(changelogJsonFile, JSON.stringify(nextJson, null, 2));
}
catch (e) {
console.warn("The CHANGELOG.json file is invalid, skipping writing to it");
}
});

@@ -42,3 +52,17 @@ changefile_1.unlinkChangeFiles(cwd);

exports.writeChangelog = writeChangelog;
function renderChangelog(previous, changelog, file) {
function renderJsonChangelog(previous, changelog) {
console.log('previous\n', previous.entries);
const result = {
name: changelog.name,
entries: [...previous.entries] || []
};
const newEntry = {
date: changelog.date.toUTCString(),
version: changelog.version,
changes: changelog.changes
};
result.entries.unshift(newEntry);
return result;
}
function renderChangelog(previous, changelog) {
return (`# Changelog - ${changelog.name}\n\n` +

@@ -45,0 +69,0 @@ `This log was last generated on ${changelog.date.toUTCString()} and should not be manually modified.\n` +

4

package.json
{
"name": "beachball",
"version": "1.7.0",
"version": "1.8.0",
"main": "index.js",

@@ -11,3 +11,3 @@ "license": "MIT",

"type": "git",
"url": "https://github.com/kenotron/beachball"
"url": "https://github.com/microsoft/beachball"
},

@@ -14,0 +14,0 @@ "scripts": {

@@ -9,2 +9,3 @@ import { readChangeFiles, unlinkChangeFiles } from './changefile';

email: string;
author?: string;
commit: string;

@@ -25,2 +26,18 @@ }

interface ChangelogJsonEntry {
date: string,
version: string,
changes: {
patch?: ChangelogEntry[];
minor?: ChangelogEntry[];
major?: ChangelogEntry[];
none?: ChangelogEntry[];
}
}
interface ChangelogJson {
name: string;
entries: ChangelogJsonEntry[];
}
export function getPackageChangelogs(packageInfos: { [pkg: string]: PackageInfo }, cwd: string) {

@@ -54,7 +71,17 @@ const changes = readChangeFiles(cwd);

Object.keys(changelogs).forEach(pkg => {
const changelogFile = path.join(path.dirname(packageInfos[pkg].packageJsonPath), 'CHANGELOG.md');
const packagePath = path.dirname(packageInfos[pkg].packageJsonPath);
const changelogFile = path.join(packagePath, 'CHANGELOG.md');
const previousContent = fs.existsSync(changelogFile) ? fs.readFileSync(changelogFile).toString() : '';
const nextContent = renderChangelog(previousContent, changelogs[pkg], changelogFile);
const nextContent = renderChangelog(previousContent, changelogs[pkg]);
fs.writeFileSync(changelogFile, nextContent);
fs.writeFileSync(changelogFile, nextContent);
try {
const changelogJsonFile = path.join(packagePath, 'CHANGELOG.json');
const previousJson = fs.existsSync(changelogJsonFile) ? JSON.parse(fs.readFileSync(changelogJsonFile).toString()) : {};
const nextJson = renderJsonChangelog(previousJson, changelogs[pkg]);
fs.writeFileSync(changelogJsonFile, JSON.stringify(nextJson, null, 2));
} catch (e) {
console.warn("The CHANGELOG.json file is invalid, skipping writing to it")
}
});

@@ -65,3 +92,22 @@

function renderChangelog(previous: string, changelog: PackageChangelog, file: string) {
function renderJsonChangelog(previous: ChangelogJson, changelog: PackageChangelog) {
console.log('previous\n', previous.entries);
const result: ChangelogJson = {
name: changelog.name,
entries: [...previous.entries] || []
};
const newEntry: ChangelogJsonEntry = {
date: changelog.date.toUTCString(),
version: changelog.version,
changes: changelog.changes
}
result.entries.unshift(newEntry);
return result;
}
function renderChangelog(previous: string, changelog: PackageChangelog) {
return (

@@ -73,5 +119,5 @@ `# Changelog - ${changelog.name}\n\n` +

? previous
.split(/\n/g)
.slice(3)
.join('\n')
.split(/\n/g)
.slice(3)
.join('\n')
: '')

@@ -78,0 +124,0 @@ );

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