beachball
Advanced tools
Comparing version 1.13.0 to 1.13.1
@@ -5,3 +5,24 @@ { | ||
{ | ||
"date": "Tue, 03 Sep 2019 19:59:34 GMT", | ||
"date": "Tue, 10 Sep 2019 19:37:12 GMT", | ||
"tag": "beachball_v1.13.1", | ||
"version": "1.13.1", | ||
"comments": { | ||
"none": [ | ||
{ | ||
"comment": "Add publish unit tests using verdaccio.", | ||
"author": "jagore@microsoft.com", | ||
"commit": "3f512dc332c525abb677ba491804b17611e6bc86" | ||
} | ||
], | ||
"patch": [ | ||
{ | ||
"comment": "Fixing packageJsonPath to contain full path", | ||
"author": "kchau@microsoft.com", | ||
"commit": "89d0be658b6afb0e3082593680c9f0a4a6174b7d" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Tue, 03 Sep 2019 19:59:44 GMT", | ||
"tag": "beachball_v1.13.0", | ||
@@ -8,0 +29,0 @@ "version": "1.13.0", |
# Change Log - beachball | ||
This log was last generated on Tue, 03 Sep 2019 19:59:34 GMT and should not be manually modified. | ||
This log was last generated on Tue, 10 Sep 2019 19:37:12 GMT and should not be manually modified. | ||
## 1.13.1 | ||
Tue, 10 Sep 2019 19:37:12 GMT | ||
### Patches | ||
- Fixing packageJsonPath to contain full path (kchau@microsoft.com) | ||
## 1.13.0 | ||
Tue, 03 Sep 2019 19:59:34 GMT | ||
Tue, 03 Sep 2019 19:59:44 GMT | ||
@@ -8,0 +14,0 @@ ### Minor changes |
@@ -6,3 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const paths_1 = require("./paths"); | ||
const changefile_1 = require("./changefile"); | ||
@@ -12,6 +11,4 @@ const monorepo_1 = require("./monorepo"); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const semver_1 = __importDefault(require("semver")); | ||
function bump(cwd) { | ||
const gitRoot = paths_1.findGitRoot(cwd) || cwd; | ||
// Collate the changes per package | ||
@@ -29,3 +26,3 @@ const packageChangeTypes = changefile_1.getPackageChangeTypes(cwd); | ||
const changeType = packageChangeTypes[pkgName]; | ||
const packageJsonPath = path_1.default.join(gitRoot, info.packageJsonPath); | ||
const packageJsonPath = info.packageJsonPath; | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath).toString()); | ||
@@ -42,3 +39,3 @@ // Don't bump 'none' type or private packages | ||
const info = packageInfos[pkgName]; | ||
const packageJsonPath = path_1.default.join(gitRoot, info.packageJsonPath); | ||
const packageJsonPath = info.packageJsonPath; | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath).toString()); | ||
@@ -45,0 +42,0 @@ ['dependencies', 'devDependencies'].forEach(depKind => { |
@@ -18,3 +18,3 @@ "use strict"; | ||
version: packageInfos[packageName].version, | ||
date: new Date() | ||
date: new Date(), | ||
}; | ||
@@ -26,3 +26,3 @@ changelogs[packageName].comments = changelogs[packageName].comments || {}; | ||
author: change.email, | ||
commit: change.commit | ||
commit: change.commit, | ||
}); | ||
@@ -41,3 +41,3 @@ }); | ||
changelogs[pkg].comments.prerelease) { | ||
const changelogFile = path_1.default.join(cwd, packagePath, 'CHANGELOG.md'); | ||
const changelogFile = path_1.default.join(packagePath, 'CHANGELOG.md'); | ||
const previousContent = fs_1.default.existsSync(changelogFile) ? fs_1.default.readFileSync(changelogFile).toString() : ''; | ||
@@ -48,4 +48,6 @@ const nextContent = renderChangelog(previousContent, changelogs[pkg]); | ||
try { | ||
const changelogJsonFile = path_1.default.join(cwd, packagePath, 'CHANGELOG.json'); | ||
const previousJson = fs_1.default.existsSync(changelogJsonFile) ? JSON.parse(fs_1.default.readFileSync(changelogJsonFile).toString()) : { entries: [] }; | ||
const changelogJsonFile = path_1.default.join(packagePath, 'CHANGELOG.json'); | ||
const previousJson = fs_1.default.existsSync(changelogJsonFile) | ||
? JSON.parse(fs_1.default.readFileSync(changelogJsonFile).toString()) | ||
: { entries: [] }; | ||
const nextJson = renderJsonChangelog(previousJson, changelogs[pkg]); | ||
@@ -64,3 +66,3 @@ fs_1.default.writeFileSync(changelogJsonFile, JSON.stringify(nextJson, null, 2)); | ||
name: changelog.name, | ||
entries: [...previous.entries] || [] | ||
entries: [...previous.entries] || [], | ||
}; | ||
@@ -71,3 +73,3 @@ const newEntry = { | ||
version: changelog.version, | ||
comments: changelog.comments | ||
comments: changelog.comments, | ||
}; | ||
@@ -91,10 +93,13 @@ result.entries.unshift(newEntry); | ||
(changelog.comments.minor | ||
? '\n### Minor changes\n\n' + changelog.comments.minor.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Minor changes\n\n' + | ||
changelog.comments.minor.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '') + | ||
(changelog.comments.patch | ||
? '\n### Patches\n\n' + changelog.comments.patch.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Patches\n\n' + | ||
changelog.comments.patch.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '') + | ||
(changelog.comments.prerelease | ||
? '\n### Changes\n\n' + changelog.comments.prerelease.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Changes\n\n' + | ||
changelog.comments.prerelease.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '')); | ||
} |
@@ -29,3 +29,4 @@ "use strict"; | ||
function getPackageInfos(cwd) { | ||
const trackedFiles = git_1.listAllTrackedFiles(cwd); | ||
const gitRoot = paths_1.findGitRoot(cwd); | ||
const trackedFiles = git_1.listAllTrackedFiles(gitRoot); | ||
const packageJsonFiles = trackedFiles.filter(file => path_1.default.basename(file) === 'package.json'); | ||
@@ -36,8 +37,9 @@ const packageInfos = {}; | ||
try { | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(cwd, packageJsonPath), 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonPath); | ||
const packageJsonFullPath = path_1.default.join(gitRoot, packageJsonPath); | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFullPath, 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonFullPath); | ||
} | ||
catch (e) { | ||
// Pass, the package.json is invalid | ||
console.warn(`Invalid package.json file detected ${packageJsonPath}`); | ||
console.warn(`Invalid package.json file detected ${packageJsonPath}: `, e); | ||
} | ||
@@ -47,5 +49,5 @@ }); | ||
else { | ||
const packageJsonPath = path_1.default.join(paths_1.findPackageRoot(cwd), 'package.json'); | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonPath); | ||
const packageJsonFullPath = path_1.default.join(gitRoot, paths_1.findPackageRoot(cwd), 'package.json'); | ||
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonFullPath, 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonFullPath); | ||
} | ||
@@ -55,1 +57,4 @@ return packageInfos; | ||
exports.getPackageInfos = getPackageInfos; | ||
if (require.main === module) { | ||
console.log(getPackageInfos(__dirname)); | ||
} |
@@ -55,3 +55,3 @@ "use strict"; | ||
const publishBranch = 'publish_' + String(new Date().getTime()); | ||
git_1.gitFailFast(['checkout', '-b', publishBranch]); | ||
git_1.gitFailFast(['checkout', '-b', publishBranch], { cwd }); | ||
// Step 1. Bump + npm publish | ||
@@ -58,0 +58,0 @@ // bump the version |
{ | ||
"name": "beachball", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"repository": { | ||
@@ -38,2 +38,3 @@ "type": "git", | ||
"@types/yargs-parser": "^13.0.0", | ||
"find-free-port": "~2.0.0", | ||
"jest": "^24.8.0", | ||
@@ -44,2 +45,4 @@ "remark-parse": "~7.0.1", | ||
"typescript": "^3.5.1", | ||
"verdaccio": "^4.2.2", | ||
"verdaccio-memory": "^8.0.0", | ||
"unified": "^8.3.2", | ||
@@ -46,0 +49,0 @@ "unist-util-select": "^2.0.2" |
@@ -1,2 +0,1 @@ | ||
import { findGitRoot } from './paths'; | ||
import { getPackageChangeTypes } from './changefile'; | ||
@@ -6,3 +5,2 @@ import { getPackageInfos, PackageInfo } from './monorepo'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import semver from 'semver'; | ||
@@ -15,4 +13,2 @@ | ||
export function bump(cwd: string) { | ||
const gitRoot = findGitRoot(cwd) || cwd; | ||
// Collate the changes per package | ||
@@ -34,3 +30,3 @@ const packageChangeTypes = getPackageChangeTypes(cwd); | ||
const changeType = packageChangeTypes[pkgName]; | ||
const packageJsonPath = path.join(gitRoot, info.packageJsonPath); | ||
const packageJsonPath = info.packageJsonPath; | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); | ||
@@ -50,3 +46,3 @@ | ||
const info = packageInfos[pkgName]; | ||
const packageJsonPath = path.join(gitRoot, info.packageJsonPath); | ||
const packageJsonPath = info.packageJsonPath; | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); | ||
@@ -53,0 +49,0 @@ |
@@ -53,3 +53,3 @@ import { readChangeFiles, unlinkChangeFiles } from './changefile'; | ||
version: packageInfos[packageName].version, | ||
date: new Date() | ||
date: new Date(), | ||
}; | ||
@@ -62,3 +62,3 @@ | ||
author: change.email, | ||
commit: change.commit | ||
commit: change.commit, | ||
}); | ||
@@ -82,3 +82,3 @@ }); | ||
) { | ||
const changelogFile = path.join(cwd, packagePath, 'CHANGELOG.md'); | ||
const changelogFile = path.join(packagePath, 'CHANGELOG.md'); | ||
const previousContent = fs.existsSync(changelogFile) ? fs.readFileSync(changelogFile).toString() : ''; | ||
@@ -90,4 +90,6 @@ const nextContent = renderChangelog(previousContent, changelogs[pkg]); | ||
try { | ||
const changelogJsonFile = path.join(cwd, packagePath, 'CHANGELOG.json'); | ||
const previousJson = fs.existsSync(changelogJsonFile) ? JSON.parse(fs.readFileSync(changelogJsonFile).toString()) : { entries: [] }; | ||
const changelogJsonFile = path.join(packagePath, 'CHANGELOG.json'); | ||
const previousJson = fs.existsSync(changelogJsonFile) | ||
? JSON.parse(fs.readFileSync(changelogJsonFile).toString()) | ||
: { entries: [] }; | ||
const nextJson = renderJsonChangelog(previousJson, changelogs[pkg]); | ||
@@ -106,3 +108,3 @@ fs.writeFileSync(changelogJsonFile, JSON.stringify(nextJson, null, 2)); | ||
name: changelog.name, | ||
entries: [...previous.entries] || [] | ||
entries: [...previous.entries] || [], | ||
}; | ||
@@ -114,3 +116,3 @@ | ||
version: changelog.version, | ||
comments: changelog.comments | ||
comments: changelog.comments, | ||
}; | ||
@@ -142,11 +144,14 @@ | ||
(changelog.comments.minor | ||
? '\n### Minor changes\n\n' + changelog.comments.minor.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Minor changes\n\n' + | ||
changelog.comments.minor.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '') + | ||
(changelog.comments.patch | ||
? '\n### Patches\n\n' + changelog.comments.patch.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Patches\n\n' + | ||
changelog.comments.patch.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '') + | ||
(changelog.comments.prerelease | ||
? '\n### Changes\n\n' + changelog.comments.prerelease.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
? '\n### Changes\n\n' + | ||
changelog.comments.prerelease.map(change => `- ${change.comment} (${change.author})`).join('\n') | ||
: '') | ||
); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { findPackageRoot } from './paths'; | ||
import { findPackageRoot, findGitRoot } from './paths'; | ||
import fs from 'fs'; | ||
@@ -51,3 +51,4 @@ import path from 'path'; | ||
export function getPackageInfos(cwd: string) { | ||
const trackedFiles = listAllTrackedFiles(cwd); | ||
const gitRoot = findGitRoot(cwd)!; | ||
const trackedFiles = listAllTrackedFiles(gitRoot); | ||
const packageJsonFiles = trackedFiles.filter(file => path.basename(file) === 'package.json'); | ||
@@ -59,17 +60,21 @@ const packageInfos: { [pkgName: string]: PackageInfo } = {}; | ||
try { | ||
const packageJson = JSON.parse(fs.readFileSync(path.join(cwd, packageJsonPath), 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonPath); | ||
const packageJsonFullPath = path.join(gitRoot, packageJsonPath); | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonFullPath, 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonFullPath); | ||
} catch (e) { | ||
// Pass, the package.json is invalid | ||
console.warn(`Invalid package.json file detected ${packageJsonPath}`); | ||
console.warn(`Invalid package.json file detected ${packageJsonPath}: `, e); | ||
} | ||
}); | ||
} else { | ||
const packageJsonPath = path.join(findPackageRoot(cwd)!, 'package.json'); | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); | ||
const packageJsonFullPath = path.join(gitRoot, findPackageRoot(cwd)!, 'package.json'); | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonFullPath, 'utf-8')); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonPath); | ||
packageInfos[packageJson.name] = infoFromPackageJson(packageJson, packageJsonFullPath); | ||
} | ||
return packageInfos; | ||
} | ||
if (require.main === module) { | ||
console.log(getPackageInfos(__dirname)); | ||
} |
@@ -49,3 +49,3 @@ import { bump, BumpInfo } from './bump'; | ||
const publishBranch = 'publish_' + String(new Date().getTime()); | ||
gitFailFast(['checkout', '-b', publishBranch]); | ||
gitFailFast(['checkout', '-b', publishBranch], { cwd }); | ||
@@ -52,0 +52,0 @@ // Step 1. Bump + npm publish |
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
161423
87
3931
20
10
7