mirror of https://github.com/laurent22/joplin.git
Doc: Automatically create Joplin Server changelog
parent
89a2e9fe9a
commit
adad4cab75
|
@ -1782,6 +1782,9 @@ packages/server/src/utils/uuidgen.js.map
|
|||
packages/tools/lerna-add.d.ts
|
||||
packages/tools/lerna-add.js
|
||||
packages/tools/lerna-add.js.map
|
||||
packages/tools/release-cli.d.ts
|
||||
packages/tools/release-cli.js
|
||||
packages/tools/release-cli.js.map
|
||||
packages/tools/release-electron.d.ts
|
||||
packages/tools/release-electron.js
|
||||
packages/tools/release-electron.js.map
|
||||
|
|
|
@ -1770,6 +1770,9 @@ packages/server/src/utils/uuidgen.js.map
|
|||
packages/tools/lerna-add.d.ts
|
||||
packages/tools/lerna-add.js
|
||||
packages/tools/lerna-add.js.map
|
||||
packages/tools/release-cli.d.ts
|
||||
packages/tools/release-cli.js
|
||||
packages/tools/release-cli.js.map
|
||||
packages/tools/release-electron.d.ts
|
||||
packages/tools/release-electron.js
|
||||
packages/tools/release-electron.js.map
|
||||
|
|
|
@ -127,6 +127,7 @@ The Web Clipper is a browser extension that allows you to save web pages and scr
|
|||
|
||||
- [Changelog (Desktop App)](https://github.com/laurent22/joplin/blob/dev/readme/changelog.md)
|
||||
- [Changelog (CLI App)](https://github.com/laurent22/joplin/blob/dev/readme/changelog_cli.md)
|
||||
- [Changelog (Server)](https://github.com/laurent22/joplin/blob/dev/readme/changelog_server.md)
|
||||
- [Stats](https://github.com/laurent22/joplin/blob/dev/readme/stats.md)
|
||||
- [Donate](https://github.com/laurent22/joplin/blob/dev/readme/donate.md)
|
||||
<!-- TOC -->
|
||||
|
|
|
@ -87,3 +87,7 @@ To use Postgres, from the monorepo root, run `docker-compose --file docker-compo
|
|||
## Starting the server
|
||||
|
||||
From `packages/server`, run `npm run start-dev`
|
||||
|
||||
# Changelog
|
||||
|
||||
[View the changelog](https://github.com/laurent22/joplin/blob/dev/readme/changelog_server.md)
|
||||
|
|
|
@ -95,7 +95,8 @@ function filterLogs(logs, platform) {
|
|||
|
||||
let addIt = false;
|
||||
|
||||
if (prefix.indexOf('all') >= 0 && platform !== 'clipper') addIt = true;
|
||||
// "All" refers to desktop, CLI and mobile app. Clipper and Server are not included.
|
||||
if (prefix.indexOf('all') >= 0 && (platform !== 'clipper' && platform !== 'server')) addIt = true;
|
||||
if ((platform === 'android' || platform === 'ios') && prefix.indexOf('mobile') >= 0) addIt = true;
|
||||
if (platform === 'android' && prefix.indexOf('android') >= 0) addIt = true;
|
||||
if (platform === 'ios' && prefix.indexOf('ios') >= 0) addIt = true;
|
||||
|
@ -103,6 +104,7 @@ function filterLogs(logs, platform) {
|
|||
if (platform === 'desktop' && (prefix.indexOf('desktop') >= 0 || prefix.indexOf('api') >= 0 || prefix.indexOf('plugins') >= 0 || prefix.indexOf('macos') >= 0)) addIt = true;
|
||||
if (platform === 'cli' && prefix.indexOf('cli') >= 0) addIt = true;
|
||||
if (platform === 'clipper' && prefix.indexOf('clipper') >= 0) addIt = true;
|
||||
if (platform === 'server' && prefix.indexOf('server') >= 0) addIt = true;
|
||||
|
||||
// Translation updates often comes in format "Translation: Update pt_PT.po"
|
||||
// but that's not useful in a changelog especially since most people
|
||||
|
@ -134,7 +136,7 @@ function formatCommitMessage(msg, author, options) {
|
|||
const isPlatformPrefix = prefix => {
|
||||
prefix = prefix.split(',').map(p => p.trim().toLowerCase());
|
||||
for (const p of prefix) {
|
||||
if (['android', 'mobile', 'ios', 'desktop', 'cli', 'clipper', 'all', 'api', 'plugins'].indexOf(p) >= 0) return true;
|
||||
if (['android', 'mobile', 'ios', 'desktop', 'cli', 'clipper', 'all', 'api', 'plugins', 'server'].indexOf(p) >= 0) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
const { execCommand, rootDir } = require('./tool-utils.js');
|
||||
const fs = require('fs-extra');
|
||||
const moment = require('moment');
|
||||
|
||||
const appDir = `${rootDir}/packages/app-cli`;
|
||||
const changelogPath = `${rootDir}/readme/changelog_cli.md`;
|
||||
|
||||
async function insertChangelog(tag, changelog) {
|
||||
const currentText = await fs.readFile(changelogPath, 'UTF-8');
|
||||
const lines = currentText.split('\n');
|
||||
|
||||
const beforeLines = [];
|
||||
const afterLines = [];
|
||||
|
||||
for (const line of lines) {
|
||||
if (afterLines.length) {
|
||||
afterLines.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.indexOf('##') === 0) {
|
||||
afterLines.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
beforeLines.push(line);
|
||||
}
|
||||
|
||||
const header = [
|
||||
'##',
|
||||
`[${tag}](https://github.com/laurent22/joplin/releases/tag/${tag})`,
|
||||
'-',
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
`${moment.utc().format('YYYY-MM-DD\THH:mm:ss')}Z`,
|
||||
];
|
||||
|
||||
let newLines = [];
|
||||
newLines.push(header.join(' '));
|
||||
newLines.push('');
|
||||
newLines = newLines.concat(changelog.split('\n'));
|
||||
newLines.push('');
|
||||
|
||||
const output = beforeLines.concat(newLines).concat(afterLines);
|
||||
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
// Start with node Tools/release-cli.js --changelog-from cli-v1.0.126
|
||||
// to specify from where the changelog should be created
|
||||
async function main() {
|
||||
process.chdir(appDir);
|
||||
|
||||
const newVersion = (await execCommand('npm version patch')).trim();
|
||||
console.info(`Building ${newVersion}...`);
|
||||
const newTag = `cli-${newVersion}`;
|
||||
|
||||
await execCommand('git pull');
|
||||
await execCommand('touch app/main.js');
|
||||
await execCommand('npm run build');
|
||||
await execCommand('cp ../../README.md build/');
|
||||
|
||||
process.chdir(`${appDir}/build`);
|
||||
|
||||
await execCommand('npm publish');
|
||||
|
||||
const changelog = (await execCommand(`node ${rootDir}/packages/tools/git-changelog ${newTag}`)).trim();
|
||||
|
||||
const newChangelog = await insertChangelog(newTag, changelog);
|
||||
|
||||
await fs.writeFile(changelogPath, newChangelog);
|
||||
|
||||
const defaultEditor = (await execCommand('echo $EDITOR')).trim();
|
||||
|
||||
const finalCmds = [
|
||||
'git pull',
|
||||
'git add -A',
|
||||
`git commit -m "CLI ${newVersion}"`,
|
||||
`git tag "cli-${newVersion}"`,
|
||||
'git push',
|
||||
'git push --tags',
|
||||
];
|
||||
|
||||
console.info('');
|
||||
console.info('Verify that the changelog is correct:');
|
||||
console.info('');
|
||||
console.info(`${defaultEditor} "${changelogPath}"`);
|
||||
console.info('');
|
||||
console.info('Then run these commands:');
|
||||
console.info('');
|
||||
console.info(finalCmds.join(' && '));
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error');
|
||||
console.error(error);
|
||||
console.error('');
|
||||
console.error('If the app cannot auto-detect the previous tag name, specify it using --changelog-from TAG_NAME');
|
||||
process.exit(1);
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
import { execCommand, rootDir, completeReleaseWithChangelog } from './tool-utils';
|
||||
|
||||
const appDir = `${rootDir}/packages/app-cli`;
|
||||
const changelogPath = `${rootDir}/readme/changelog_cli.md`;
|
||||
|
||||
// Start with node Tools/release-cli.js --changelog-from cli-v1.0.126
|
||||
// to specify from where the changelog should be created
|
||||
async function main() {
|
||||
process.chdir(appDir);
|
||||
|
||||
const newVersion = (await execCommand('npm version patch')).trim();
|
||||
console.info(`Building ${newVersion}...`);
|
||||
const newTag = `cli-${newVersion}`;
|
||||
|
||||
await execCommand('git pull');
|
||||
await execCommand('touch app/main.js');
|
||||
await execCommand('npm run build');
|
||||
await execCommand('cp ../../README.md build/');
|
||||
|
||||
process.chdir(`${appDir}/build`);
|
||||
|
||||
await execCommand('npm publish');
|
||||
|
||||
await completeReleaseWithChangelog(changelogPath, newVersion, newTag, 'CLI');
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error');
|
||||
console.error(error);
|
||||
console.error('');
|
||||
console.error('If the app cannot auto-detect the previous tag name, specify it using --changelog-from TAG_NAME');
|
||||
process.exit(1);
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
import { execCommand2, rootDir, gitPullTry } from './tool-utils';
|
||||
import { execCommand2, rootDir, gitPullTry, completeReleaseWithChangelog } from './tool-utils';
|
||||
|
||||
const serverDir = `${rootDir}/packages/server`;
|
||||
|
||||
|
@ -18,11 +18,8 @@ async function main() {
|
|||
await execCommand2(`docker push joplin/server:${versionShort}`);
|
||||
await execCommand2('docker push joplin/server:latest');
|
||||
|
||||
await execCommand2('git add -A');
|
||||
await execCommand2(`git commit -m 'Server release ${version}'`);
|
||||
await execCommand2(`git tag ${tagName}`);
|
||||
await execCommand2('git push');
|
||||
await execCommand2('git push --tags');
|
||||
const changelogPath = `${rootDir}/readme/changelog_server.md`;
|
||||
await completeReleaseWithChangelog(changelogPath, version, tagName, 'Server');
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
|
|
@ -3,6 +3,7 @@ import * as fs from 'fs-extra';
|
|||
const fetch = require('node-fetch');
|
||||
const execa = require('execa');
|
||||
const { splitCommandString } = require('@joplin/lib/string-utils');
|
||||
const moment = require('moment');
|
||||
|
||||
function quotePath(path: string) {
|
||||
if (!path) return '';
|
||||
|
@ -21,6 +22,72 @@ function commandToString(commandName: string, args: string[] = []) {
|
|||
return output.join(' ');
|
||||
}
|
||||
|
||||
async function insertChangelog(tag: string, changelogPath: string, changelog: string) {
|
||||
const currentText = await fs.readFile(changelogPath, 'UTF-8');
|
||||
const lines = currentText.split('\n');
|
||||
|
||||
const beforeLines = [];
|
||||
const afterLines = [];
|
||||
|
||||
for (const line of lines) {
|
||||
if (afterLines.length) {
|
||||
afterLines.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.indexOf('##') === 0) {
|
||||
afterLines.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
beforeLines.push(line);
|
||||
}
|
||||
|
||||
const header = [
|
||||
'##',
|
||||
`[${tag}](https://github.com/laurent22/joplin/releases/tag/${tag})`,
|
||||
'-',
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
`${moment.utc().format('YYYY-MM-DD\THH:mm:ss')}Z`,
|
||||
];
|
||||
|
||||
let newLines = [];
|
||||
newLines.push(header.join(' '));
|
||||
newLines.push('');
|
||||
newLines = newLines.concat(changelog.split('\n'));
|
||||
newLines.push('');
|
||||
|
||||
const output = beforeLines.concat(newLines).concat(afterLines);
|
||||
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
export async function completeReleaseWithChangelog(changelogPath: string, newVersion: string, newTag: string, appName: string) {
|
||||
const changelog = (await execCommand2(`node ${rootDir}/packages/tools/git-changelog ${newTag}`, { })).trim();
|
||||
|
||||
const newChangelog = await insertChangelog(newTag, changelogPath, changelog);
|
||||
|
||||
await fs.writeFile(changelogPath, newChangelog);
|
||||
|
||||
const finalCmds = [
|
||||
'git pull',
|
||||
'git add -A',
|
||||
`git commit -m "${appName} ${newVersion}"`,
|
||||
`git tag "${newTag}"`,
|
||||
'git push',
|
||||
'git push --tags',
|
||||
];
|
||||
|
||||
console.info('');
|
||||
console.info('Verify that the changelog is correct:');
|
||||
console.info('');
|
||||
console.info(`${process.env.EDITOR} "${changelogPath}"`);
|
||||
console.info('');
|
||||
console.info('Then run these commands:');
|
||||
console.info('');
|
||||
console.info(finalCmds.join(' && '));
|
||||
}
|
||||
|
||||
async function loadGitHubUsernameCache() {
|
||||
const path = `${__dirname}/github_username_cache.json`;
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# Joplin Server Changelog
|
||||
|
||||
## [server-v1.7.2](https://github.com/laurent22/joplin/releases/tag/server-v1.7.4) - 2021-01-24T19:11:10Z
|
||||
|
||||
- Fixed: Fixed password hashing when changing password
|
||||
- Improved: Many other internal changes for increased reliability
|
Loading…
Reference in New Issue